From 83beccf7e44b93e426d3b30de54156240bcdfd40 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 28 Feb 2016 00:52:57 -0800 Subject: [PATCH] GUAC-236: Ensure rectangle is explicitly set when painting buffers. --- src/guacenc/buffer.c | 2 +- src/guacenc/image-stream.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/guacenc/buffer.c b/src/guacenc/buffer.c index 379cd9ee..716a0411 100644 --- a/src/guacenc/buffer.c +++ b/src/guacenc/buffer.c @@ -96,8 +96,8 @@ int guacenc_buffer_resize(guacenc_buffer* buffer, int width, int height) { /* Copy old surface, if defined */ if (buffer->surface != NULL) { cairo_set_source_surface(cairo, buffer->surface, 0, 0); + cairo_rectangle(cairo, 0, 0, width, height); cairo_paint(cairo); - cairo_set_source_rgba(cairo, 0.0, 0.0, 0.0, 1.0); } /* Update properties */ diff --git a/src/guacenc/image-stream.c b/src/guacenc/image-stream.c index 02872cd1..b59ec71e 100644 --- a/src/guacenc/image-stream.c +++ b/src/guacenc/image-stream.c @@ -134,8 +134,16 @@ int guacenc_image_stream_end(guacenc_image_stream* stream, /* Draw surface to buffer */ if (buffer->cairo != NULL) { + + /* Get surface dimensions */ + int width = cairo_image_surface_get_width(surface); + int height = cairo_image_surface_get_height(surface); + + /* Paint surface contents to buffer */ cairo_set_source_surface(buffer->cairo, surface, stream->x, stream->y); + cairo_rectangle(buffer->cairo, stream->x, stream->y, width, height); cairo_fill(buffer->cairo); + } cairo_surface_destroy(surface);