From 65ba8901aab50558b135042eab31adca356f5004 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 19 Sep 2012 22:29:11 +0200 Subject: [PATCH] blur: Simplify code It's always the same code, so there's no need for switch statements. --- gtk/gtkcairoblur.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/gtk/gtkcairoblur.c b/gtk/gtkcairoblur.c index 7748431ec3..8186fc362f 100644 --- a/gtk/gtkcairoblur.c +++ b/gtk/gtkcairoblur.c @@ -219,9 +219,6 @@ _gtk_cairo_blur_surface (cairo_surface_t* surface, double radius) { cairo_format_t format; - guchar* pixels; - guint width; - guint height; g_return_if_fail (surface != NULL); g_return_if_fail (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE); @@ -236,23 +233,13 @@ _gtk_cairo_blur_surface (cairo_surface_t* surface, /* Before we mess with the surface execute any pending drawing. */ cairo_surface_flush (surface); - pixels = cairo_image_surface_get_data (surface); - width = cairo_image_surface_get_width (surface); - height = cairo_image_surface_get_height (surface); - format = cairo_image_surface_get_format (surface); - - switch (format) - { - case CAIRO_FORMAT_ARGB32: - _expblur (pixels, width, height, 4, radius, 16, 7); - break; - case CAIRO_FORMAT_RGB24: - _expblur (pixels, width, height, 4, radius, 16, 7); - break; - default: - g_assert_not_reached (); - break; - } + _expblur (cairo_image_surface_get_data (surface), + cairo_image_surface_get_width (surface), + cairo_image_surface_get_height (surface), + 4, + radius, + 16, + 7); /* Inform cairo we altered the surfaces contents. */ cairo_surface_mark_dirty (surface);