aboutsummaryrefslogtreecommitdiff
path: root/pixman
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-02-27 10:45:05 +0100
committermarha <marha@users.sourceforge.net>2013-02-27 10:45:05 +0100
commitc74ef795c7282681616decc36a9a81cd1b1b6ec7 (patch)
treebeb5f13ba78bd7920eae918b6aa5db5bac83f0da /pixman
parentf51268259621a21d14e40b8a41c5803a5c2ce706 (diff)
downloadvcxsrv-c74ef795c7282681616decc36a9a81cd1b1b6ec7.tar.gz
vcxsrv-c74ef795c7282681616decc36a9a81cd1b1b6ec7.tar.bz2
vcxsrv-c74ef795c7282681616decc36a9a81cd1b1b6ec7.zip
libX11 mesa pixman xkeyboard-config
xkeyboard-config commit 9993f996e75232385b19cc5078f7fecde6b399b9 libX11 commit b687440c28c7da6ee0ae44514d20248db5161606 pixman commit 2156fb51b353867d5a18b734690ca551f74d4fb1 mesa commit f987d23b28491bd7b0552bd9daffa53a8e073c71
Diffstat (limited to 'pixman')
-rw-r--r--pixman/demos/gtk-utils.c53
1 files changed, 29 insertions, 24 deletions
diff --git a/pixman/demos/gtk-utils.c b/pixman/demos/gtk-utils.c
index d7e946ded..32d4aecc7 100644
--- a/pixman/demos/gtk-utils.c
+++ b/pixman/demos/gtk-utils.c
@@ -95,14 +95,31 @@ pixbuf_from_argb32 (uint32_t *bits,
static gboolean
on_expose (GtkWidget *widget, GdkEventExpose *expose, gpointer data)
{
- GdkPixbuf *pixbuf = data;
+ pixman_image_t *pimage = data;
+ int width = pixman_image_get_width (pimage);
+ int height = pixman_image_get_height (pimage);
+ int stride = pixman_image_get_stride (pimage);
+ cairo_surface_t *cimage;
+ cairo_format_t format;
+ cairo_t *cr;
+
+ if (pixman_image_get_format (pimage) == PIXMAN_x8r8g8b8)
+ format = CAIRO_FORMAT_RGB24;
+ else
+ format = CAIRO_FORMAT_ARGB32;
+
+ cimage = cairo_image_surface_create_for_data (
+ (uint8_t *)pixman_image_get_data (pimage),
+ format, width, height, stride);
- gdk_draw_pixbuf (widget->window, NULL,
- pixbuf, 0, 0, 0, 0,
- gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf),
- GDK_RGB_DITHER_NONE,
- 0, 0);
+ cr = gdk_cairo_create (widget->window);
+
+ cairo_rectangle (cr, 0, 0, width, height);
+ cairo_set_source_surface (cr, cimage, 0, 0);
+ cairo_fill (cr);
+
+ cairo_destroy (cr);
+ cairo_surface_destroy (cimage);
return TRUE;
}
@@ -111,7 +128,6 @@ void
show_image (pixman_image_t *image)
{
GtkWidget *window;
- GdkPixbuf *pixbuf;
int width, height;
int argc;
char **argv;
@@ -132,22 +148,15 @@ show_image (pixman_image_t *image)
format = pixman_image_get_format (image);
- /* Three cases:
- *
- * - image is a8r8g8b8_sRGB: we will display without modification
- * under the assumption that the monitor is sRGB
- *
- * - image is a8r8g8b8: we will display without modification
- * under the assumption that whoever created the image
- * probably did it wrong by using sRGB inputs
- *
- * - other: we will convert to a8r8g8b8 under the assumption that
- * whoever created the image probably did it wrong.
+ /* We always display the image as if it contains sRGB data. That
+ * means that no conversion should take place when the image
+ * has the a8r8g8b8_sRGB format.
*/
switch (format)
{
case PIXMAN_a8r8g8b8_sRGB:
case PIXMAN_a8r8g8b8:
+ case PIXMAN_x8r8g8b8:
copy = pixman_image_ref (image);
break;
@@ -161,11 +170,7 @@ show_image (pixman_image_t *image)
break;
}
- pixbuf = pixbuf_from_argb32 (pixman_image_get_data (copy),
- width, height,
- pixman_image_get_stride (copy));
-
- g_signal_connect (window, "expose_event", G_CALLBACK (on_expose), pixbuf);
+ g_signal_connect (window, "expose_event", G_CALLBACK (on_expose), copy);
g_signal_connect (window, "delete_event", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show (window);