GUACAMOLE-249: Defer draws to unrealized (server-side) buffers until they are actually needed client-side.
Though deferred creation of buffers is already intended, creation was not actually being deferred in practice as the act of initializing the buffer with a solid rect of color was causing the buffer to be realized, even if that initialization process is the only drawing operation that will ever occur to that buffer.
This commit is contained in:
parent
2d4412316f
commit
36f227586e
@ -260,22 +260,33 @@ static int __guac_common_surface_is_opaque(guac_common_surface* surface,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the given rectangle should be combined into the existing
|
* Returns whether the given rectangle should be combined into the existing
|
||||||
* dirty rectangle, to be eventually flushed as a "png" instruction.
|
* dirty rectangle, to be eventually flushed as image data, or would be best
|
||||||
|
* kept independent of the current rectangle.
|
||||||
*
|
*
|
||||||
* @param surface The surface to be queried.
|
* @param surface
|
||||||
* @param rect The update rectangle.
|
* The surface being updated.
|
||||||
* @param rect_only Non-zero if this update, by its nature, contains only
|
*
|
||||||
* metainformation about the update's rectangle, zero if
|
* @param rect
|
||||||
* the update also contains image data.
|
* The bounding rectangle of the updating being made to the surface.
|
||||||
* @return Non-zero if the update should be combined with any existing update,
|
*
|
||||||
* zero otherwise.
|
* @param rect_only
|
||||||
|
* Non-zero if this update, by its nature, contains only metainformation
|
||||||
|
* about the update's bounding rectangle, zero if the update also contains
|
||||||
|
* image data.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* Non-zero if the update should be combined with any existing update, zero
|
||||||
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
static int __guac_common_should_combine(guac_common_surface* surface, const guac_common_rect* rect, int rect_only) {
|
static int __guac_common_should_combine(guac_common_surface* surface, const guac_common_rect* rect, int rect_only) {
|
||||||
|
|
||||||
if (surface->dirty) {
|
|
||||||
|
|
||||||
int combined_cost, dirty_cost, update_cost;
|
int combined_cost, dirty_cost, update_cost;
|
||||||
|
|
||||||
|
/* Always favor combining updates if surface is currently a purely
|
||||||
|
* server-side scratch area */
|
||||||
|
if (!surface->realized)
|
||||||
|
return 1;
|
||||||
|
|
||||||
/* Simulate combination */
|
/* Simulate combination */
|
||||||
guac_common_rect combined = surface->dirty_rect;
|
guac_common_rect combined = surface->dirty_rect;
|
||||||
guac_common_rect_extend(&combined, rect);
|
guac_common_rect_extend(&combined, rect);
|
||||||
@ -310,8 +321,6 @@ static int __guac_common_should_combine(guac_common_surface* surface, const guac
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Otherwise, do not combine */
|
/* Otherwise, do not combine */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user