diff options
author | Alexander Larsson <alexl@redhat.com> | 2015-03-20 14:31:57 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2015-03-21 21:07:26 +0100 |
commit | 9c2a16fb3be9bfe1a4e0e30bc7aa6de298541867 (patch) | |
tree | 36473d803243ca361d237c5a2f18e7773dea2ebc /gtk/gtkcairoblur.c | |
parent | d0dc1f52cc41a6c5a881123056e97cf4dfbebea4 (diff) | |
download | gtk+-9c2a16fb3be9bfe1a4e0e30bc7aa6de298541867.tar.gz |
shadow-box: Bail out blur early if radius is 1px
For radius 1px the current implementation rounds down to a 1 px box
filter which is a no-op. Rather than creating useless shadow masks
in this case we bail out blurring early.
Another alternative would be to make radius 1px round up to a 2 px box
filter, but that would change the rendering of Adwaita which is probably
not a great idea this late in the cycle.
https://bugzilla.gnome.org/show_bug.cgi?id=746468
Diffstat (limited to 'gtk/gtkcairoblur.c')
-rw-r--r-- | gtk/gtkcairoblur.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gtk/gtkcairoblur.c b/gtk/gtkcairoblur.c index 170f460bf2..8d67c8c04b 100644 --- a/gtk/gtkcairoblur.c +++ b/gtk/gtkcairoblur.c @@ -215,7 +215,9 @@ _gtk_cairo_blur_surface (cairo_surface_t* surface, g_return_if_fail (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE); g_return_if_fail (cairo_image_surface_get_format (surface) == CAIRO_FORMAT_A8); - if (radius == 0) + /* The code doesn't actually do any blurring for radius 1, as it + * ends up with box filter size 1 */ + if (radius <= 1) return; /* Before we mess with the surface, execute any pending drawing. */ |