[gtk+/rendering-cleanup: 8/141] style: Convert draw_shadow vfunc to Cairo version
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup: 8/141] style: Convert draw_shadow vfunc to Cairo version
- Date: Thu, 9 Sep 2010 16:24:00 +0000 (UTC)
commit 49b87765de9ef8bc77b3689d6a9640e42ca0bdab
Author: Benjamin Otte <otte redhat com>
Date: Mon Aug 16 15:48:06 2010 +0200
style: Convert draw_shadow vfunc to Cairo version
gtk/gtkstyle.c | 339 +++++++++++++++++++++++-----------
gtk/gtkstyle.h | 146 +++++++++------
modules/engines/pixbuf/pixbuf-draw.c | 46 ++---
3 files changed, 340 insertions(+), 191 deletions(-)
---
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 67df02f..79651c3 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -117,10 +117,9 @@ static void gtk_default_draw_vline (GtkStyle *style,
gint y2,
gint x);
static void gtk_default_draw_shadow (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
GtkShadowType shadow_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x,
@@ -128,10 +127,9 @@ static void gtk_default_draw_shadow (GtkStyle *style,
gint width,
gint height);
static void gtk_default_draw_arrow (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
GtkShadowType shadow_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
GtkArrowType arrow_type,
@@ -141,10 +139,9 @@ static void gtk_default_draw_arrow (GtkStyle *style,
gint width,
gint height);
static void gtk_default_draw_diamond (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
GtkShadowType shadow_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x,
@@ -152,10 +149,9 @@ static void gtk_default_draw_diamond (GtkStyle *style,
gint width,
gint height);
static void gtk_default_draw_box (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
GtkShadowType shadow_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x,
@@ -1725,7 +1721,6 @@ static void
draw_thin_shadow (GtkStyle *style,
cairo_t *cr,
GtkStateType state,
- GdkRectangle *area,
gint x,
gint y,
gint width,
@@ -1752,7 +1747,6 @@ draw_spinbutton_shadow (GtkStyle *style,
cairo_t *cr,
GtkStateType state,
GtkTextDirection direction,
- GdkRectangle *area,
gint x,
gint y,
gint width,
@@ -1799,7 +1793,6 @@ static void
draw_menu_shadow (GtkStyle *style,
cairo_t *cr,
GtkStateType state,
- GdkRectangle *area,
gint x,
gint y,
gint width,
@@ -1873,10 +1866,9 @@ get_direction (GtkWidget *widget)
static void
gtk_default_draw_shadow (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
GtkShadowType shadow_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x,
@@ -1884,24 +1876,14 @@ gtk_default_draw_shadow (GtkStyle *style,
gint width,
gint height)
{
- cairo_t *cr;
GdkColor *gc1 = NULL;
GdkColor *gc2 = NULL;
gint thickness_light;
gint thickness_dark;
gint i;
- sanitize_size (window, &width, &height);
-
- cr = gdk_cairo_create (window);
cairo_set_line_width (cr, 1.0);
- if (area)
- {
- gdk_cairo_rectangle (cr, area);
- cairo_clip (cr);
- }
-
if (shadow_type == GTK_SHADOW_IN)
{
if (detail && strcmp (detail, "buttondefault") == 0)
@@ -1909,39 +1891,34 @@ gtk_default_draw_shadow (GtkStyle *style,
_cairo_draw_rectangle (cr, &style->black, FALSE,
x, y, width - 1, height - 1);
- cairo_destroy (cr);
return;
}
if (detail && strcmp (detail, "trough") == 0)
{
- draw_thin_shadow (style, cr, state_type, area,
+ draw_thin_shadow (style, cr, state_type,
x, y, width, height);
- cairo_destroy (cr);
return;
}
if (GTK_IS_SPIN_BUTTON (widget) &&
detail && strcmp (detail, "spinbutton") == 0)
{
draw_spinbutton_shadow (style, cr, state_type,
- get_direction (widget), area, x, y, width, height);
+ get_direction (widget), x, y, width, height);
- cairo_destroy (cr);
return;
}
}
if (shadow_type == GTK_SHADOW_OUT && detail && strcmp (detail, "menu") == 0)
{
- draw_menu_shadow (style, cr, state_type, area, x, y, width, height);
- cairo_destroy (cr);
+ draw_menu_shadow (style, cr, state_type, x, y, width, height);
return;
}
switch (shadow_type)
{
case GTK_SHADOW_NONE:
- cairo_destroy (cr);
return;
case GTK_SHADOW_IN:
case GTK_SHADOW_ETCHED_IN:
@@ -2192,9 +2169,6 @@ gtk_default_draw_shadow (GtkStyle *style,
x, y + height - 1);
}
}
-
-
- cairo_destroy (cr);
}
static void
@@ -2311,10 +2285,9 @@ calculate_arrow_geometry (GtkArrowType arrow_type,
static void
gtk_default_draw_arrow (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state,
GtkShadowType shadow,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
GtkArrowType arrow_type,
@@ -2324,38 +2297,23 @@ gtk_default_draw_arrow (GtkStyle *style,
gint width,
gint height)
{
- cairo_t *cr;
-
- sanitize_size (window, &width, &height);
-
calculate_arrow_geometry (arrow_type, &x, &y, &width, &height);
if (detail && strcmp (detail, "menu_scroll_arrow_up") == 0)
y++;
- cr = gdk_cairo_create (window);
-
- if (area)
- {
- gdk_cairo_rectangle (cr, area);
- cairo_clip (cr);
- }
-
if (state == GTK_STATE_INSENSITIVE)
draw_arrow (cr, &style->white, arrow_type,
x + 1, y + 1, width, height);
draw_arrow (cr, &style->fg[state], arrow_type,
x, y, width, height);
-
- cairo_destroy (cr);
}
static void
gtk_default_draw_diamond (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
GtkShadowType shadow_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x,
@@ -2377,9 +2335,6 @@ gtk_default_draw_diamond (GtkStyle *style,
GdkColor *inner_ne = NULL;
GdkColor *inner_sw = NULL;
GdkColor *inner_se = NULL;
- cairo_t *cr;
-
- sanitize_size (window, &width, &height);
half_width = width / 2;
half_height = height / 2;
@@ -2427,13 +2382,6 @@ gtk_default_draw_diamond (GtkStyle *style,
break;
}
- cr = gdk_cairo_create (window);
- if (area)
- {
- gdk_cairo_rectangle (cr, area);
- cairo_clip (cr);
- }
-
if (inner_sw)
{
_cairo_draw_line (cr, inner_sw,
@@ -2474,8 +2422,6 @@ gtk_default_draw_diamond (GtkStyle *style,
x + half_width, y,
x + width, y + half_height);
}
-
- cairo_destroy (cr);
}
static void
@@ -2505,10 +2451,9 @@ option_menu_get_props (GtkWidget *widget,
static void
gtk_default_draw_box (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
GtkShadowType shadow_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x,
@@ -2516,11 +2461,8 @@ gtk_default_draw_box (GtkStyle *style,
gint width,
gint height)
{
- cairo_t *cr;
gboolean is_spinbutton_box = FALSE;
- sanitize_size (window, &width, &height);
-
if (GTK_IS_SPIN_BUTTON (widget) && detail)
{
if (strcmp (detail, "spinbutton_up") == 0)
@@ -2550,16 +2492,7 @@ gtk_default_draw_box (GtkStyle *style,
}
}
- cr = gdk_cairo_create (window);
-
- if (area)
- {
- gdk_cairo_rectangle (cr, area);
- cairo_clip (cr);
- }
-
- if (!style->bg_pixmap[state_type] ||
- GDK_IS_PIXMAP (window))
+ if (!style->bg_pixmap[state_type])
{
GdkColor *gc = &style->bg[state_type];
@@ -2573,7 +2506,7 @@ gtk_default_draw_box (GtkStyle *style,
x, y, width, height);
}
else
- gtk_style_apply_default_background (style, cr, window,
+ gtk_style_apply_default_background (style, cr, gtk_widget_get_window (widget),
state_type, x, y, width, height);
@@ -2588,23 +2521,14 @@ gtk_default_draw_box (GtkStyle *style,
else
upper = &style->dark[state_type];
- if (area)
- {
- gdk_cairo_rectangle (cr, area);
- cairo_clip (cr);
- }
-
_cairo_draw_line (cr, upper, x, y, x + width - 1, y);
_cairo_draw_line (cr, lower, x, y + height - 1, x + width - 1, y + height - 1);
- cairo_destroy (cr);
return;
}
- cairo_destroy (cr);
-
- gtk_paint_shadow (style, window, state_type, shadow_type, area, widget, detail,
- x, y, width, height);
+ gtk_cairo_paint_shadow (style, cr, state_type, shadow_type, widget, detail,
+ x, y, width, height);
if (detail && strcmp (detail, "optionmenu") == 0)
{
@@ -2614,18 +2538,16 @@ gtk_default_draw_box (GtkStyle *style,
option_menu_get_props (widget, &indicator_size, &indicator_spacing);
- sanitize_size (window, &width, &height);
-
if (get_direction (widget) == GTK_TEXT_DIR_RTL)
vline_x = x + indicator_size.width + indicator_spacing.left + indicator_spacing.right;
else
vline_x = x + width - (indicator_size.width + indicator_spacing.left + indicator_spacing.right) - style->xthickness;
- gtk_paint_vline (style, window, state_type, area, widget,
- detail,
- y + style->ythickness + 1,
- y + height - style->ythickness - 3,
- vline_x);
+ gtk_cairo_paint_vline (style, cr, state_type, widget,
+ detail,
+ y + style->ythickness + 1,
+ y + height - style->ythickness - 3,
+ vline_x);
}
}
@@ -4961,13 +4883,64 @@ gtk_paint_shadow (GtkStyle *style,
gint width,
gint height)
{
+ cairo_t *cr;
+
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
- GTK_STYLE_GET_CLASS (style)->draw_shadow (style, window, state_type, shadow_type,
- (GdkRectangle *) area, widget, detail,
+ sanitize_size (window, &width, &height);
+
+ cr = gtk_style_cairo_create (window, area);
+
+ gtk_cairo_paint_shadow (style, cr, state_type, shadow_type,
+ widget, detail,
+ x, y, width, height);
+
+ cairo_destroy (cr);
+}
+
+/**
+ * gtk_cairo_paint_shadow:
+ * @style: a #GtkStyle
+ * @cr: a #cairo_t
+ * @state_type: a state
+ * @shadow_type: type of shadow to draw
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
+ * @x: x origin of the rectangle
+ * @y: y origin of the rectangle
+ * @width: width of the rectangle
+ * @height: width of the rectangle
+ *
+ * Draws a shadow around the given rectangle in @cr
+ * using the given style and state and shadow type.
+ */
+void
+gtk_cairo_paint_shadow (GtkStyle *style,
+ cairo_t *cr,
+ GtkStateType state_type,
+ GtkShadowType shadow_type,
+ GtkWidget *widget,
+ const gchar *detail,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ g_return_if_fail (GTK_IS_STYLE (style));
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
+ g_return_if_fail (cr != NULL);
+ g_return_if_fail (width >= 0);
+ g_return_if_fail (height >= 0);
+
+ cairo_save (cr);
+
+ GTK_STYLE_GET_CLASS (style)->draw_shadow (style, cr, state_type, shadow_type,
+ widget, detail,
x, y, width, height);
+
+ cairo_restore (cr);
}
/**
@@ -5005,13 +4978,68 @@ gtk_paint_arrow (GtkStyle *style,
gint width,
gint height)
{
+ cairo_t *cr;
+
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
- GTK_STYLE_GET_CLASS (style)->draw_arrow (style, window, state_type, shadow_type,
- (GdkRectangle *) area, widget, detail,
+ sanitize_size (window, &width, &height);
+
+ cr = gtk_style_cairo_create (window, area);
+
+ gtk_cairo_paint_arrow (style, cr, state_type, shadow_type,
+ widget, detail,
+ arrow_type, fill, x, y, width, height);
+
+ cairo_destroy (cr);
+}
+
+/**
+ * gtk_cairo_paint_arrow:
+ * @style: a #GtkStyle
+ * @cr: a #cairo_t
+ * @state_type: a state
+ * @shadow_type: the type of shadow to draw
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
+ * @arrow_type: the type of arrow to draw
+ * @fill: %TRUE if the arrow tip should be filled
+ * @x: x origin of the rectangle to draw the arrow in
+ * @y: y origin of the rectangle to draw the arrow in
+ * @width: width of the rectangle to draw the arrow in
+ * @height: height of the rectangle to draw the arrow in
+ *
+ * Draws an arrow in the given rectangle on @cr using the given
+ * parameters. @arrow_type determines the direction of the arrow.
+ */
+void
+gtk_cairo_paint_arrow (GtkStyle *style,
+ cairo_t *cr,
+ GtkStateType state_type,
+ GtkShadowType shadow_type,
+ GtkWidget *widget,
+ const gchar *detail,
+ GtkArrowType arrow_type,
+ gboolean fill,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ g_return_if_fail (GTK_IS_STYLE (style));
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL);
+ g_return_if_fail (cr != NULL);
+ g_return_if_fail (width >= 0);
+ g_return_if_fail (height >= 0);
+
+ cairo_save (cr);
+
+ GTK_STYLE_GET_CLASS (style)->draw_arrow (style, cr, state_type, shadow_type,
+ widget, detail,
arrow_type, fill, x, y, width, height);
+
+ cairo_restore (cr);
}
/**
@@ -5045,13 +5073,64 @@ gtk_paint_diamond (GtkStyle *style,
gint width,
gint height)
{
+ cairo_t *cr;
+
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
- GTK_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type,
- (GdkRectangle *) area, widget, detail,
+ sanitize_size (window, &width, &height);
+
+ cr = gtk_style_cairo_create (window, area);
+
+ gtk_cairo_paint_diamond (style, cr, state_type, shadow_type,
+ widget, detail,
+ x, y, width, height);
+
+ cairo_destroy (cr);
+}
+
+/**
+ * gtk_cairo_paint_diamond:
+ * @style: a #GtkStyle
+ * @cr: a #cairo_t
+ * @state_type: a state
+ * @shadow_type: the type of shadow to draw
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
+ * @x: x origin of the rectangle to draw the diamond in
+ * @y: y origin of the rectangle to draw the diamond in
+ * @width: width of the rectangle to draw the diamond in
+ * @height: height of the rectangle to draw the diamond in
+ *
+ * Draws a diamond in the given rectangle on @window using the given
+ * parameters.
+ */
+void
+gtk_cairo_paint_diamond (GtkStyle *style,
+ cairo_t *cr,
+ GtkStateType state_type,
+ GtkShadowType shadow_type,
+ GtkWidget *widget,
+ const gchar *detail,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ g_return_if_fail (GTK_IS_STYLE (style));
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL);
+ g_return_if_fail (cr != NULL);
+ g_return_if_fail (width >= 0);
+ g_return_if_fail (height >= 0);
+
+ cairo_save (cr);
+
+ GTK_STYLE_GET_CLASS (style)->draw_diamond (style, cr, state_type, shadow_type,
+ widget, detail,
x, y, width, height);
+
+ cairo_restore (cr);
}
/**
@@ -5084,13 +5163,61 @@ gtk_paint_box (GtkStyle *style,
gint width,
gint height)
{
+ cairo_t *cr;
+
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
- GTK_STYLE_GET_CLASS (style)->draw_box (style, window, state_type, shadow_type,
- (GdkRectangle *) area, widget, detail,
+ sanitize_size (window, &width, &height);
+
+ cr = gtk_style_cairo_create (window, area);
+
+ gtk_cairo_paint_box (style, cr, state_type, shadow_type,
+ widget, detail,
+ x, y, width, height);
+
+ cairo_destroy (cr);
+}
+
+/**
+ * gtk_cairo_paint_box:
+ * @style: a #GtkStyle
+ * @cr: a #cairo_t
+ * @state_type: a state
+ * @shadow_type: the type of shadow to draw
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
+ * @x: x origin of the box
+ * @y: y origin of the box
+ * @width: the width of the box
+ * @height: the height of the box
+ *
+ * Draws a box on @cr with the given parameters.
+ */
+void
+gtk_cairo_paint_box (GtkStyle *style,
+ cairo_t *cr,
+ GtkStateType state_type,
+ GtkShadowType shadow_type,
+ GtkWidget *widget,
+ const gchar *detail,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ g_return_if_fail (GTK_IS_STYLE (style));
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL);
+ g_return_if_fail (cr != NULL);
+
+ cairo_save (cr);
+
+ GTK_STYLE_GET_CLASS (style)->draw_box (style, cr, state_type, shadow_type,
+ widget, detail,
x, y, width, height);
+
+ cairo_restore (cr);
}
/**
diff --git a/gtk/gtkstyle.h b/gtk/gtkstyle.h
index d26b012..daf721c 100644
--- a/gtk/gtkstyle.h
+++ b/gtk/gtkstyle.h
@@ -182,10 +182,9 @@ struct _GtkStyleClass
gint y2_,
gint x);
void (*draw_shadow) (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
GtkShadowType shadow_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x,
@@ -193,10 +192,9 @@ struct _GtkStyleClass
gint width,
gint height);
void (*draw_arrow) (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
GtkShadowType shadow_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
GtkArrowType arrow_type,
@@ -206,10 +204,9 @@ struct _GtkStyleClass
gint width,
gint height);
void (*draw_diamond) (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
GtkShadowType shadow_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x,
@@ -217,10 +214,9 @@ struct _GtkStyleClass
gint width,
gint height);
void (*draw_box) (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
GtkShadowType shadow_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x,
@@ -486,52 +482,94 @@ void gtk_cairo_paint_vline (GtkStyle *style,
gint y1_,
gint y2_,
gint x);
-void gtk_paint_shadow (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- const GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-void gtk_paint_arrow (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- const GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- GtkArrowType arrow_type,
- gboolean fill,
- gint x,
- gint y,
- gint width,
- gint height);
-void gtk_paint_diamond (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- const GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
-void gtk_paint_box (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- const GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height);
+void gtk_paint_shadow (GtkStyle *style,
+ GdkWindow *window,
+ GtkStateType state_type,
+ GtkShadowType shadow_type,
+ const GdkRectangle *area,
+ GtkWidget *widget,
+ const gchar *detail,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+void gtk_cairo_paint_shadow (GtkStyle *style,
+ cairo_t *cr,
+ GtkStateType state_type,
+ GtkShadowType shadow_type,
+ GtkWidget *widget,
+ const gchar *detail,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+void gtk_paint_arrow (GtkStyle *style,
+ GdkWindow *window,
+ GtkStateType state_type,
+ GtkShadowType shadow_type,
+ const GdkRectangle *area,
+ GtkWidget *widget,
+ const gchar *detail,
+ GtkArrowType arrow_type,
+ gboolean fill,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+void gtk_cairo_paint_arrow (GtkStyle *style,
+ cairo_t *cr,
+ GtkStateType state_type,
+ GtkShadowType shadow_type,
+ GtkWidget *widget,
+ const gchar *detail,
+ GtkArrowType arrow_type,
+ gboolean fill,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+void gtk_paint_diamond (GtkStyle *style,
+ GdkWindow *window,
+ GtkStateType state_type,
+ GtkShadowType shadow_type,
+ const GdkRectangle *area,
+ GtkWidget *widget,
+ const gchar *detail,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+void gtk_cairo_paint_diamond (GtkStyle *style,
+ cairo_t *cr,
+ GtkStateType state_type,
+ GtkShadowType shadow_type,
+ GtkWidget *widget,
+ const gchar *detail,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+void gtk_paint_box (GtkStyle *style,
+ GdkWindow *window,
+ GtkStateType state_type,
+ GtkShadowType shadow_type,
+ const GdkRectangle *area,
+ GtkWidget *widget,
+ const gchar *detail,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+void gtk_cairo_paint_box (GtkStyle *style,
+ cairo_t *cr,
+ GtkStateType state_type,
+ GtkShadowType shadow_type,
+ GtkWidget *widget,
+ const gchar *detail,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
void gtk_paint_flat_box (GtkStyle *style,
GdkWindow *window,
GtkStateType state_type,
diff --git a/modules/engines/pixbuf/pixbuf-draw.c b/modules/engines/pixbuf/pixbuf-draw.c
index 6393820..ca16b6b 100644
--- a/modules/engines/pixbuf/pixbuf-draw.c
+++ b/modules/engines/pixbuf/pixbuf-draw.c
@@ -452,10 +452,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,
@@ -465,18 +464,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);
}
@@ -526,10 +522,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,
@@ -541,9 +536,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))
{
@@ -574,7 +566,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 */
@@ -589,9 +581,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);
}
@@ -605,18 +597,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,
@@ -626,27 +617,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,
@@ -656,9 +643,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))
{
@@ -672,9 +656,9 @@ 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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]