mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-18 09:00:34 +00:00
tests: Make testoffscreen use Cairo
This commit is contained in:
parent
8e537f94ac
commit
8dc19e4158
@ -26,11 +26,13 @@ layout_expose_handler (GtkWidget *widget,
|
|||||||
GdkEventExpose *event)
|
GdkEventExpose *event)
|
||||||
{
|
{
|
||||||
GtkLayout *layout = GTK_LAYOUT (widget);
|
GtkLayout *layout = GTK_LAYOUT (widget);
|
||||||
|
GdkWindow *bin_window = gtk_layout_get_bin_window (layout);
|
||||||
|
cairo_t *cr;
|
||||||
|
|
||||||
gint i,j;
|
gint i,j;
|
||||||
gint imin, imax, jmin, jmax;
|
gint imin, imax, jmin, jmax;
|
||||||
|
|
||||||
if (event->window != layout->bin_window)
|
if (event->window != bin_window)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
imin = (event->area.x) / 10;
|
imin = (event->area.x) / 10;
|
||||||
@ -39,14 +41,18 @@ layout_expose_handler (GtkWidget *widget,
|
|||||||
jmin = (event->area.y) / 10;
|
jmin = (event->area.y) / 10;
|
||||||
jmax = (event->area.y + event->area.height + 9) / 10;
|
jmax = (event->area.y + event->area.height + 9) / 10;
|
||||||
|
|
||||||
|
cr = gdk_cairo_create (bin_window);
|
||||||
|
|
||||||
for (i = imin; i < imax; i++)
|
for (i = imin; i < imax; i++)
|
||||||
for (j = jmin; j < jmax; j++)
|
for (j = jmin; j < jmax; j++)
|
||||||
if ((i + j) % 2)
|
if ((i + j) % 2)
|
||||||
gdk_draw_rectangle (layout->bin_window,
|
cairo_rectangle (cr,
|
||||||
widget->style->black_gc,
|
10 * i, 10 * j,
|
||||||
TRUE,
|
1 + i % 10, 1 + j % 10);
|
||||||
10 * i, 10 * j,
|
|
||||||
1 + i % 10, 1 + j % 10);
|
cairo_fill (cr);
|
||||||
|
|
||||||
|
cairo_destroy (cr);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user