summaryrefslogtreecommitdiff
path: root/gtk/gtkstyle.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-08-16 15:13:26 +0200
committerBenjamin Otte <otte@redhat.com>2010-09-26 15:02:59 +0200
commit81f15cf908efd7875051723d2618887c14720ce9 (patch)
tree2dd59cefec7fff03ef2c89fa43b2a29dbdd17ca1 /gtk/gtkstyle.c
parentd80e2897b95e7a3a7d7ecb92177209a6d5a3fe5b (diff)
downloadgtk+-81f15cf908efd7875051723d2618887c14720ce9.tar.gz
style: Convert draw_resize_grip vfunc to Cairo version
Includes removal of now unused draw_simple_image_no_cairo() function from pixbuf engine.
Diffstat (limited to 'gtk/gtkstyle.c')
-rw-r--r--gtk/gtkstyle.c64
1 files changed, 49 insertions, 15 deletions
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 5728e35c62..87fb398987 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -284,9 +284,8 @@ static void gtk_default_draw_layout (GtkStyle *style,
gint y,
PangoLayout *layout);
static void gtk_default_draw_resize_grip (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
GdkWindowEdge edge,
@@ -3978,9 +3977,8 @@ gtk_default_draw_layout (GtkStyle *style,
static void
gtk_default_draw_resize_grip (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
GdkWindowEdge edge,
@@ -3990,16 +3988,9 @@ gtk_default_draw_resize_grip (GtkStyle *style,
gint height)
{
gint skip;
- cairo_t *cr;
- cr = gdk_cairo_create (window);
cairo_rectangle (cr, x, y, width, height);
cairo_clip (cr);
- if (area)
- {
- gdk_cairo_rectangle (cr, area);
- cairo_clip (cr);
- }
cairo_set_line_width (cr, 1.0);
@@ -4274,8 +4265,6 @@ gtk_default_draw_resize_grip (GtkStyle *style,
g_assert_not_reached ();
break;
}
-
- cairo_destroy (cr);
}
static void
@@ -6224,13 +6213,58 @@ gtk_paint_resize_grip (GtkStyle *style,
gint height)
{
+ cairo_t *cr;
+
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_resize_grip != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
- GTK_STYLE_GET_CLASS (style)->draw_resize_grip (style, window, state_type,
- (GdkRectangle *) area, widget, detail,
+ cr = gtk_style_cairo_create (window, area);
+
+ GTK_STYLE_GET_CLASS (style)->draw_resize_grip (style, cr, state_type,
+ widget, detail,
edge, x, y, width, height);
+ cairo_destroy (cr);
+}
+
+/**
+ * gtk_cairo_paint_resize_grip:
+ * @style: a #GtkStyle
+ * @cr: a #cairo_t
+ * @state_type: a state
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
+ * @edge: the edge in which to draw the resize grip
+ * @x: the x origin of the rectangle in which to draw the resize grip
+ * @y: the y origin of the rectangle in which to draw the resize grip
+ * @width: the width of the rectangle in which to draw the resize grip
+ * @height: the height of the rectangle in which to draw the resize grip
+ *
+ * Draws a resize grip in the given rectangle on @cr using the given
+ * parameters.
+ */
+void
+gtk_cairo_paint_resize_grip (GtkStyle *style,
+ cairo_t *cr,
+ GtkStateType state_type,
+ GtkWidget *widget,
+ const gchar *detail,
+ GdkWindowEdge edge,
+ 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_resize_grip != NULL);
+ g_return_if_fail (cr != NULL);
+
+ cairo_save (cr);
+
+ GTK_STYLE_GET_CLASS (style)->draw_resize_grip (style, cr, state_type,
+ widget, detail,
+ edge, x, y, width, height);
+ cairo_restore (cr);
}
/**