forked from AuroraMiddleware/gtk
gtk-demo: Blit backing pixmap using Cairo
This commit is contained in:
parent
831afa2159
commit
188884a9b1
@ -53,18 +53,15 @@ scribble_expose_event (GtkWidget *widget,
|
|||||||
GdkEventExpose *event,
|
GdkEventExpose *event,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
/* We use the "foreground GC" for the widget since it already exists,
|
cairo_t *cr;
|
||||||
* but honestly any GC would work. The only thing to worry about
|
|
||||||
* is whether the GC has an inappropriate clip region set.
|
|
||||||
*/
|
|
||||||
|
|
||||||
gdk_draw_drawable (widget->window,
|
cr = gdk_cairo_create (widget->window);
|
||||||
widget->style->fg_gc[gtk_widget_get_state (widget)],
|
|
||||||
pixmap,
|
gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
|
||||||
/* Only copy the area that was exposed. */
|
gdk_cairo_rectangle (cr, &event->area);
|
||||||
event->area.x, event->area.y,
|
cairo_fill (cr);
|
||||||
event->area.x, event->area.y,
|
|
||||||
event->area.width, event->area.height);
|
cairo_destroy (cr);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -172,8 +169,6 @@ checkerboard_expose (GtkWidget *da,
|
|||||||
ycount = xcount % 2; /* start with even/odd depending on row */
|
ycount = xcount % 2; /* start with even/odd depending on row */
|
||||||
while (j < da->allocation.height)
|
while (j < da->allocation.height)
|
||||||
{
|
{
|
||||||
GdkGC *gc;
|
|
||||||
|
|
||||||
if (ycount % 2)
|
if (ycount % 2)
|
||||||
cairo_set_source_rgb (cr, 0.45777, 0, 0.45777);
|
cairo_set_source_rgb (cr, 0.45777, 0, 0.45777);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user