[PATCH] [cairo-xlib] Clone a subsurface from the image source.

Chris Wilson chris at chris-wilson.co.uk
Tue Apr 8 00:02:23 PDT 2008


Restrict the size of cloned similar surface to that of the active area.
---
 src/cairo-xlib-surface.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index a957d57..454095b 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -1064,22 +1064,24 @@ _cairo_xlib_surface_clone_similar (void			*abstract_surface,
 	    return CAIRO_INT_STATUS_UNSUPPORTED;
 
 	/* XXX BadAlloc await - https://bugzilla.mozilla.org/show_bug.cgi?id=424333 */
-	if (image_src->width > INT16_MAX || image_src->height > INT16_MAX)
+	if (width > INT16_MAX || height > INT16_MAX)
 	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 
 	clone = (cairo_xlib_surface_t *)
 	    _cairo_xlib_surface_create_similar_with_format (surface,
 		                                            image_src->format,
-							    image_src->width,
-							    image_src->height);
+							    width,
+							    height);
 	if (clone == NULL)
 	    return CAIRO_INT_STATUS_UNSUPPORTED;
 
 	if (clone->base.status)
 	    return clone->base.status;
 
-	status = _draw_image_surface (clone, image_src, src_x, src_y,
-			              width, height, src_x, src_y);
+	status = _draw_image_surface (clone, image_src,
+				      src_x, src_y,
+			              width, height,
+				      0, 0);
 	if (status) {
 	    cairo_surface_destroy (&clone->base);
 	    return status;
-- 
1.5.4.5


--=-fn1OCLrMEL6CA85ai4ve
Content-Disposition: attachment; filename=0003-cairo-xlib-Guard-the-public-entry-points-against-m.patch
Content-Type: application/mbox; name=0003-cairo-xlib-Guard-the-public-entry-points-against-m.patch
Content-Transfer-Encoding: 7bit



More information about the cairo mailing list