[goffice] Simplify goc_item_draw.



commit 569f1ba28c10469ba6376b619d725c29ac90d802
Author: Jean Brefort <jean brefort normalesup org>
Date:   Mon Mar 25 21:34:46 2013 +0100

    Simplify goc_item_draw.

 ChangeLog                 |    5 +++++
 goffice/canvas/goc-item.c |   15 ++++-----------
 2 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 70b47bb..7414ca0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-25  Jean Brefort  <jean brefort normalesup org>
+
+       * goffice/canvas/goc-item.c (goc_item_draw),
+       (goc_item_draw_region): simplify.
+
 2013-03-25  Morten Welinder  <terra gnome org>
 
        * goffice/canvas/goc-item.c (goc_item_get_style_context): Avoid
diff --git a/goffice/canvas/goc-item.c b/goffice/canvas/goc-item.c
index d480bad..24ae44c 100644
--- a/goffice/canvas/goc-item.c
+++ b/goffice/canvas/goc-item.c
@@ -415,11 +415,7 @@ goc_item_draw (GocItem const *item, cairo_t *cr)
        GocItemClass *klass = GOC_ITEM_GET_CLASS (item);
        g_return_if_fail (klass != NULL);
 
-       if (klass->draw == NULL)
-               return;
-       if (GOC_IS_GROUP (item))
-               klass->draw (item, cr);
-       else
+       if (klass->draw != NULL)
                klass->draw (item, cr);
 }
 
@@ -446,12 +442,9 @@ goc_item_draw_region (GocItem const *item, cairo_t *cr,
        GocItemClass *klass = GOC_ITEM_GET_CLASS (item);
        g_return_val_if_fail (klass != NULL, FALSE);
 
-       if (klass->draw_region == NULL)
-               return FALSE;
-       if (GOC_IS_GROUP (item))
-               return klass->draw_region (item, cr, x0, y0, x1, y1);
-       else
-               return klass->draw_region (item, cr, x0, y0, x1, y1);
+       return (klass->draw_region != NULL)?
+               klass->draw_region (item, cr, x0, y0, x1, y1):
+               FALSE;
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]