mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-18 08:30:06 +00:00
gtk-demo: Make pixbufs demo use Cairo
This commit is contained in:
parent
a907d5e2cc
commit
d7a1973f9f
@ -100,20 +100,15 @@ expose_cb (GtkWidget *widget,
|
|||||||
GdkEventExpose *event,
|
GdkEventExpose *event,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
guchar *pixels;
|
cairo_t *cr;
|
||||||
int rowstride;
|
|
||||||
|
|
||||||
rowstride = gdk_pixbuf_get_rowstride (frame);
|
cr = gdk_cairo_create (event->window);
|
||||||
|
|
||||||
pixels = gdk_pixbuf_get_pixels (frame) + rowstride * event->area.y + event->area.x * 3;
|
gdk_cairo_set_source_pixbuf (cr, frame, 0, 0);
|
||||||
|
gdk_cairo_rectangle (cr, &event->area);
|
||||||
|
cairo_fill (cr);
|
||||||
|
|
||||||
gdk_draw_rgb_image_dithalign (widget->window,
|
cairo_destroy (cr);
|
||||||
widget->style->black_gc,
|
|
||||||
event->area.x, event->area.y,
|
|
||||||
event->area.width, event->area.height,
|
|
||||||
GDK_RGB_DITHER_NORMAL,
|
|
||||||
pixels, rowstride,
|
|
||||||
event->area.x, event->area.y);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user