mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 18:30:08 +00:00
cairoblur: Move the check for early exit
That means we only have one place where we check all kinds of early exits.
This commit is contained in:
parent
f0993fc881
commit
67610b1242
@ -281,8 +281,13 @@ gsk_cairo_blur_compute_pixels (double radius)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
needs_blur (float radius)
|
||||
needs_blur (float radius,
|
||||
GskBlurFlags blur_flags)
|
||||
{
|
||||
/* Neither blurring horizontal nor vertical means no blurring at all. */
|
||||
if ((blur_flags & (GSK_BLUR_X | GSK_BLUR_Y)) == 0)
|
||||
return FALSE;
|
||||
|
||||
/* The code doesn't actually do any blurring for radius 1, as it
|
||||
* ends up with box filter size 1 */
|
||||
if (radius <= 1.0)
|
||||
@ -306,7 +311,7 @@ gsk_cairo_blur_start_drawing (cairo_t *cr,
|
||||
gboolean blur_x = (blur_flags & GSK_BLUR_X) != 0;
|
||||
gboolean blur_y = (blur_flags & GSK_BLUR_Y) != 0;
|
||||
|
||||
if (!needs_blur (radius))
|
||||
if (!needs_blur (radius, blur_flags))
|
||||
return cr;
|
||||
|
||||
gdk_cairo_get_clip_rectangle (cr, &clip_rect);
|
||||
@ -372,7 +377,7 @@ gsk_cairo_blur_finish_drawing (cairo_t *cr,
|
||||
cairo_surface_t *surface;
|
||||
gdouble x_scale;
|
||||
|
||||
if (!needs_blur (radius))
|
||||
if (!needs_blur (radius, blur_flags))
|
||||
return cr;
|
||||
|
||||
original_cr = cairo_get_user_data (cr, &original_cr_key);
|
||||
|
@ -770,17 +770,12 @@ draw_shadow (cairo_t *cr,
|
||||
GskBlurFlags blur_flags)
|
||||
{
|
||||
cairo_t *shadow_cr;
|
||||
gboolean do_blur;
|
||||
|
||||
if (has_empty_clip (cr))
|
||||
return;
|
||||
|
||||
gdk_cairo_set_source_rgba (cr, color);
|
||||
do_blur = (blur_flags & (GSK_BLUR_X | GSK_BLUR_Y)) != 0;
|
||||
if (do_blur)
|
||||
shadow_cr = gsk_cairo_blur_start_drawing (cr, radius, blur_flags);
|
||||
else
|
||||
shadow_cr = cr;
|
||||
shadow_cr = gsk_cairo_blur_start_drawing (cr, radius, blur_flags);
|
||||
|
||||
cairo_set_fill_rule (shadow_cr, CAIRO_FILL_RULE_EVEN_ODD);
|
||||
gsk_rounded_rect_path (box, shadow_cr);
|
||||
@ -791,8 +786,7 @@ draw_shadow (cairo_t *cr,
|
||||
|
||||
cairo_fill (shadow_cr);
|
||||
|
||||
if (do_blur)
|
||||
gsk_cairo_blur_finish_drawing (shadow_cr, radius, color, blur_flags);
|
||||
gsk_cairo_blur_finish_drawing (shadow_cr, radius, color, blur_flags);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
Loading…
Reference in New Issue
Block a user