[gtk+/rendering-cleanup: 54/63] tests: replace gdk_draw_drawable() with Cairo calls in testinput
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup: 54/63] tests: replace gdk_draw_drawable() with Cairo calls in testinput
- Date: Thu, 15 Jul 2010 03:27:28 +0000 (UTC)
commit 72e6e6ca6f610d909a7fda15ade41d5386edd785
Author: Benjamin Otte <otte redhat com>
Date: Wed Jul 14 23:10:31 2010 +0200
tests: replace gdk_draw_drawable() with Cairo calls in testinput
tests/testinput.c | 40 ++++++++++++++++++++++------------------
1 files changed, 22 insertions(+), 18 deletions(-)
---
diff --git a/tests/testinput.c b/tests/testinput.c
index 3bd3167..5a81b8e 100644
--- a/tests/testinput.c
+++ b/tests/testinput.c
@@ -55,12 +55,13 @@ update_cursor (GtkWidget *widget, gdouble x, gdouble y)
if (cursor_present && (cursor_present != state ||
x != cursor_x || y != cursor_y))
{
- gdk_draw_drawable (widget->window,
- widget->style->fg_gc[gtk_widget_get_state (widget)],
- pixmap,
- cursor_x - 5, cursor_y - 5,
- cursor_x - 5, cursor_y - 5,
- 10, 10);
+ cairo_t *cr = gdk_cairo_create (widget->window);
+
+ gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
+ cairo_rectangle (cr, cursor_x - 5, cursor_y - 5, 10, 10);
+ cairo_fill (cr);
+
+ cairo_destroy (cr);
}
cursor_present = state;
@@ -82,18 +83,20 @@ update_cursor (GtkWidget *widget, gdouble x, gdouble y)
static gint
configure_event (GtkWidget *widget, GdkEventConfigure *event)
{
+ cairo_t *cr;
+
if (pixmap)
g_object_unref (pixmap);
pixmap = gdk_pixmap_new(widget->window,
widget->allocation.width,
widget->allocation.height,
-1);
- gdk_draw_rectangle (pixmap,
- widget->style->white_gc,
- TRUE,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height);
+ cr = gdk_cairo_create (pixmap);
+
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_paint (cr);
+
+ cairo_destroy (cr);
return TRUE;
}
@@ -102,12 +105,13 @@ configure_event (GtkWidget *widget, GdkEventConfigure *event)
static gint
expose_event (GtkWidget *widget, GdkEventExpose *event)
{
- gdk_draw_drawable (widget->window,
- widget->style->fg_gc[gtk_widget_get_state (widget)],
- pixmap,
- event->area.x, event->area.y,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
+ cairo_t *cr = gdk_cairo_create (widget->window);
+
+ gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
+ gdk_cairo_rectangle (cr, &event->area);
+ cairo_fill (cr);
+
+ cairo_destroy (cr);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]