]> Pileus Git - ~andy/gtk/blobdiff - modules/engines/pixbuf/pixbuf-draw.c
style: Convert draw_option vfunc to Cairo version
[~andy/gtk] / modules / engines / pixbuf / pixbuf-draw.c
index f1f3c5b9b48125c06372116cecc62b5b0b0b557e..8e6bc84b68383bef16c0eb51830538d79c2a27b1 100644 (file)
@@ -450,10 +450,9 @@ draw_vline (GtkStyle     *style,
 
 static void
 draw_shadow(GtkStyle     *style,
-           GdkWindow    *window,
+           cairo_t      *cr,
            GtkStateType  state,
            GtkShadowType shadow,
-           GdkRectangle *area,
            GtkWidget    *widget,
            const gchar  *detail,
            gint          x,
@@ -463,18 +462,15 @@ draw_shadow(GtkStyle     *style,
 {
   ThemeMatchData match_data;
   
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
   match_data.function = TOKEN_D_SHADOW;
   match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
 
-  if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, FALSE, FALSE,
+  if (!draw_simple_image (style, cr, widget, &match_data, FALSE, FALSE,
                          x, y, width, height))
-    parent_class->draw_shadow (style, window, state, shadow, area, widget, detail,
+    parent_class->draw_shadow (style, cr, state, shadow, widget, detail,
                               x, y, width, height);
 }
 
@@ -524,10 +520,9 @@ reverse_engineer_stepper_box (GtkWidget    *range,
 
 static void
 draw_arrow (GtkStyle     *style,
-           GdkWindow    *window,
+           cairo_t      *cr,
            GtkStateType  state,
            GtkShadowType shadow,
-           GdkRectangle *area,
            GtkWidget    *widget,
            const gchar  *detail,
            GtkArrowType  arrow_direction,
@@ -539,9 +534,6 @@ draw_arrow (GtkStyle     *style,
 {
   ThemeMatchData match_data;
   
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
   if (detail &&
       (strcmp (detail, "hscrollbar") == 0 || strcmp (detail, "vscrollbar") == 0))
     {
@@ -572,7 +564,7 @@ draw_arrow (GtkStyle     *style,
       match_data.state = state;
       match_data.arrow_direction = arrow_direction;
       
-      if (draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+      if (draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
                             box_x, box_y, box_width, box_height))
        {
          /* The theme included stepper images, we're done */
@@ -587,9 +579,9 @@ draw_arrow (GtkStyle     *style,
       match_data.shadow = shadow;
       match_data.state = state;
       
-      if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+      if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
                              box_x, box_y, box_width, box_height))
-       parent_class->draw_box (style, window, state, shadow, area, widget, detail,
+       parent_class->draw_box (style, cr, state, shadow, widget, detail,
                                box_x, box_y, box_width, box_height);
     }
 
@@ -603,18 +595,17 @@ draw_arrow (GtkStyle     *style,
   match_data.state = state;
   match_data.arrow_direction = arrow_direction;
   
-  if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+  if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
                          x, y, width, height))
-    parent_class->draw_arrow (style, window, state, shadow, area, widget, detail,
+    parent_class->draw_arrow (style, cr, state, shadow, widget, detail,
                              arrow_direction, fill, x, y, width, height);
 }
 
 static void
 draw_diamond (GtkStyle     *style,
-             GdkWindow    *window,
+             cairo_t      *cr,
              GtkStateType  state,
              GtkShadowType shadow,
-             GdkRectangle *area,
              GtkWidget    *widget,
              const gchar  *detail,
              gint          x,
@@ -624,27 +615,23 @@ draw_diamond (GtkStyle     *style,
 {
   ThemeMatchData match_data;
   
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
   match_data.function = TOKEN_D_DIAMOND;
   match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
   
-  if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+  if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
                          x, y, width, height))
-    parent_class->draw_diamond (style, window, state, shadow, area, widget, detail,
+    parent_class->draw_diamond (style, cr, state, shadow, widget, detail,
                                x, y, width, height);
 }
 
 static void
 draw_box (GtkStyle     *style,
-         GdkWindow    *window,
+         cairo_t      *cr,
          GtkStateType  state,
          GtkShadowType shadow,
-         GdkRectangle *area,
          GtkWidget    *widget,
          const gchar  *detail,
          gint          x,
@@ -654,9 +641,6 @@ draw_box (GtkStyle     *style,
 {
   ThemeMatchData match_data;
 
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
   if (detail &&
       (strcmp (detail, "hscrollbar") == 0 || strcmp (detail, "vscrollbar") == 0))
     {
@@ -670,19 +654,18 @@ draw_box (GtkStyle     *style,
   match_data.shadow = shadow;
   match_data.state = state;
 
-  if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+  if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
                          x, y, width, height)) {
-    parent_class->draw_box (style, window, state, shadow, area, widget, detail,
+    parent_class->draw_box (style, cr, state, shadow, widget, detail,
                            x, y, width, height);
   }
 }
 
 static void
 draw_flat_box (GtkStyle     *style,
-              GdkWindow    *window,
+              cairo_t      *cr,
               GtkStateType  state,
               GtkShadowType shadow,
-              GdkRectangle *area,
               GtkWidget    *widget,
               const gchar  *detail,
               gint          x,
@@ -692,27 +675,23 @@ draw_flat_box (GtkStyle     *style,
 {
   ThemeMatchData match_data;
   
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
   match_data.function = TOKEN_D_FLAT_BOX;
   match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
 
-  if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+  if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
                          x, y, width, height))
-    parent_class->draw_flat_box (style, window, state, shadow, area, widget, detail,
+    parent_class->draw_flat_box (style, cr, state, shadow, widget, detail,
                                 x, y, width, height);
 }
 
 static void
 draw_check (GtkStyle     *style,
-           GdkWindow    *window,
+           cairo_t      *cr,
            GtkStateType  state,
            GtkShadowType shadow,
-           GdkRectangle *area,
            GtkWidget    *widget,
            const gchar  *detail,
            gint          x,
@@ -722,27 +701,23 @@ draw_check (GtkStyle     *style,
 {
   ThemeMatchData match_data;
   
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
   match_data.function = TOKEN_D_CHECK;
   match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
   
-  if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+  if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
                          x, y, width, height))
-    parent_class->draw_check (style, window, state, shadow, area, widget, detail,
+    parent_class->draw_check (style, cr, state, shadow, widget, detail,
                              x, y, width, height);
 }
 
 static void
-draw_option (GtkStyle      *style,
-            GdkWindow     *window,
+draw_option (GtkStyle     *style,
+            cairo_t      *cr,
             GtkStateType  state,
             GtkShadowType shadow,
-            GdkRectangle *area,
             GtkWidget    *widget,
             const gchar  *detail,
             gint          x,
@@ -752,18 +727,15 @@ draw_option (GtkStyle      *style,
 {
   ThemeMatchData match_data;
   
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
   match_data.function = TOKEN_D_OPTION;
   match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
   
-  if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+  if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
                          x, y, width, height))
-    parent_class->draw_option (style, window, state, shadow, area, widget, detail,
+    parent_class->draw_option (style, cr, state, shadow, widget, detail,
                               x, y, width, height);
 }