summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2013-08-12 15:40:00 +0200
committerUli Schlachter <psychon@znc.in>2013-08-13 19:21:02 +0200
commit18633b081026eb88931af6130b3e716fdb954e19 (patch)
treec350ff8396188192060f470a5250e24d6513150c
parentb64c83e891f2417a1b28034a55659260a1769ba7 (diff)
surface: Error out on finished surfaces
Finished surfaces and surfaces with an error status must not be usable anymore, so refuse to work on them. This improves the result for api-special-cases. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68014 Signed-off-by: Uli Schlachter <psychon@znc.in>
-rw-r--r--src/cairo-surface.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 5c6969c8a..3293aa29b 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1346,6 +1346,13 @@ cairo_surface_supports_mime_type (cairo_surface_t *surface,
{
const char **types;
+ if (unlikely (surface->status))
+ return FALSE;
+ if (unlikely (surface->finished)) {
+ _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
+ return FALSE;
+ }
+
if (surface->backend->get_supported_mime_types) {
types = surface->backend->get_supported_mime_types (surface);
if (types) {
@@ -2004,6 +2011,8 @@ _cairo_surface_paint (cairo_surface_t *surface,
TRACE ((stderr, "%s\n", __FUNCTION__));
if (unlikely (surface->status))
return surface->status;
+ if (unlikely (surface->finished))
+ return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
if (_cairo_clip_is_all_clipped (clip))
return CAIRO_STATUS_SUCCESS;
@@ -2040,6 +2049,8 @@ _cairo_surface_mask (cairo_surface_t *surface,
TRACE ((stderr, "%s\n", __FUNCTION__));
if (unlikely (surface->status))
return surface->status;
+ if (unlikely (surface->finished))
+ return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
if (_cairo_clip_is_all_clipped (clip))
return CAIRO_STATUS_SUCCESS;
@@ -2097,6 +2108,8 @@ _cairo_surface_fill_stroke (cairo_surface_t *surface,
TRACE ((stderr, "%s\n", __FUNCTION__));
if (unlikely (surface->status))
return surface->status;
+ if (unlikely (surface->finished))
+ return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
if (_cairo_clip_is_all_clipped (clip))
return CAIRO_STATUS_SUCCESS;
@@ -2177,6 +2190,8 @@ _cairo_surface_stroke (cairo_surface_t *surface,
TRACE ((stderr, "%s\n", __FUNCTION__));
if (unlikely (surface->status))
return surface->status;
+ if (unlikely (surface->finished))
+ return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
if (_cairo_clip_is_all_clipped (clip))
return CAIRO_STATUS_SUCCESS;
@@ -2220,6 +2235,8 @@ _cairo_surface_fill (cairo_surface_t *surface,
TRACE ((stderr, "%s\n", __FUNCTION__));
if (unlikely (surface->status))
return surface->status;
+ if (unlikely (surface->finished))
+ return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
if (_cairo_clip_is_all_clipped (clip))
return CAIRO_STATUS_SUCCESS;
@@ -2435,6 +2452,8 @@ _cairo_surface_show_text_glyphs (cairo_surface_t *surface,
TRACE ((stderr, "%s\n", __FUNCTION__));
if (unlikely (surface->status))
return surface->status;
+ if (unlikely (surface->finished))
+ return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
if (num_glyphs == 0 && utf8_len == 0)
return CAIRO_STATUS_SUCCESS;