mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 14:00:09 +00:00
style: Convert draw_resize_grip vfunc to Cairo version
Includes removal of now unused draw_simple_image_no_cairo() function from pixbuf engine.
This commit is contained in:
parent
d80e2897b9
commit
81f15cf908
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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,
|
||||
|
@ -140,45 +140,6 @@ draw_simple_image(GtkStyle *style,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
draw_simple_image_no_cairo(GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GdkRectangle *area,
|
||||
GtkWidget *widget,
|
||||
ThemeMatchData *match_data,
|
||||
gboolean draw_center,
|
||||
gboolean allow_setbg,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
gboolean result;
|
||||
cairo_t *cr;
|
||||
|
||||
if ((width == -1) && (height == -1))
|
||||
gdk_drawable_get_size(window, &width, &height);
|
||||
else if (width == -1)
|
||||
gdk_drawable_get_size(window, &width, NULL);
|
||||
else if (height == -1)
|
||||
gdk_drawable_get_size(window, NULL, &height);
|
||||
|
||||
cr = gdk_cairo_create (window);
|
||||
if (area)
|
||||
{
|
||||
gdk_cairo_rectangle (cr, area);
|
||||
cairo_clip (cr);
|
||||
}
|
||||
|
||||
result = draw_simple_image (style, cr, widget, match_data,
|
||||
draw_center, allow_setbg,
|
||||
x, y, width, height);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
draw_gap_image(GtkStyle *style,
|
||||
cairo_t *cr,
|
||||
@ -944,22 +905,18 @@ draw_expander (GtkStyle *style,
|
||||
|
||||
static void
|
||||
draw_resize_grip (GtkStyle *style,
|
||||
GdkWindow *window,
|
||||
GtkStateType state,
|
||||
GdkRectangle *area,
|
||||
GtkWidget *widget,
|
||||
const gchar *detail,
|
||||
GdkWindowEdge edge,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
cairo_t *cr,
|
||||
GtkStateType state,
|
||||
GtkWidget *widget,
|
||||
const gchar *detail,
|
||||
GdkWindowEdge edge,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
ThemeMatchData match_data;
|
||||
|
||||
g_return_if_fail (style != NULL);
|
||||
g_return_if_fail (window != NULL);
|
||||
|
||||
match_data.function = TOKEN_D_RESIZE_GRIP;
|
||||
match_data.detail = (gchar *)detail;
|
||||
match_data.flags = (THEME_MATCH_STATE |
|
||||
@ -967,9 +924,9 @@ draw_resize_grip (GtkStyle *style,
|
||||
match_data.state = state;
|
||||
match_data.window_edge = edge;
|
||||
|
||||
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_resize_grip (style, window, state, area, widget, detail,
|
||||
parent_class->draw_resize_grip (style, cr, state, widget, detail,
|
||||
edge, x, y, width, height);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user