[gtk+] blur: Simplify code
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] blur: Simplify code
- Date: Thu, 20 Sep 2012 00:47:02 +0000 (UTC)
commit 65ba8901aab50558b135042eab31adca356f5004
Author: Benjamin Otte <otte redhat com>
Date: Wed Sep 19 22:29:11 2012 +0200
blur: Simplify code
It's always the same code, so there's no need for switch statements.
gtk/gtkcairoblur.c | 27 +++++++--------------------
1 files changed, 7 insertions(+), 20 deletions(-)
---
diff --git a/gtk/gtkcairoblur.c b/gtk/gtkcairoblur.c
index 7748431..8186fc3 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]