mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-12 20:00:09 +00:00
cairoblur: Get rid of gdk_cairo_get_clip_rectangle() call
It's about to be removed.
This commit is contained in:
parent
6203cecf97
commit
8f6cab6560
@ -303,7 +303,7 @@ gsk_cairo_blur_start_drawing (cairo_t *cr,
|
|||||||
float radius,
|
float radius,
|
||||||
GskBlurFlags blur_flags)
|
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_surface_t *surface;
|
||||||
cairo_t *blur_cr;
|
cairo_t *blur_cr;
|
||||||
gdouble clip_radius;
|
gdouble clip_radius;
|
||||||
@ -314,7 +314,9 @@ gsk_cairo_blur_start_drawing (cairo_t *cr,
|
|||||||
if (!needs_blur (radius, blur_flags))
|
if (!needs_blur (radius, blur_flags))
|
||||||
return cr;
|
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);
|
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_flags & GSK_BLUR_REPEAT)
|
||||||
{
|
{
|
||||||
if (!blur_x)
|
if (!blur_x)
|
||||||
clip_rect.width = 1;
|
clip_width = 1;
|
||||||
if (!blur_y)
|
if (!blur_y)
|
||||||
clip_rect.height = 1;
|
clip_height = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a larger surface to center the blur. */
|
/* Create a larger surface to center the blur. */
|
||||||
surface = cairo_surface_create_similar_image (cairo_get_target (cr),
|
surface = cairo_surface_create_similar_image (cairo_get_target (cr),
|
||||||
CAIRO_FORMAT_A8,
|
CAIRO_FORMAT_A8,
|
||||||
x_scale * (clip_rect.width + (blur_x ? 2 * clip_radius : 0)),
|
x_scale * (clip_width + (blur_x ? 2 * clip_radius : 0)),
|
||||||
y_scale * (clip_rect.height + (blur_y ? 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_scale (surface, x_scale, y_scale);
|
||||||
cairo_surface_set_device_offset (surface,
|
cairo_surface_set_device_offset (surface,
|
||||||
x_scale * ((blur_x ? clip_radius : 0) - clip_rect.x),
|
x_scale * ((blur_x ? clip_radius : 0) - clip_x1),
|
||||||
y_scale * ((blur_y ? clip_radius : 0) - clip_rect.y));
|
y_scale * ((blur_y ? clip_radius : 0) - clip_y1));
|
||||||
|
|
||||||
blur_cr = cairo_create (surface);
|
blur_cr = cairo_create (surface);
|
||||||
cairo_set_user_data (blur_cr, &original_cr_key, cairo_reference (cr), (cairo_destroy_func_t) cairo_destroy);
|
cairo_set_user_data (blur_cr, &original_cr_key, cairo_reference (cr), (cairo_destroy_func_t) cairo_destroy);
|
||||||
|
Loading…
Reference in New Issue
Block a user