Merge branch '63-regression-3-22-26-3-22-27-hidpi-checkboxes-and-radiobuttons-pixmaps-are-not-scaled' into 'gtk-3-22'
Resolve "[ Regression 3.22.26 -> 3.22.27 ] [HIDPI] Checkboxes and radiobuttons pixmaps are not scaled" See merge request GNOME/gtk!47
This commit is contained in:
@@ -60,8 +60,14 @@ gtk_css_image_surface_draw (GtkCssImage *image,
|
|||||||
ABS (width - surface->width) > 0.001 ||
|
ABS (width - surface->width) > 0.001 ||
|
||||||
ABS (height - surface->height) > 0.001)
|
ABS (height - surface->height) > 0.001)
|
||||||
{
|
{
|
||||||
|
double xscale, yscale;
|
||||||
cairo_t *cache;
|
cairo_t *cache;
|
||||||
|
|
||||||
|
/* We need the device scale (HiDPI mode) to calculate the proper size in
|
||||||
|
* pixels for the image surface and set the cache device scale
|
||||||
|
*/
|
||||||
|
cairo_surface_get_device_scale (cairo_get_target (cr), &xscale, &yscale);
|
||||||
|
|
||||||
/* Save original size to preserve precision */
|
/* Save original size to preserve precision */
|
||||||
surface->width = width;
|
surface->width = width;
|
||||||
surface->height = height;
|
surface->height = height;
|
||||||
@@ -72,8 +78,9 @@ gtk_css_image_surface_draw (GtkCssImage *image,
|
|||||||
/* Image big enough to contain scaled image with subpixel precision */
|
/* Image big enough to contain scaled image with subpixel precision */
|
||||||
surface->cache = cairo_surface_create_similar_image (surface->surface,
|
surface->cache = cairo_surface_create_similar_image (surface->surface,
|
||||||
CAIRO_FORMAT_ARGB32,
|
CAIRO_FORMAT_ARGB32,
|
||||||
ceil (width),
|
ceil (width*xscale),
|
||||||
ceil (height));
|
ceil (height*yscale));
|
||||||
|
cairo_surface_set_device_scale (surface->cache, xscale, yscale);
|
||||||
cache = cairo_create (surface->cache);
|
cache = cairo_create (surface->cache);
|
||||||
cairo_rectangle (cache, 0, 0, width, height);
|
cairo_rectangle (cache, 0, 0, width, height);
|
||||||
cairo_scale (cache, width / image_width, height / image_height);
|
cairo_scale (cache, width / image_width, height / image_height);
|
||||||
|
|||||||
Reference in New Issue
Block a user