summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2012-01-11 20:51:29 +0100
committerAndrea Canciani <ranma42@gmail.com>2012-05-26 16:06:39 +0200
commit37c5c2dbe55f64ee84ab248eb0072d5d7c5145cc (patch)
treea1631a3506ad30281174e71af86faa007be842e4
parentd6fb8d2134c989d2ad455ec37ce4f623d4769c46 (diff)
surface: Only use non-NULL extents for internal mapping
_cairo_surface_map_to_image() requires the input extents to be non-NULL.
-rw-r--r--src/cairo-gl-operand.c5
-rw-r--r--src/cairo-xlib-source.c13
2 files changed, 14 insertions, 4 deletions
diff --git a/src/cairo-gl-operand.c b/src/cairo-gl-operand.c
index 1c7ad2f5..bbb501e0 100644
--- a/src/cairo-gl-operand.c
+++ b/src/cairo-gl-operand.c
@@ -294,6 +294,7 @@ _cairo_gl_pattern_texture_setup (cairo_gl_operand_t *operand,
cairo_gl_context_t *ctx;
cairo_surface_t *image;
cairo_bool_t src_is_gl_surface = FALSE;
+ cairo_rectangle_int_t map_extents;
if (_src->type == CAIRO_PATTERN_TYPE_SURFACE) {
cairo_surface_t* src_surface = ((cairo_surface_pattern_t *) _src)->surface;
@@ -308,7 +309,9 @@ _cairo_gl_pattern_texture_setup (cairo_gl_operand_t *operand,
_cairo_gl_surface_create_scratch (ctx,
CAIRO_CONTENT_COLOR_ALPHA,
extents->width, extents->height);
- image = cairo_surface_map_to_image (&surface->base, NULL);
+ map_extents = *extents;
+ map_extents.x = map_extents.y = 0;
+ image = cairo_surface_map_to_image (&surface->base, &map_extents);
/* If the pattern is a GL surface, it belongs to some other GL context,
so we need to release this device while we paint it to the image. */
diff --git a/src/cairo-xlib-source.c b/src/cairo-xlib-source.c
index f8dac70b..dec76222 100644
--- a/src/cairo-xlib-source.c
+++ b/src/cairo-xlib-source.c
@@ -261,6 +261,7 @@ render_pattern (cairo_xlib_surface_t *dst,
cairo_xlib_surface_t *src;
cairo_surface_t *image;
cairo_status_t status;
+ cairo_rectangle_int_t map_extents;
src = (cairo_xlib_surface_t *)
_cairo_surface_create_similar_scratch (&dst->base,
@@ -272,7 +273,10 @@ render_pattern (cairo_xlib_surface_t *dst,
return None;
}
- image = cairo_surface_map_to_image (&src->base, NULL);
+ map_extents = *extents;
+ map_extents.x = map_extents.y = 0;
+
+ image = cairo_surface_map_to_image (&src->base, &map_extents);
status = _cairo_surface_offset_paint (image, extents->x, extents->y,
CAIRO_OPERATOR_SOURCE, pattern,
NULL);
@@ -912,7 +916,7 @@ surface_source (cairo_xlib_surface_t *dst,
cairo_surface_t *image;
cairo_surface_pattern_t local_pattern;
cairo_status_t status;
- cairo_rectangle_int_t upload, limit;
+ cairo_rectangle_int_t upload, limit, map_extents;
cairo_matrix_t m;
upload = *sample;
@@ -939,7 +943,10 @@ surface_source (cairo_xlib_surface_t *dst,
cairo_matrix_init_translate (&local_pattern.base.matrix,
upload.x, upload.y);
- image = cairo_surface_map_to_image (&src->base, NULL);
+ map_extents = upload;
+ map_extents.x = map_extents.y = 0;
+
+ image = cairo_surface_map_to_image (&src->base, &map_extents);
status = _cairo_surface_paint (image,
CAIRO_OPERATOR_SOURCE,
&local_pattern.base,