diff options
author | Benjamin Otte <otte@gnome.org> | 2009-09-23 17:40:17 +0200 |
---|---|---|
committer | Benjamin Otte <otte@gnome.org> | 2009-09-23 17:40:45 +0200 |
commit | ab558fa843accc440686f7b8eda197277a6a4eb2 (patch) | |
tree | 5a265a79fe2072a4ab9e1519a302b17586a10cf0 | |
parent | 07ee9cfbf07deba228e73d26b419a4e130de24e3 (diff) |
[image] Move setting of is_clear to _create_with_pixman_format()
Simplifies code and ensures other users of that function don't run into
the same bug.
-rw-r--r-- | src/cairo-image-surface.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 8ad259d2..9156349b 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -391,7 +391,8 @@ _cairo_image_surface_create_with_pixman_format (unsigned char *data, if (cairo_surface_status (surface)) pixman_image_unref (pixman_image); else - ((cairo_image_surface_t *)surface)->is_clear = TRUE; + /* we can not make any assumptions by the initial state of the data */ + ((cairo_image_surface_t *)surface)->is_clear = (data != NULL); return surface; } @@ -542,7 +543,6 @@ cairo_image_surface_create_for_data (unsigned char *data, int stride) { pixman_format_code_t pixman_format; - cairo_surface_t *surface; int minstride; if (! CAIRO_FORMAT_VALID (format)) @@ -563,16 +563,10 @@ cairo_image_surface_create_for_data (unsigned char *data, } pixman_format = _cairo_format_to_pixman_format_code (format); - surface = _cairo_image_surface_create_with_pixman_format (data, - pixman_format, - width, height, - stride); - if (unlikely (surface->status)) - return surface; - - /* we can not make any assumptions by the initial state of the data */ - ((cairo_image_surface_t *) surface)->is_clear = FALSE; - return surface; + return _cairo_image_surface_create_with_pixman_format (data, + pixman_format, + width, height, + stride); } slim_hidden_def (cairo_image_surface_create_for_data); |