Commit c3ef33ea authored by Debarshi Ray's avatar Debarshi Ray

base-item: Use the correct stride value

The stride with which the Cairo surface is created should be the same
as the one with which data was written to it. The Cairo surface and its
underlying memory buffer were being created based on the stride
specified by Cairo, while data was being written to it based on a
potentially smaller stride value, which could have caused visual

GEGL_AUTO_ROWSTRIDE represents the product of the bytes per pixel of
the Babl format with the requested width. This might not match the
value specified by the Cairo surface because it might be more
performant to have extra padding at the end of each row to satisfy
alignment requirements, etc..

There are no known bugs caused by this, possibly because a
CAIRO_ARGB32 pixel has a nicely rounded length of 32 bits, which makes
a mismatch unlikely. However, the possibility cannot be ruled out.
There was a similar bug in gegl:pixbuf [1] where the stride with which
a GdkPixbuf was created didn't match the one with which data was read
from it.

[1] GEGL commit aaf2477caec750
parent 15542a14
* Photos - access, organize and share your photos on GNOME
* Copyright © 2014 – 2015 Pranav Kant
* Copyright © 2012 – 2017 Red Hat, Inc.
* Copyright © 2012 – 2018 Red Hat, Inc.
* Copyright © 2016 Umang Jain
* This program is free software: you can redistribute it and/or modify
......@@ -3306,7 +3306,7 @@ photos_base_item_create_preview (PhotosBaseItem *self,
start = g_get_monotonic_time ();
gegl_node_blit (operation_node, 1.0, &bbox, format, buf, GEGL_AUTO_ROWSTRIDE, GEGL_BLIT_DEFAULT);
gegl_node_blit (operation_node, 1.0, &bbox, format, buf, stride, GEGL_BLIT_DEFAULT);
end = g_get_monotonic_time ();
photos_debug (PHOTOS_DEBUG_GEGL, "Create Preview: Node Blit: %" G_GINT64_FORMAT, end - start);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment