summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2019-06-07 17:43:39 +0900
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2019-06-07 17:44:03 +0900
commit3a1f92d09bbcb4dbd2a2ebe1bee0e564e51c4615 (patch)
tree4cd1df5cfb0d4a546854ca385cdf508803b480e6
parent480da9f2216d16fb30f42e7e2e40774cf2ea48b7 (diff)
downloademacs-3a1f92d09bbcb4dbd2a2ebe1bee0e564e51c4615.tar.gz
Fix image_set_crop yet again
* src/image.c (image_set_crop) [HAVE_NATIVE_TRANSFORMS]: Don't call compute_image_size, as it is already called from image_set_size. (image_set_size, image_set_crop) [HAVE_NATIVE_TRANSFORMS]: Use harmless matrix transformation code also for USE_CAIRO and HAVE_NTGUI cases, though image_set_transform is not yet implemented on them.
-rw-r--r--src/image.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/image.c b/src/image.c
index 1ac665ba45f..30f4f4b0bc5 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2058,18 +2058,13 @@ static void
image_set_crop (struct image *img, matrix3x3 tm)
{
#ifdef HAVE_NATIVE_TRANSFORMS
- int width, height;
- compute_image_size (img->width, img->height, img->spec, &width, &height);
# ifdef HAVE_IMAGEMAGICK
/* ImageMagick images are already cropped. */
if (EQ (image_spec_value (img->spec, QCtype, NULL), Qimagemagick))
return;
# endif
-# ifdef USE_CAIRO
- img->width = width;
- img->height = height;
-# elif defined HAVE_XRENDER
+# ifdef HAVE_XRENDER
if (!img->picture)
return;
# endif
@@ -2094,6 +2089,7 @@ image_set_crop (struct image *img, matrix3x3 tm)
}
}
+ int width = img->width;
if (FIXNATP (w) && XFIXNAT (w) < img->width)
width = XFIXNAT (w);
int left;
@@ -2106,6 +2102,7 @@ image_set_crop (struct image *img, matrix3x3 tm)
else
left = (img->width - width) >> 1;
+ int height = img->height;
if (FIXNATP (h) && XFIXNAT (h) < img->height)
height = XFIXNAT (h);
int top;
@@ -2168,7 +2165,6 @@ image_set_size (struct image *img, matrix3x3 tm)
compute_image_size (img->width, img->height, img->spec, &width, &height);
-# if defined (HAVE_NS) || defined (HAVE_XRENDER)
double xscale = img->width / (double) width;
double yscale = img->height / (double) height;
@@ -2178,14 +2174,6 @@ image_set_size (struct image *img, matrix3x3 tm)
img->width = width;
img->height = height;
-# endif
-
-# ifdef HAVE_NTGUI
- /* Under HAVE_NTGUI, we will scale the image on the fly, when we
- draw it. See w32term.c:x_draw_image_foreground. */
- img->width = width;
- img->height = height;
-# endif
#endif
}