summaryrefslogtreecommitdiff
path: root/src/cairo-rectangle.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-07-22 00:36:03 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-07-26 14:55:58 +0100
commita69335a84eb9225b477cc8c753470eb3805b852c (patch)
tree7a28492ebf390e513391af587f00c017e4ca6301 /src/cairo-rectangle.c
parentc6812c6a3679c3b8b9584e119e0d7fd93e09ae49 (diff)
downloadcairo-a69335a84eb9225b477cc8c753470eb3805b852c.tar.gz
API: map-to-image and create-similar-image
A common requirement is the fast upload of pixel data. In order to allocate the most appropriate image buffer, we need knowledge of the destination. The most obvious example is that we could use a shared-memory region for the image to avoid the transfer cost of uploading the pixels to the X server. Similarly, gl, win32, quartz... The other side of the equation is that for manual modification of a remote surface, it would be more efficient if we can create a similar image to reduce the transfer costs. This strategy is already followed for the destination fallbacks and this merely exposes the same capability for the application fallbacks. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-rectangle.c')
-rw-r--r--src/cairo-rectangle.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cairo-rectangle.c b/src/cairo-rectangle.c
index b0b6d9ec9..edad369bd 100644
--- a/src/cairo-rectangle.c
+++ b/src/cairo-rectangle.c
@@ -298,3 +298,13 @@ _cairo_box_add_curve_to (cairo_box_t *extents,
assert (status == CAIRO_STATUS_SUCCESS);
}
}
+
+void
+_cairo_rectangle_int_from_double (cairo_rectangle_int_t *recti,
+ const cairo_rectangle_t *rectf)
+{
+ recti->x = floor (rectf->x);
+ recti->y = floor (rectf->y);
+ recti->width = ceil (rectf->x + rectf->width) - floor (rectf->x);
+ recti->height = ceil (rectf->y + rectf->height) - floor (rectf->y);
+}