diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-08-02 22:31:49 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-08-15 00:16:09 +0100 |
commit | 2220693a40a4f8d13603b3fb29273ec59fd433bc (patch) | |
tree | aec5bf4af07b2a2c2c0d96069e028bdcdec953e9 /src/cairo.c | |
parent | eed1f2efdf36173e23b7177bb34ab9a5f015fb2a (diff) | |
download | cairo-2220693a40a4f8d13603b3fb29273ec59fd433bc.tar.gz |
Introduce cairo_mime_surface_t
The mime surface is a user-callback surface designed for interfacing
cairo with an opaque data source. For instance, in a web browser, the
incoming page may be laid out and rendered to a recording surface before
all the image data has finished being downloaded. In this circumstance
we need to pass a place holder to cairo and to supply the image data
later upon demand.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo.c')
-rw-r--r-- | src/cairo.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/cairo.c b/src/cairo.c index a9f8c6e41..6f6d00e69 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -212,9 +212,11 @@ _cairo_create_in_error (cairo_status_t status) * with cairo_destroy() when you are done using the #cairo_t. * This function never returns %NULL. If memory cannot be * allocated, a special #cairo_t object will be returned on - * which cairo_status() returns %CAIRO_STATUS_NO_MEMORY. - * You can use this object normally, but no drawing will - * be done. + * which cairo_status() returns %CAIRO_STATUS_NO_MEMORY. If + * you attempt to target a surface which does not support + * writing (such as #cairo_mime_surface_t) then a + * %CAIRO_STATUS_WRITE_ERROR will be raised. You can use this + * object normally, but no drawing will be done. **/ cairo_t * cairo_create (cairo_surface_t *target) @@ -224,6 +226,9 @@ cairo_create (cairo_surface_t *target) if (unlikely (target->status)) return _cairo_create_in_error (target->status); + if (target->backend->create_context == NULL) + return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_WRITE_ERROR)); + return target->backend->create_context (target); } |