Skip to content

Commit 81106ab

Browse files
committed
image_surface_get_data: add some comments/links for more context
1 parent c828124 commit 81106ab

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

cairo/surface.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,11 @@ image_surface_get_data (PycairoImageSurface *o, PyObject *ignored) {
10421042

10431043
buffer = cairo_image_surface_get_data (surface);
10441044
if (buffer == NULL) {
1045+
// It's documented to return NULL after finish, but that's not always the case:
1046+
// https://gitlab.freedesktop.org/cairo/cairo/-/issues/406
1047+
// and it returns NULL if the size is 0 and it's backed by pixman:
1048+
// https://gitlab.freedesktop.org/cairo/cairo/-/issues/880
1049+
// Let's paper over this by returning an empty memoryview.
10451050
return create_empty_memoryview();
10461051
}
10471052
height = cairo_image_surface_get_height (surface);

0 commit comments

Comments
 (0)