[cairo] [PATCH] Use surface_transform in replay_and_create_regions
Guillaume Ayoub
guillaume.ayoub at kozea.fr
Wed Jan 13 17:05:53 PST 2016
The surface_transform was already used surface_replay_with_clip, as the
matrix is obviously needed for the clip. But now, because of the
optimization done in commit 09b42c7, it's also needed by
replay_and_create_regions: get_target_extents clips the target surface
for performance issues, and therefore needs the surface_transform matrix
to get the right clipping surface.
Signed-off-by: Guillaume Ayoub <guillaume.ayoub at kozea.fr>
---
src/cairo-analysis-surface.c | 6 ++++--
src/cairo-paginated-surface.c | 2 +-
src/cairo-recording-surface-private.h | 1 +
src/cairo-recording-surface.c | 3 ++-
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/cairo-analysis-surface.c b/src/cairo-analysis-surface.c
index b4069ea..fb5ef0e 100644
--- a/src/cairo-analysis-surface.c
+++ b/src/cairo-analysis-surface.c
@@ -144,7 +144,7 @@ _analyze_recording_surface_pattern (cairo_analysis_surface_t *surface,
const cairo_surface_pattern_t *surface_pattern;
cairo_analysis_surface_t *tmp;
cairo_surface_t *source, *proxy;
- cairo_matrix_t p2d;
+ cairo_matrix_t p2d, surface_transform;
cairo_status_t status, analysis_status;
assert (pattern->type == CAIRO_PATTERN_TYPE_SURFACE);
@@ -171,9 +171,11 @@ _analyze_recording_surface_pattern (cairo_analysis_surface_t *surface,
cairo_matrix_multiply (&tmp->ctm, &p2d, &surface->ctm);
tmp->has_ctm = ! _cairo_matrix_is_identity (&tmp->ctm);
+ surface_transform = tmp->ctm;
+ status = cairo_matrix_invert (&surface_transform);
source = _cairo_surface_get_source (source, NULL);
status = _cairo_recording_surface_replay_and_create_regions (source,
- &tmp->base);
+ &surface_transform, &tmp->base);
analysis_status = tmp->has_unsupported ? CAIRO_INT_STATUS_IMAGE_FALLBACK : CAIRO_INT_STATUS_SUCCESS;
detach_proxy (proxy);
cairo_surface_destroy (&tmp->base);
diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index b81215a..d08a407 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -355,7 +355,7 @@ _paint_page (cairo_paginated_surface_t *surface)
surface->backend->set_paginated_mode (surface->target,
CAIRO_PAGINATED_MODE_ANALYZE);
status = _cairo_recording_surface_replay_and_create_regions (surface->recording_surface,
- analysis);
+ NULL, analysis);
if (status)
goto FAIL;
diff --git a/src/cairo-recording-surface-private.h b/src/cairo-recording-surface-private.h
index 456c633..9f5216d 100644
--- a/src/cairo-recording-surface-private.h
+++ b/src/cairo-recording-surface-private.h
@@ -169,6 +169,7 @@ _cairo_recording_surface_replay_with_clip (cairo_surface_t *surface,
cairo_private cairo_status_t
_cairo_recording_surface_replay_and_create_regions (cairo_surface_t *surface,
+ const cairo_matrix_t *surface_transform,
cairo_surface_t *target);
cairo_private cairo_status_t
_cairo_recording_surface_replay_region (cairo_surface_t *surface,
diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c
index c7cd4a1..94d7a5a 100644
--- a/src/cairo-recording-surface.c
+++ b/src/cairo-recording-surface.c
@@ -2026,9 +2026,10 @@ _cairo_recording_surface_replay_with_clip (cairo_surface_t *surface,
*/
cairo_status_t
_cairo_recording_surface_replay_and_create_regions (cairo_surface_t *surface,
+ const cairo_matrix_t *surface_transform,
cairo_surface_t *target)
{
- return _cairo_recording_surface_replay_internal ((cairo_recording_surface_t *) surface, NULL, NULL,
+ return _cairo_recording_surface_replay_internal ((cairo_recording_surface_t *) surface, NULL, surface_transform,
target, NULL,
CAIRO_RECORDING_CREATE_REGIONS,
CAIRO_RECORDING_REGION_ALL);
--
2.6.4
More information about the cairo
mailing list