diff options
| author | YAMAMOTO Mitsuharu | 2019-06-07 17:43:39 +0900 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2019-06-07 17:44:03 +0900 |
| commit | 3a1f92d09bbcb4dbd2a2ebe1bee0e564e51c4615 (patch) | |
| tree | 4cd1df5cfb0d4a546854ca385cdf508803b480e6 /src/image.c | |
| parent | 480da9f2216d16fb30f42e7e2e40774cf2ea48b7 (diff) | |
| download | emacs-3a1f92d09bbcb4dbd2a2ebe1bee0e564e51c4615.tar.gz emacs-3a1f92d09bbcb4dbd2a2ebe1bee0e564e51c4615.zip | |
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.
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 18 |
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 | |||
| 2058 | image_set_crop (struct image *img, matrix3x3 tm) | 2058 | image_set_crop (struct image *img, matrix3x3 tm) |
| 2059 | { | 2059 | { |
| 2060 | #ifdef HAVE_NATIVE_TRANSFORMS | 2060 | #ifdef HAVE_NATIVE_TRANSFORMS |
| 2061 | int width, height; | ||
| 2062 | compute_image_size (img->width, img->height, img->spec, &width, &height); | ||
| 2063 | # ifdef HAVE_IMAGEMAGICK | 2061 | # ifdef HAVE_IMAGEMAGICK |
| 2064 | /* ImageMagick images are already cropped. */ | 2062 | /* ImageMagick images are already cropped. */ |
| 2065 | if (EQ (image_spec_value (img->spec, QCtype, NULL), Qimagemagick)) | 2063 | if (EQ (image_spec_value (img->spec, QCtype, NULL), Qimagemagick)) |
| 2066 | return; | 2064 | return; |
| 2067 | # endif | 2065 | # endif |
| 2068 | 2066 | ||
| 2069 | # ifdef USE_CAIRO | 2067 | # ifdef HAVE_XRENDER |
| 2070 | img->width = width; | ||
| 2071 | img->height = height; | ||
| 2072 | # elif defined HAVE_XRENDER | ||
| 2073 | if (!img->picture) | 2068 | if (!img->picture) |
| 2074 | return; | 2069 | return; |
| 2075 | # endif | 2070 | # endif |
| @@ -2094,6 +2089,7 @@ image_set_crop (struct image *img, matrix3x3 tm) | |||
| 2094 | } | 2089 | } |
| 2095 | } | 2090 | } |
| 2096 | 2091 | ||
| 2092 | int width = img->width; | ||
| 2097 | if (FIXNATP (w) && XFIXNAT (w) < img->width) | 2093 | if (FIXNATP (w) && XFIXNAT (w) < img->width) |
| 2098 | width = XFIXNAT (w); | 2094 | width = XFIXNAT (w); |
| 2099 | int left; | 2095 | int left; |
| @@ -2106,6 +2102,7 @@ image_set_crop (struct image *img, matrix3x3 tm) | |||
| 2106 | else | 2102 | else |
| 2107 | left = (img->width - width) >> 1; | 2103 | left = (img->width - width) >> 1; |
| 2108 | 2104 | ||
| 2105 | int height = img->height; | ||
| 2109 | if (FIXNATP (h) && XFIXNAT (h) < img->height) | 2106 | if (FIXNATP (h) && XFIXNAT (h) < img->height) |
| 2110 | height = XFIXNAT (h); | 2107 | height = XFIXNAT (h); |
| 2111 | int top; | 2108 | int top; |
| @@ -2168,7 +2165,6 @@ image_set_size (struct image *img, matrix3x3 tm) | |||
| 2168 | 2165 | ||
| 2169 | compute_image_size (img->width, img->height, img->spec, &width, &height); | 2166 | compute_image_size (img->width, img->height, img->spec, &width, &height); |
| 2170 | 2167 | ||
| 2171 | # if defined (HAVE_NS) || defined (HAVE_XRENDER) | ||
| 2172 | double xscale = img->width / (double) width; | 2168 | double xscale = img->width / (double) width; |
| 2173 | double yscale = img->height / (double) height; | 2169 | double yscale = img->height / (double) height; |
| 2174 | 2170 | ||
| @@ -2178,14 +2174,6 @@ image_set_size (struct image *img, matrix3x3 tm) | |||
| 2178 | 2174 | ||
| 2179 | img->width = width; | 2175 | img->width = width; |
| 2180 | img->height = height; | 2176 | img->height = height; |
| 2181 | # endif | ||
| 2182 | |||
| 2183 | # ifdef HAVE_NTGUI | ||
| 2184 | /* Under HAVE_NTGUI, we will scale the image on the fly, when we | ||
| 2185 | draw it. See w32term.c:x_draw_image_foreground. */ | ||
| 2186 | img->width = width; | ||
| 2187 | img->height = height; | ||
| 2188 | # endif | ||
| 2189 | #endif | 2177 | #endif |
| 2190 | } | 2178 | } |
| 2191 | 2179 | ||