GUAC-662: Updates to backing surface should happen AFTER possible flushes.

This commit is contained in:
Michael Jumper 2014-05-01 10:25:54 -07:00
parent 25784acc6f
commit d4aed54ca4

View File

@ -273,13 +273,6 @@ void guac_common_surface_draw(guac_common_surface* surface, int x, int y, cairo_
int w = cairo_image_surface_get_width(src); int w = cairo_image_surface_get_width(src);
int h = cairo_image_surface_get_height(src); int h = cairo_image_surface_get_height(src);
/* Update backing surface */
cairo_save(surface->cairo);
cairo_set_source_surface(surface->cairo, src, x, y);
cairo_rectangle(surface->cairo, x, y, w, h);
cairo_fill(surface->cairo);
cairo_restore(surface->cairo);
/* Flush if not combining */ /* Flush if not combining */
if (!__guac_common_should_combine(surface, x, y, w, h)) if (!__guac_common_should_combine(surface, x, y, w, h))
guac_common_surface_flush(surface); guac_common_surface_flush(surface);
@ -287,6 +280,13 @@ void guac_common_surface_draw(guac_common_surface* surface, int x, int y, cairo_
/* Always defer draws */ /* Always defer draws */
__guac_common_mark_dirty(surface, x, y, w, h); __guac_common_mark_dirty(surface, x, y, w, h);
/* Update backing surface */
cairo_save(surface->cairo);
cairo_set_source_surface(surface->cairo, src, x, y);
cairo_rectangle(surface->cairo, x, y, w, h);
cairo_fill(surface->cairo);
cairo_restore(surface->cairo);
} }
void guac_common_surface_copy(guac_common_surface* src, int sx, int sy, int w, int h, void guac_common_surface_copy(guac_common_surface* src, int sx, int sy, int w, int h,
@ -296,11 +296,6 @@ void guac_common_surface_copy(guac_common_surface* src, int sx, int sy, int w, i
const guac_layer* src_layer = src->layer; const guac_layer* src_layer = src->layer;
const guac_layer* dst_layer = dst->layer; const guac_layer* dst_layer = dst->layer;
/* Update backing surface */
cairo_surface_flush(src->surface);
cairo_surface_flush(dst->surface);
__guac_common_surface_transfer(src, sx, sy, w, h, GUAC_TRANSFER_BINARY_SRC, dst, dx, dy);
/* Defer if combining */ /* Defer if combining */
if (__guac_common_should_combine(dst, dx, dy, w, h)) if (__guac_common_should_combine(dst, dx, dy, w, h))
__guac_common_mark_dirty(dst, dx, dy, w, h); __guac_common_mark_dirty(dst, dx, dy, w, h);
@ -312,6 +307,11 @@ void guac_common_surface_copy(guac_common_surface* src, int sx, int sy, int w, i
guac_protocol_send_copy(socket, src_layer, sx, sy, w, h, GUAC_COMP_OVER, dst_layer, dx, dy); guac_protocol_send_copy(socket, src_layer, sx, sy, w, h, GUAC_COMP_OVER, dst_layer, dx, dy);
} }
/* Update backing surface */
cairo_surface_flush(src->surface);
cairo_surface_flush(dst->surface);
__guac_common_surface_transfer(src, sx, sy, w, h, GUAC_TRANSFER_BINARY_SRC, dst, dx, dy);
} }
void guac_common_surface_transfer(guac_common_surface* src, int sx, int sy, int w, int h, void guac_common_surface_transfer(guac_common_surface* src, int sx, int sy, int w, int h,
@ -321,11 +321,6 @@ void guac_common_surface_transfer(guac_common_surface* src, int sx, int sy, int
const guac_layer* src_layer = src->layer; const guac_layer* src_layer = src->layer;
const guac_layer* dst_layer = dst->layer; const guac_layer* dst_layer = dst->layer;
/* Update backing surface */
cairo_surface_flush(src->surface);
cairo_surface_flush(dst->surface);
__guac_common_surface_transfer(src, sx, sy, w, h, op, dst, dx, dy);
/* Defer if combining */ /* Defer if combining */
if (__guac_common_should_combine(dst, dx, dy, w, h)) if (__guac_common_should_combine(dst, dx, dy, w, h))
__guac_common_mark_dirty(dst, dx, dy, w, h); __guac_common_mark_dirty(dst, dx, dy, w, h);
@ -337,6 +332,11 @@ void guac_common_surface_transfer(guac_common_surface* src, int sx, int sy, int
guac_protocol_send_transfer(socket, src_layer, sx, sy, w, h, op, dst_layer, dx, dy); guac_protocol_send_transfer(socket, src_layer, sx, sy, w, h, op, dst_layer, dx, dy);
} }
/* Update backing surface */
cairo_surface_flush(src->surface);
cairo_surface_flush(dst->surface);
__guac_common_surface_transfer(src, sx, sy, w, h, op, dst, dx, dy);
} }
void guac_common_surface_rect(guac_common_surface* surface, void guac_common_surface_rect(guac_common_surface* surface,
@ -346,13 +346,6 @@ void guac_common_surface_rect(guac_common_surface* surface,
guac_socket* socket = surface->socket; guac_socket* socket = surface->socket;
const guac_layer* layer = surface->layer; const guac_layer* layer = surface->layer;
/* Update backing surface */
cairo_save(surface->cairo);
cairo_set_source_rgb(surface->cairo, red, green, blue);
cairo_rectangle(surface->cairo, x, y, w, h);
cairo_fill(surface->cairo);
cairo_restore(surface->cairo);
/* Defer if combining */ /* Defer if combining */
if (__guac_common_should_combine(surface, x, y, w, h)) if (__guac_common_should_combine(surface, x, y, w, h))
__guac_common_mark_dirty(surface, x, y, w, h); __guac_common_mark_dirty(surface, x, y, w, h);
@ -364,6 +357,13 @@ void guac_common_surface_rect(guac_common_surface* surface,
guac_protocol_send_cfill(socket, GUAC_COMP_OVER, layer, red, green, blue, 0xFF); guac_protocol_send_cfill(socket, GUAC_COMP_OVER, layer, red, green, blue, 0xFF);
} }
/* Update backing surface */
cairo_save(surface->cairo);
cairo_set_source_rgb(surface->cairo, red, green, blue);
cairo_rectangle(surface->cairo, x, y, w, h);
cairo_fill(surface->cairo);
cairo_restore(surface->cairo);
} }
void guac_common_surface_flush(guac_common_surface* surface) { void guac_common_surface_flush(guac_common_surface* surface) {