[gtk+/cairo-style: 20/21] style: Convert draw_resize_grip vfunc to Cairo version
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/cairo-style: 20/21] style: Convert draw_resize_grip vfunc to Cairo version
- Date: Tue, 17 Aug 2010 02:25:20 +0000 (UTC)
commit 044ef091fec4fe6d72be53443ad18619e6964489
Author: Benjamin Otte <otte redhat com>
Date: Mon Aug 16 15:13:26 2010 +0200
style: Convert draw_resize_grip vfunc to Cairo version
gtk/gtkstyle.c | 64 ++++++++++++++++++++++++++++++++++++++++++-------------
gtk/gtkstyle.h | 35 +++++++++++++++++++-----------
2 files changed, 71 insertions(+), 28 deletions(-)
---
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 6d1793a..836973a 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,
@@ -3966,9 +3965,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,
@@ -3978,16 +3976,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);
@@ -4262,8 +4253,6 @@ gtk_default_draw_resize_grip (GtkStyle *style,
g_assert_not_reached ();
break;
}
-
- cairo_destroy (cr);
}
static void
@@ -6212,13 +6201,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);
}
/**
diff --git a/gtk/gtkstyle.h b/gtk/gtkstyle.h
index a1b545e..9a08c23 100644
--- a/gtk/gtkstyle.h
+++ b/gtk/gtkstyle.h
@@ -350,9 +350,8 @@ struct _GtkStyleClass
gint y,
PangoLayout *layout);
void (*draw_resize_grip) (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state_type,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
GdkWindowEdge edge,
@@ -820,17 +819,27 @@ void gtk_cairo_paint_layout (GtkStyle *style,
gint x,
gint y,
PangoLayout *layout);
-void gtk_paint_resize_grip (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- const GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- GdkWindowEdge edge,
- gint x,
- gint y,
- gint width,
- gint height);
+void gtk_paint_resize_grip (GtkStyle *style,
+ GdkWindow *window,
+ GtkStateType state_type,
+ const GdkRectangle *area,
+ GtkWidget *widget,
+ const gchar *detail,
+ GdkWindowEdge edge,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+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);
void gtk_paint_spinner (GtkStyle *style,
GdkWindow *window,
GtkStateType state_type,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]