#endif /* USE_X_TOOLKIT */
#ifdef HAVE_XRENDER
-#include <X11/extensions/Xrender.h>
+# include <X11/extensions/Xrender.h>
#endif
#else /* !HAVE_X_WINDOWS */
#ifdef HAVE_WINDOW_SYSTEM
-#if defined (HAVE_X_WINDOWS) && defined (HAVE_XRENDER) \
- || defined (HAVE_NS)
-#define HAVE_NATIVE_SCALING
-#endif
+# if defined HAVE_XRENDER || defined HAVE_NS
+# define HAVE_NATIVE_SCALING
+# endif
/* Structure describing an image. Specific image formats like XBM are
converted into this form, so that display only has to deal with
synchronized to Pixmap. */
XImagePtr ximg, mask_img;
-#ifdef HAVE_NATIVE_SCALING
+# ifdef HAVE_NATIVE_SCALING
/* Picture versions of pixmap and mask for compositing. */
Picture picture, mask_picture;
-#endif
+# endif
#endif
/* Colors allocated for this image, if any. Allocated via xmalloc. */
*d_width = desired_width;
*d_height = desired_height;
}
+#endif /* HAVE_IMAGEMAGICK || HAVE_NATIVE_SCALING */
-#ifdef HAVE_NATIVE_SCALING
static void
x_set_image_size (struct frame *f, struct image *img)
{
-#ifdef HAVE_IMAGEMAGICK
+#ifdef HAVE_NATIVE_SCALING
+# ifdef HAVE_IMAGEMAGICK
/* ImageMagick images are already the correct size. */
- if (!EQ (image_spec_value (img->spec, QCtype, NULL), Qimagemagick))
-#endif
- {
- int width, height;
+ if (EQ (image_spec_value (img->spec, QCtype, NULL), Qimagemagick))
+ return;
+# endif
- compute_image_size (img->width, img->height, img->spec, &width, &height);
+ int width, height;
+ compute_image_size (img->width, img->height, img->spec, &width, &height);
-#ifdef HAVE_NS
- ns_image_set_size (img->pixmap, width, height);
- img->width = width;
- img->height = height;
-#endif
+# ifdef HAVE_NS
+ ns_image_set_size (img->pixmap, width, height);
+ img->width = width;
+ img->height = height;
+# endif
-#ifdef HAVE_XRENDER
- if (img->picture)
- {
- double xscale = (double) img->width/width;
- double yscale = (double) img->height/height;
+# ifdef HAVE_XRENDER
+ if (img->picture)
+ {
+ double xscale = img->width / (double) width;
+ double yscale = img->height / (double) height;
- XTransform tmat = {{{XDoubleToFixed (xscale), XDoubleToFixed (0), XDoubleToFixed (0)},
- {XDoubleToFixed (0), XDoubleToFixed (yscale), XDoubleToFixed (0)},
- {XDoubleToFixed (0), XDoubleToFixed (0), XDoubleToFixed (1)}}};
+ XTransform tmat
+ = {{{XDoubleToFixed (xscale), XDoubleToFixed (0), XDoubleToFixed (0)},
+ {XDoubleToFixed (0), XDoubleToFixed (yscale), XDoubleToFixed (0)},
+ {XDoubleToFixed (0), XDoubleToFixed (0), XDoubleToFixed (1)}}};
- XRenderSetPictureFilter (FRAME_X_DISPLAY (f), img->picture, FilterBest, 0, 0);
- XRenderSetPictureTransform (FRAME_X_DISPLAY (f), img->picture, &tmat);
+ XRenderSetPictureFilter (FRAME_X_DISPLAY (f), img->picture, FilterBest,
+ 0, 0);
+ XRenderSetPictureTransform (FRAME_X_DISPLAY (f), img->picture, &tmat);
- img->width = width;
- img->height = height;
- }
-#endif
+ img->width = width;
+ img->height = height;
}
-}
+# endif
#endif
-#endif /* HAVE_IMAGEMAGICK || HAVE_XRENDER || HAVE_NS */
+}
/* Return the id of image with Lisp specification SPEC on frame F.
`:background COLOR'. */
Lisp_Object ascent, margin, relief, bg;
int relief_bound;
-#ifdef HAVE_NATIVE_SCALING
x_set_image_size (f, img);
-#endif
ascent = image_spec_value (spec, QCascent, NULL);
if (FIXNUMP (ascent))
Display *display = FRAME_X_DISPLAY (f);
Drawable drawable = FRAME_X_DRAWABLE (f);
Screen *screen = FRAME_X_SCREEN (f);
-#ifdef HAVE_XRENDER
- int event_basep, error_basep;
-#endif
eassert (input_blocked_p ());
return 0;
}
-#ifdef HAVE_XRENDER
+# ifdef HAVE_XRENDER
+ int event_basep, error_basep;
if (picture && XRenderQueryExtension (display, &event_basep, &error_basep))
{
XRenderPictFormat *format;
: PictStandardA8);
*picture = XRenderCreatePicture (display, *pixmap, format, 0, &attr);
}
-#endif
+# endif
return 1;
#endif /* HAVE_X_WINDOWS */
{
eassert ((!mask_p ? img->pixmap : img->mask) == NO_PIXMAP);
- return x_create_x_image_and_pixmap (f, width, height, depth, ximg,
- !mask_p ? &img->pixmap : &img->mask,
+ Picture *picture = NULL;
#ifdef HAVE_XRENDER
- !mask_p ? &img->picture : &img->mask_picture
-#else
- NULL
+ picture = !mask_p ? &img->picture : &img->mask_picture;
#endif
- );
+ return x_create_x_image_and_pixmap (f, width, height, depth, ximg,
+ !mask_p ? &img->pixmap : &img->mask,
+ picture);
}
/* Put X image XIMG into image IMG on frame F, as a mask if and only
width, height);
XRenderFreePicture (s->display, destination);
+ return;
}
- else
#endif
- XCopyArea (s->display, s->img->pixmap,
- dest, s->gc,
- srcX, srcY,
- width, height, dstX, dstY);
+
+ XCopyArea (s->display, s->img->pixmap,
+ dest, s->gc,
+ srcX, srcY,
+ width, height, dstX, dstY);
}
image_rect.width = s->slice.width;
image_rect.height = s->slice.height;
if (x_intersect_rectangles (&clip_rect, &image_rect, &r))
- x_composite_image (s, FRAME_X_DRAWABLE (s->f), s->slice.x + r.x - x, s->slice.y + r.y - y,
+ x_composite_image (s, FRAME_X_DRAWABLE (s->f),
+ s->slice.x + r.x - x, s->slice.y + r.y - y,
r.x, r.y, r.width, r.height);
}
else