[gtk+] shadows: Respect scaled factors for cached surface
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] shadows: Respect scaled factors for cached surface
- Date: Thu, 9 Oct 2014 23:04:36 +0000 (UTC)
commit 3f4bd447f837696b44902ea6c8980cc7fa43782c
Author: Benjamin Otte <otte redhat com>
Date: Fri Oct 10 01:02:34 2014 +0200
shadows: Respect scaled factors for cached surface
gtk/gtkcssshadowvalue.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index a651bcc..8b5ea9f 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -423,22 +423,28 @@ make_blurred_pango_surface (cairo_t *existing_cr,
cairo_surface_t *surface;
cairo_t *cr;
gdouble radius, clip_radius;
+ gdouble x_scale, y_scale;
PangoRectangle ink_rect;
radius = _gtk_css_number_value_get (shadow->radius, 0);
pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
clip_radius = _gtk_cairo_blur_compute_pixels (radius);
+ x_scale = y_scale = 1;
+#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
+ cairo_surface_get_device_scale (cairo_get_target (existing_cr), &x_scale, &y_scale);
+#endif
surface = cairo_surface_create_similar_image (cairo_get_target (existing_cr),
CAIRO_FORMAT_A8,
- ink_rect.width + 2 * clip_radius,
- ink_rect.height + 2 * clip_radius);
+ x_scale * (ink_rect.width + 2 * clip_radius),
+ y_scale * (ink_rect.height + 2 * clip_radius));
+ cairo_surface_set_device_scale (surface, x_scale, y_scale);
cairo_surface_set_device_offset (surface, -ink_rect.x + clip_radius, -ink_rect.y + clip_radius);
cr = cairo_create (surface);
cairo_move_to (cr, 0, 0);
_gtk_pango_fill_layout (cr, layout);
- _gtk_cairo_blur_surface (surface, radius);
+ _gtk_cairo_blur_surface (surface, radius * x_scale);
cairo_destroy (cr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]