summaryrefslogtreecommitdiff
path: root/src/cairo-clip-boxes.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-07-23 12:19:17 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-07-23 15:33:14 +0100
commita30a7402f73485dabdb6a016178247f9844017a1 (patch)
tree54a047cbed002b2ff4c83a305019b503314da882 /src/cairo-clip-boxes.c
parentbff8e22eb6b7faeac04ca585cb739e7880a3335c (diff)
downloadcairo-a30a7402f73485dabdb6a016178247f9844017a1.tar.gz
image: replay the recording surface directly onto the target
백현기 reported a use-case where he was recording an entire web-page onto the recording surface, in order to facilitate panning. In this scenario, where there may be lots of similar surfaces within the recording we generate thousands of unused snapshot-images bloating memory usage and impairing performance. Under the right conditions we can replay directly onto the destination which not only bypasses the snapshots but also skips the following resampling. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-clip-boxes.c')
-rw-r--r--src/cairo-clip-boxes.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/cairo-clip-boxes.c b/src/cairo-clip-boxes.c
index 95ed265bf..98d1a18b0 100644
--- a/src/cairo-clip-boxes.c
+++ b/src/cairo-clip-boxes.c
@@ -560,3 +560,20 @@ _cairo_clip_to_boxes (cairo_clip_t *clip,
return CAIRO_STATUS_SUCCESS;
}
+
+cairo_clip_t *
+_cairo_clip_from_boxes (const cairo_boxes_t *boxes)
+{
+ cairo_clip_t *clip = _cairo_clip_create ();
+ if (clip == NULL)
+ return _cairo_clip_set_all_clipped (clip);
+
+ /* XXX cow-boxes? */
+ clip->boxes = _cairo_boxes_to_array (boxes, &clip->num_boxes, TRUE);
+ if (clip->boxes == NULL)
+ return _cairo_clip_set_all_clipped (clip);
+
+ _cairo_boxes_extents (boxes, &clip->extents);
+
+ return clip;
+}