Use the right conversion from cairo to GdkPixbuf
GdkPixbuf is stored in memory as individual bytes, in strict red-green-blue-alpha order, while cairo image surfaces are stored as 32bits units whose order depends on the endianess. It is probably possible to do something better, taking advantage of cogl and the GL using the actual component order, but for now it is easier to use the GDK utility to convert the cairo surface. https://bugzilla.gnome.org/show_bug.cgi?id=693931
This commit is contained in:
parent
24984458de
commit
9b9f33bc8b
@ -183,22 +183,19 @@ write_screenshot_thread (GSimpleAsyncResult *result,
|
||||
else
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (screenshot_data->image),
|
||||
GDK_COLORSPACE_RGB,
|
||||
TRUE,
|
||||
8,
|
||||
cairo_image_surface_get_width (screenshot_data->image),
|
||||
cairo_image_surface_get_height (screenshot_data->image),
|
||||
cairo_image_surface_get_stride (screenshot_data->image),
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_surface (screenshot_data->image,
|
||||
0, 0,
|
||||
cairo_image_surface_get_width (screenshot_data->image),
|
||||
cairo_image_surface_get_height (screenshot_data->image));
|
||||
|
||||
if (gdk_pixbuf_save_to_stream (pixbuf, stream, "png", NULL, NULL,
|
||||
"tEXt::Software", "gnome-screenshot", NULL))
|
||||
status = CAIRO_STATUS_SUCCESS;
|
||||
else
|
||||
status = CAIRO_STATUS_WRITE_ERROR;
|
||||
|
||||
g_clear_object (&pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user