[gtk/wip/otte/no-clip-on-draw: 7/8] cairoblur: Get rid of gdk_cairo_get_clip_rectangle() call



commit 039f58e2ffb664e9f7670b0f11415b33d0cea47d
Author: Benjamin Otte <otte redhat com>
Date:   Thu Feb 13 02:48:19 2020 +0100

    cairoblur: Get rid of gdk_cairo_get_clip_rectangle() call
    
    It's about to be removed.

 gsk/gskcairoblur.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/gsk/gskcairoblur.c b/gsk/gskcairoblur.c
index fd83470f6a..6e9266c70d 100644
--- a/gsk/gskcairoblur.c
+++ b/gsk/gskcairoblur.c
@@ -303,7 +303,7 @@ gsk_cairo_blur_start_drawing (cairo_t         *cr,
                               float            radius,
                               GskBlurFlags     blur_flags)
 {
-  cairo_rectangle_int_t clip_rect;
+  double clip_x1, clip_x2, clip_y1, clip_y2, clip_width, clip_height;
   cairo_surface_t *surface;
   cairo_t *blur_cr;
   gdouble clip_radius;
@@ -314,7 +314,9 @@ gsk_cairo_blur_start_drawing (cairo_t         *cr,
   if (!needs_blur (radius, blur_flags))
     return cr;
 
-  gdk_cairo_get_clip_rectangle (cr, &clip_rect);
+  cairo_clip_extents (cr, &clip_x1, &clip_y1, &clip_x2, &clip_y2);
+  clip_width = clip_x2 - clip_x1;
+  clip_height = clip_y2 - clip_y1;
 
   clip_radius = gsk_cairo_blur_compute_pixels (radius);
 
@@ -324,20 +326,20 @@ gsk_cairo_blur_start_drawing (cairo_t         *cr,
   if (blur_flags & GSK_BLUR_REPEAT)
     {
       if (!blur_x)
-        clip_rect.width = 1;
+        clip_width = 1;
       if (!blur_y)
-        clip_rect.height = 1;
+        clip_height = 1;
     }
 
   /* Create a larger surface to center the blur. */
   surface = cairo_surface_create_similar_image (cairo_get_target (cr),
                                                 CAIRO_FORMAT_A8,
-                                                x_scale * (clip_rect.width + (blur_x ? 2 * clip_radius : 0)),
-                                                y_scale * (clip_rect.height + (blur_y ? 2 * clip_radius : 
0)));
+                                                x_scale * (clip_width + (blur_x ? 2 * clip_radius : 0)),
+                                                y_scale * (clip_height + (blur_y ? 2 * clip_radius : 0)));
   cairo_surface_set_device_scale (surface, x_scale, y_scale);
   cairo_surface_set_device_offset (surface,
-                                    x_scale * ((blur_x ? clip_radius : 0) - clip_rect.x),
-                                    y_scale * ((blur_y ? clip_radius : 0) - clip_rect.y));
+                                    x_scale * ((blur_x ? clip_radius : 0) - clip_x1),
+                                    y_scale * ((blur_y ? clip_radius : 0) - clip_y1));
 
   blur_cr = cairo_create (surface);
   cairo_set_user_data (blur_cr, &original_cr_key, cairo_reference (cr), (cairo_destroy_func_t) 
cairo_destroy);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]