summaryrefslogtreecommitdiff
path: root/src/cairo-ps-surface.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2007-02-21 18:06:02 -0500
committerBehdad Esfahbod <behdad@behdad.org>2007-02-23 17:26:42 -0500
commit81935bb13120898a8581d8266041d3292558710a (patch)
treea71f786cf37cf967611519f5f60397f2b79980d3 /src/cairo-ps-surface.c
parent4e30919f30e7618dbb62d7de2931efaac26c1785 (diff)
[PS] Update surface_pattern_supported() from PDF
The PS backend was accepting all surface patterns, just to ASSERT_NOT_REACHED later if extend type of the pattern was PAD or REFLECT. That didn't make sense and was causing crash for PAD (surprisingly not for REFLECT. Not sure why). So now it rejects those types of surface patterns, just like the PDF surface does.
Diffstat (limited to 'src/cairo-ps-surface.c')
-rw-r--r--src/cairo-ps-surface.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index ce98eb14..7306f4c4 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1337,9 +1337,31 @@ color_is_gray (cairo_color_t *color)
static cairo_bool_t
surface_pattern_supported (const cairo_surface_pattern_t *pattern)
{
- if (pattern->surface->backend->acquire_source_image != NULL)
+ cairo_extend_t extend;
+
+ if (pattern->surface->backend->acquire_source_image == NULL)
+ return FALSE;
+
+ /* Does an ALPHA-only source surface even make sense? Maybe, but I
+ * don't think it's worth the extra code to support it. */
+
+/* XXX: Need to write this function here...
+ content = cairo_surface_get_content (pattern->surface);
+ if (content == CAIRO_CONTENT_ALPHA)
+ return FALSE;
+*/
+
+ extend = cairo_pattern_get_extend (&pattern->base);
+ switch (extend) {
+ case CAIRO_EXTEND_NONE:
+ case CAIRO_EXTEND_REPEAT:
return TRUE;
+ case CAIRO_EXTEND_REFLECT:
+ case CAIRO_EXTEND_PAD:
+ return FALSE;
+ }
+ ASSERT_NOT_REACHED;
return FALSE;
}