summaryrefslogtreecommitdiff
path: root/src/cairo-surface.c
diff options
context:
space:
mode:
authorLoïc Minier <lool@dooz.org>2009-04-15 00:04:36 +0200
committerLoïc Minier <lool@dooz.org>2009-04-15 00:04:36 +0200
commit0b7f8018c0813104d5ed151ba3ddebd84a9b42ef (patch)
treec7fa3990a33e470f2d8dd6f85b19e55dd8615bbc /src/cairo-surface.c
parentc14a30c049d9e2911dad3d7243f8cf9c69603249 (diff)
Imported Upstream version 1.5.8
Diffstat (limited to 'src/cairo-surface.c')
-rw-r--r--src/cairo-surface.c67
1 files changed, 35 insertions, 32 deletions
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 8860c95..16c48f1 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -86,6 +86,7 @@ static DEFINE_NIL_SURFACE(CAIRO_STATUS_FILE_NOT_FOUND, _cairo_surface_nil_file_n
static DEFINE_NIL_SURFACE(CAIRO_STATUS_TEMP_FILE_ERROR, _cairo_surface_nil_temp_file_error);
static DEFINE_NIL_SURFACE(CAIRO_STATUS_READ_ERROR, _cairo_surface_nil_read_error);
static DEFINE_NIL_SURFACE(CAIRO_STATUS_WRITE_ERROR, _cairo_surface_nil_write_error);
+static DEFINE_NIL_SURFACE(CAIRO_STATUS_INVALID_STRIDE, _cairo_surface_nil_invalid_stride);
static cairo_status_t
_cairo_surface_copy_pattern_for_destination (const cairo_pattern_t *pattern,
@@ -279,7 +280,7 @@ _cairo_surface_create_similar_scratch (cairo_surface_t *other,
* have transparency, black otherwise.)
*
* Return value: a pointer to the newly allocated surface. The caller
- * owns the surface and should call cairo_surface_destroy when done
+ * owns the surface and should call cairo_surface_destroy() when done
* with it.
*
* This function always returns a valid pointer, but it will return a
@@ -881,7 +882,7 @@ slim_hidden_def (cairo_surface_get_device_offset);
* device resolution. So this function has no effect on those
* backends.
*
- * NOTE: The fallback resolution only takes effect at the time of
+ * Note: The fallback resolution only takes effect at the time of
* completing a page (with cairo_show_page() or cairo_copy_page()) so
* there is currently no way to have more than one fallback resolution
* in effect on a single page.
@@ -971,7 +972,7 @@ _cairo_surface_release_source_image (cairo_surface_t *surface,
* @surface: a #cairo_surface_t
* @interest_rect: area of @surface for which fallback drawing is being done.
* A value of %NULL indicates that the entire surface is desired.
- * XXXX I'd like to get rid of being able to pass NULL here (nothing seems to)
+ * XXXX I'd like to get rid of being able to pass %NULL here (nothing seems to)
* @image_out: location to store a pointer to an image surface that includes at least
* the intersection of @interest_rect with the visible area of @surface.
* This surface could be @surface itself, a surface held internal to @surface,
@@ -992,7 +993,7 @@ _cairo_surface_release_source_image (cairo_surface_t *surface,
* Return value: %CAIRO_STATUS_SUCCESS or %CAIRO_STATUS_NO_MEMORY.
* %CAIRO_INT_STATUS_UNSUPPORTED can be returned but this will mean that
* the backend can't draw with fallbacks. It's possible for the routine
- * to store NULL in @local_out and return %CAIRO_STATUS_SUCCESS;
+ * to store %NULL in @local_out and return %CAIRO_STATUS_SUCCESS;
* that indicates that no part of @interest_rect is visible, so no drawing
* is necessary. _cairo_surface_release_dest_image() should not be called in that
* case.
@@ -1130,7 +1131,7 @@ _cairo_surface_clone_similar (cairo_surface_t *surface,
*
* The caller owns the return value and should call
* cairo_surface_destroy when finished with it. This function will not
- * return NULL, but will return a nil surface instead.
+ * return %NULL, but will return a nil surface instead.
*
* Return value: The snapshot surface. Note that the return surface
* may not necessarily be of the same type as @surface.
@@ -1158,9 +1159,9 @@ _cairo_surface_snapshot (cairo_surface_t *surface)
*
* The definition of "similar" depends on the backend. In
* general, it means that the surface is equivalent to one
- * that would have been generated by a call to cairo_surface_create_similar.
+ * that would have been generated by a call to cairo_surface_create_similar().
*
- * Return value: TRUE if the surfaces are similar.
+ * Return value: %TRUE if the surfaces are similar.
**/
cairo_bool_t
_cairo_surface_is_similar (cairo_surface_t *surface_a,
@@ -1649,7 +1650,7 @@ _cairo_surface_composite_trapezoids (cairo_operator_t op,
/**
* cairo_surface_copy_page:
- * @suface: a #cairo_surface_t
+ * @surface: a #cairo_surface_t
*
* Emits the current page for backends that support multiple pages,
* but doesn't clear it, so that the contents of the current page will
@@ -1658,23 +1659,25 @@ _cairo_surface_composite_trapezoids (cairo_operator_t op,
*
* Since: 1.6
*/
-cairo_status_t
+void
cairo_surface_copy_page (cairo_surface_t *surface)
{
assert (! surface->is_snapshot);
if (surface->status)
- return surface->status;
+ return;
- if (surface->finished)
- return _cairo_surface_set_error (surface,CAIRO_STATUS_SURFACE_FINISHED);
+ if (surface->finished) {
+ _cairo_surface_set_error (surface,CAIRO_STATUS_SURFACE_FINISHED);
+ return;
+ }
/* It's fine if some backends don't implement copy_page */
if (surface->backend->copy_page == NULL)
- return CAIRO_STATUS_SUCCESS;
+ return;
- return _cairo_surface_set_error (surface,
- surface->backend->copy_page (surface));
+ _cairo_surface_set_error (surface,
+ surface->backend->copy_page (surface));
}
slim_hidden_def (cairo_surface_copy_page);
@@ -1687,24 +1690,25 @@ slim_hidden_def (cairo_surface_copy_page);
*
* Since: 1.6
**/
-
-cairo_status_t
+void
cairo_surface_show_page (cairo_surface_t *surface)
{
assert (! surface->is_snapshot);
if (surface->status)
- return surface->status;
+ return;
- if (surface->finished)
- return _cairo_surface_set_error (surface,CAIRO_STATUS_SURFACE_FINISHED);
+ if (surface->finished) {
+ _cairo_surface_set_error (surface,CAIRO_STATUS_SURFACE_FINISHED);
+ return;
+ }
/* It's fine if some backends don't implement show_page */
if (surface->backend->show_page == NULL)
- return CAIRO_STATUS_SUCCESS;
+ return;
- return _cairo_surface_set_error (surface,
- surface->backend->show_page (surface));
+ _cairo_surface_set_error (surface,
+ surface->backend->show_page (surface));
}
slim_hidden_def (cairo_surface_show_page);
@@ -1712,7 +1716,7 @@ slim_hidden_def (cairo_surface_show_page);
* _cairo_surface_get_current_clip_serial:
* @surface: the #cairo_surface_t to return the serial number for
*
- * Returns the serial number associated with the current
+ * Returns: the serial number associated with the current
* clip in the surface. All gstate functions must
* verify that the correct clip is set in the surface before
* invoking any surface drawing function
@@ -2001,10 +2005,10 @@ _cairo_surface_set_clip (cairo_surface_t *surface, cairo_clip_t *clip)
* maximum size at the time of surface_create. So get_extents uses
* that size.
*
- * NOTE: The coordinates returned are in "backend" space rather than
+ * Note: The coordinates returned are in "backend" space rather than
* "surface" space. That is, they are relative to the true (0,0)
* origin rather than the device_transform origin. This might seem a
- * bit inconsistent with other cairo_surface interfaces, but all
+ * bit inconsistent with other #cairo_surface_t interfaces, but all
* current callers are within the surface layer where backend space is
* desired.
*
@@ -2026,7 +2030,7 @@ _cairo_surface_get_extents (cairo_surface_t *surface,
}
/* Note: the backends may modify the contents of the glyph array as long as
- * they do not return CAIRO_STATUS_UNSUPPORTED. This makes it possible to
+ * they do not return %CAIRO_STATUS_UNSUPPORTED. This makes it possible to
* avoid copying the array again and again, and edit it in-place.
* Backends are in fact free to use the array as a generic buffer as they
* see fit.
@@ -2189,12 +2193,9 @@ _cairo_surface_composite_fixup_unbounded_internal (cairo_surface_t *dst,
has_drawn_region = TRUE;
has_clear_region = TRUE;
- if (_cairo_region_subtract (&clear_region, &clear_region, &drawn_region)
- != CAIRO_STATUS_SUCCESS)
- {
- status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
+ status = _cairo_region_subtract (&clear_region, &clear_region, &drawn_region);
+ if (status)
goto CLEANUP_REGIONS;
- }
status = _cairo_surface_fill_region (dst, CAIRO_OPERATOR_SOURCE,
CAIRO_COLOR_TRANSPARENT,
@@ -2430,6 +2431,8 @@ _cairo_surface_create_in_error (cairo_status_t status)
return (cairo_surface_t *) &_cairo_surface_nil_file_not_found;
case CAIRO_STATUS_TEMP_FILE_ERROR:
return (cairo_surface_t *) &_cairo_surface_nil_temp_file_error;
+ case CAIRO_STATUS_INVALID_STRIDE:
+ return (cairo_surface_t *) &_cairo_surface_nil_invalid_stride;
default:
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_surface_t *) &_cairo_surface_nil;