diff options
| author | Andrea Corallo | 2020-08-09 15:03:23 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2020-08-09 15:03:23 +0200 |
| commit | 12a982d9789052d8e85efcacb4b311f4876c882a (patch) | |
| tree | a452a8e888c6ee9c85d6a487359b7a1c0c9fa15b /src/image.c | |
| parent | 80d7f710f2fab902e46aa3fddb8e1c1795420af3 (diff) | |
| parent | 8e82baf5a730ff542118ddba5b76afdc1db643f6 (diff) | |
| download | emacs-12a982d9789052d8e85efcacb4b311f4876c882a.tar.gz emacs-12a982d9789052d8e85efcacb4b311f4876c882a.zip | |
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/image.c b/src/image.c index e7e0a93313b..e236b389210 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -259,6 +259,8 @@ cr_put_image_to_cr_data (struct image *img) | |||
| 259 | cairo_matrix_t matrix; | 259 | cairo_matrix_t matrix; |
| 260 | cairo_pattern_get_matrix (img->cr_data, &matrix); | 260 | cairo_pattern_get_matrix (img->cr_data, &matrix); |
| 261 | cairo_pattern_set_matrix (pattern, &matrix); | 261 | cairo_pattern_set_matrix (pattern, &matrix); |
| 262 | cairo_pattern_set_filter | ||
| 263 | (pattern, cairo_pattern_get_filter (img->cr_data)); | ||
| 262 | cairo_pattern_destroy (img->cr_data); | 264 | cairo_pattern_destroy (img->cr_data); |
| 263 | } | 265 | } |
| 264 | cairo_surface_destroy (surface); | 266 | cairo_surface_destroy (surface); |
| @@ -2114,6 +2116,15 @@ image_set_transform (struct frame *f, struct image *img) | |||
| 2114 | double rotation = 0.0; | 2116 | double rotation = 0.0; |
| 2115 | compute_image_rotation (img, &rotation); | 2117 | compute_image_rotation (img, &rotation); |
| 2116 | 2118 | ||
| 2119 | # if defined USE_CAIRO || defined HAVE_XRENDER || defined HAVE_NS | ||
| 2120 | /* We want scale up operations to use a nearest neighbour filter to | ||
| 2121 | show real pixels instead of munging them, but scale down | ||
| 2122 | operations to use a blended filter, to avoid aliasing and the like. | ||
| 2123 | |||
| 2124 | TODO: implement for Windows. */ | ||
| 2125 | bool scale_down = (width < img->width) || (height < img->height); | ||
| 2126 | # endif | ||
| 2127 | |||
| 2117 | /* Perform scale transformation. */ | 2128 | /* Perform scale transformation. */ |
| 2118 | 2129 | ||
| 2119 | matrix3x3 matrix | 2130 | matrix3x3 matrix |
| @@ -2225,11 +2236,14 @@ image_set_transform (struct frame *f, struct image *img) | |||
| 2225 | /* Under NS the transform is applied to the drawing surface at | 2236 | /* Under NS the transform is applied to the drawing surface at |
| 2226 | drawing time, so store it for later. */ | 2237 | drawing time, so store it for later. */ |
| 2227 | ns_image_set_transform (img->pixmap, matrix); | 2238 | ns_image_set_transform (img->pixmap, matrix); |
| 2239 | ns_image_set_smoothing (img->pixmap, scale_down); | ||
| 2228 | # elif defined USE_CAIRO | 2240 | # elif defined USE_CAIRO |
| 2229 | cairo_matrix_t cr_matrix = {matrix[0][0], matrix[0][1], matrix[1][0], | 2241 | cairo_matrix_t cr_matrix = {matrix[0][0], matrix[0][1], matrix[1][0], |
| 2230 | matrix[1][1], matrix[2][0], matrix[2][1]}; | 2242 | matrix[1][1], matrix[2][0], matrix[2][1]}; |
| 2231 | cairo_pattern_t *pattern = cairo_pattern_create_rgb (0, 0, 0); | 2243 | cairo_pattern_t *pattern = cairo_pattern_create_rgb (0, 0, 0); |
| 2232 | cairo_pattern_set_matrix (pattern, &cr_matrix); | 2244 | cairo_pattern_set_matrix (pattern, &cr_matrix); |
| 2245 | cairo_pattern_set_filter (pattern, scale_down | ||
| 2246 | ? CAIRO_FILTER_BEST : CAIRO_FILTER_NEAREST); | ||
| 2233 | /* Dummy solid color pattern just to record pattern matrix. */ | 2247 | /* Dummy solid color pattern just to record pattern matrix. */ |
| 2234 | img->cr_data = pattern; | 2248 | img->cr_data = pattern; |
| 2235 | # elif defined (HAVE_XRENDER) | 2249 | # elif defined (HAVE_XRENDER) |
| @@ -2246,14 +2260,14 @@ image_set_transform (struct frame *f, struct image *img) | |||
| 2246 | XDoubleToFixed (matrix[1][2]), | 2260 | XDoubleToFixed (matrix[1][2]), |
| 2247 | XDoubleToFixed (matrix[2][2])}}}; | 2261 | XDoubleToFixed (matrix[2][2])}}}; |
| 2248 | 2262 | ||
| 2249 | XRenderSetPictureFilter (FRAME_X_DISPLAY (f), img->picture, FilterBest, | 2263 | XRenderSetPictureFilter (FRAME_X_DISPLAY (f), img->picture, |
| 2250 | 0, 0); | 2264 | scale_down ? FilterBest : FilterNearest, 0, 0); |
| 2251 | XRenderSetPictureTransform (FRAME_X_DISPLAY (f), img->picture, &tmat); | 2265 | XRenderSetPictureTransform (FRAME_X_DISPLAY (f), img->picture, &tmat); |
| 2252 | 2266 | ||
| 2253 | if (img->mask_picture) | 2267 | if (img->mask_picture) |
| 2254 | { | 2268 | { |
| 2255 | XRenderSetPictureFilter (FRAME_X_DISPLAY (f), img->mask_picture, | 2269 | XRenderSetPictureFilter (FRAME_X_DISPLAY (f), img->mask_picture, |
| 2256 | FilterBest, 0, 0); | 2270 | scale_down ? FilterBest : FilterNearest, 0, 0); |
| 2257 | XRenderSetPictureTransform (FRAME_X_DISPLAY (f), img->mask_picture, | 2271 | XRenderSetPictureTransform (FRAME_X_DISPLAY (f), img->mask_picture, |
| 2258 | &tmat); | 2272 | &tmat); |
| 2259 | } | 2273 | } |