[cairo-commit] 3 commits - src/cairo-paginated-surface.c src/cairo-svg-surface.c
Chris Wilson
ickle at kemper.freedesktop.org
Sun Sep 28 09:11:50 PDT 2008
src/cairo-paginated-surface.c | 23 ++++++++++++++---------
src/cairo-svg-surface.c | 30 +++++++++++++++++++-----------
2 files changed, 33 insertions(+), 20 deletions(-)
New commits:
commit cff3bcba68233101c5518801b64e37d2f0e70ae8
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Sep 28 17:06:32 2008 +0100
[svg] Check that the mask is supported.
During the analyze phase we also need to check whether we can emit the mask
without requiring fallbacks.
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 4b08a80..b6fc4f6 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -2083,10 +2083,23 @@ _cairo_svg_surface_mask (void *abstract_surface,
cairo_bool_t discard_filter = FALSE;
unsigned int mask_id;
- if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
- return _cairo_svg_surface_analyze_operation (surface, op, source);
+ if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) {
+ cairo_status_t source_status, mask_status;
+
+ source_status = _cairo_svg_surface_analyze_operation (surface, op, source);
+ if (_cairo_status_is_error (source_status))
+ return source_status;
+
+ mask_status = _cairo_svg_surface_analyze_operation (surface, op, mask);
+ if (_cairo_status_is_error (mask_status))
+ return mask_status;
+
+ return _cairo_analysis_surface_merge_status (source_status,
+ mask_status);
+ }
assert (_cairo_svg_surface_operation_supported (surface, op, source));
+ assert (_cairo_svg_surface_operation_supported (surface, CAIRO_OPERATOR_OVER, mask));
if (cairo_pattern_get_type (mask) == CAIRO_PATTERN_TYPE_SURFACE) {
cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t*) mask;
commit 8ad3031359d74bdff4b1e3ef8d0af047821f1795
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Sep 28 17:04:15 2008 +0100
[svg] Enable the assertion that paint() is supported.
The XXX comment before the disabled assert is misleading as the final
fallback image paint operation should never trigger UNSUPPORTED.
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 5c1498a..4b08a80 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -802,8 +802,11 @@ _cairo_svg_surface_analyze_operation (cairo_svg_surface_t *surface,
{
cairo_svg_document_t *document = surface->document;
- if (surface->force_fallbacks)
+ if (surface->force_fallbacks &&
+ surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
+ {
return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
/* SVG doesn't support extend reflect for image pattern */
if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE &&
@@ -2022,15 +2025,7 @@ _cairo_svg_surface_paint (void *abstract_surface,
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
return _cairo_svg_surface_analyze_operation (surface, op, source);
- /* XXX: It would be nice to be able to assert this condition
- * here. But, we actually allow one 'cheat' that is used when
- * painting the final image-based fallbacks. The final fallbacks
- * do have alpha which we support by blending with white. This is
- * possible only because there is nothing between the fallback
- * images and the paper, nor is anything painted above. */
- /*
assert (_cairo_svg_surface_operation_supported (surface, op, source));
- */
/* Emulation of clear and source operators, when no clipping region
* is defined. We just delete existing content of surface root node,
commit 95e637f9ac9e4256f7ba73e8f048f8e559631c82
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Sep 28 16:54:59 2008 +0100
[paginated] Set paginated mode before every replay.
Previously we were replaying full page fallbacks without updating the
mode - this was upsetting SVG.
diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index 5b1a08f..e4e84d5 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -299,8 +299,10 @@ _paint_page (cairo_paginated_surface_t *surface)
if (analysis->status)
return _cairo_surface_set_error (surface->target, analysis->status);
- surface->backend->set_paginated_mode (surface->target, CAIRO_PAGINATED_MODE_ANALYZE);
- status = _cairo_meta_surface_replay_and_create_regions (surface->meta, analysis);
+ surface->backend->set_paginated_mode (surface->target,
+ CAIRO_PAGINATED_MODE_ANALYZE);
+ status = _cairo_meta_surface_replay_and_create_regions (surface->meta,
+ analysis);
if (status || analysis->status) {
if (status == CAIRO_STATUS_SUCCESS)
status = analysis->status;
@@ -325,8 +327,6 @@ _paint_page (cairo_paginated_surface_t *surface)
goto FAIL;
}
- surface->backend->set_paginated_mode (surface->target, CAIRO_PAGINATED_MODE_RENDER);
-
/* Finer grained fallbacks are currently only supported for some
* surface types */
switch (surface->target->type) {
@@ -362,6 +362,9 @@ _paint_page (cairo_paginated_surface_t *surface)
}
if (has_supported) {
+ surface->backend->set_paginated_mode (surface->target,
+ CAIRO_PAGINATED_MODE_RENDER);
+
status = _cairo_meta_surface_replay_region (surface->meta,
surface->target,
CAIRO_META_REGION_NATIVE);
@@ -370,10 +373,12 @@ _paint_page (cairo_paginated_surface_t *surface)
goto FAIL;
}
- if (has_page_fallback)
- {
+ if (has_page_fallback) {
cairo_box_int_t box;
+ surface->backend->set_paginated_mode (surface->target,
+ CAIRO_PAGINATED_MODE_FALLBACK);
+
box.p1.x = 0;
box.p1.y = 0;
box.p2.x = surface->width;
@@ -383,13 +388,13 @@ _paint_page (cairo_paginated_surface_t *surface)
goto FAIL;
}
- if (has_finegrained_fallback)
- {
+ if (has_finegrained_fallback) {
cairo_region_t *region;
cairo_box_int_t *boxes;
int num_boxes, i;
- surface->backend->set_paginated_mode (surface->target, CAIRO_PAGINATED_MODE_FALLBACK);
+ surface->backend->set_paginated_mode (surface->target,
+ CAIRO_PAGINATED_MODE_FALLBACK);
/* Reset clip region before drawing the fall back images */
status = _cairo_surface_intersect_clip_path (surface->target,
More information about the cairo-commit
mailing list