GUAC-687: Only update backing surface first if the destination rect cannot intersect the source rect.

This commit is contained in:
Michael Jumper 2014-05-12 14:43:50 -07:00
parent 3e0828d6da
commit cad60299e1

View File

@ -790,10 +790,12 @@ void guac_common_surface_copy(guac_common_surface* src, int sx, int sy, int w, i
if (rect.width <= 0 || rect.height <= 0)
return;
/* Update backing surface */
__guac_common_surface_transfer(src, &sx, &sy, GUAC_TRANSFER_BINARY_SRC, dst, &rect);
if (rect.width <= 0 || rect.height <= 0)
return;
/* Update backing surface first only if destination rect cannot intersect source rect */
if (src != dst) {
__guac_common_surface_transfer(src, &sx, &sy, GUAC_TRANSFER_BINARY_SRC, dst, &rect);
if (rect.width <= 0 || rect.height <= 0)
return;
}
/* Defer if combining */
if (__guac_common_should_combine(dst, &rect, 1))
@ -808,6 +810,10 @@ void guac_common_surface_copy(guac_common_surface* src, int sx, int sy, int w, i
dst->realized = 1;
}
/* Update backing surface last if destination rect can intersect source rect */
if (src == dst)
__guac_common_surface_transfer(src, &sx, &sy, GUAC_TRANSFER_BINARY_SRC, dst, &rect);
}
void guac_common_surface_transfer(guac_common_surface* src, int sx, int sy, int w, int h,
@ -825,10 +831,12 @@ void guac_common_surface_transfer(guac_common_surface* src, int sx, int sy, int
if (rect.width <= 0 || rect.height <= 0)
return;
/* Update backing surface */
__guac_common_surface_transfer(src, &sx, &sy, op, dst, &rect);
if (rect.width <= 0 || rect.height <= 0)
return;
/* Update backing surface first only if destination rect cannot intersect source rect */
if (src != dst) {
__guac_common_surface_transfer(src, &sx, &sy, op, dst, &rect);
if (rect.width <= 0 || rect.height <= 0)
return;
}
/* Defer if combining */
if (__guac_common_should_combine(dst, &rect, 1))
@ -842,6 +850,10 @@ void guac_common_surface_transfer(guac_common_surface* src, int sx, int sy, int
dst->realized = 1;
}
/* Update backing surface last if destination rect can intersect source rect */
if (src == dst)
__guac_common_surface_transfer(src, &sx, &sy, op, dst, &rect);
}
void guac_common_surface_rect(guac_common_surface* surface,