Merge pull request #17 from glyptodon/terminal-regression
GUAC-1008: Properly init clipping rectangle.
This commit is contained in:
commit
e96020e35c
@ -122,6 +122,10 @@ static void __guac_common_clip_rect(guac_common_surface* surface,
|
|||||||
int orig_x = rect->x;
|
int orig_x = rect->x;
|
||||||
int orig_y = rect->y;
|
int orig_y = rect->y;
|
||||||
|
|
||||||
|
/* Skip clipping if no clipping rectangle applied */
|
||||||
|
if (!surface->clipped)
|
||||||
|
return;
|
||||||
|
|
||||||
guac_common_rect_constrain(rect, &surface->clip_rect);
|
guac_common_rect_constrain(rect, &surface->clip_rect);
|
||||||
|
|
||||||
/* Update source X/Y if given */
|
/* Update source X/Y if given */
|
||||||
@ -727,9 +731,9 @@ void guac_common_surface_resize(guac_common_surface* surface, int w, int h) {
|
|||||||
/* Free old data */
|
/* Free old data */
|
||||||
free(old_buffer);
|
free(old_buffer);
|
||||||
|
|
||||||
/* Clip dirty rect */
|
/* Resize dirty rect to fit new surface dimensions */
|
||||||
if (surface->dirty) {
|
if (surface->dirty) {
|
||||||
guac_common_rect_constrain(&surface->dirty_rect, &surface->clip_rect);
|
__guac_common_bound_rect(surface, &surface->dirty_rect, NULL, NULL);
|
||||||
if (surface->dirty_rect.width <= 0 || surface->dirty_rect.height <= 0)
|
if (surface->dirty_rect.width <= 0 || surface->dirty_rect.height <= 0)
|
||||||
surface->dirty = 0;
|
surface->dirty = 0;
|
||||||
}
|
}
|
||||||
@ -923,13 +927,19 @@ void guac_common_surface_clip(guac_common_surface* surface, int x, int y, int w,
|
|||||||
|
|
||||||
guac_common_rect clip;
|
guac_common_rect clip;
|
||||||
|
|
||||||
|
/* Init clipping rectangle if clipping not already applied */
|
||||||
|
if (!surface->clipped) {
|
||||||
|
guac_common_rect_init(&surface->clip_rect, 0, 0, surface->width, surface->height);
|
||||||
|
surface->clipped = 1;
|
||||||
|
}
|
||||||
|
|
||||||
guac_common_rect_init(&clip, x, y, w, h);
|
guac_common_rect_init(&clip, x, y, w, h);
|
||||||
guac_common_rect_constrain(&surface->clip_rect, &clip);
|
guac_common_rect_constrain(&surface->clip_rect, &clip);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guac_common_surface_reset_clip(guac_common_surface* surface) {
|
void guac_common_surface_reset_clip(guac_common_surface* surface) {
|
||||||
guac_common_rect_init(&surface->clip_rect, 0, 0, surface->width, surface->height);
|
surface->clipped = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,6 +105,12 @@ typedef struct guac_common_surface {
|
|||||||
*/
|
*/
|
||||||
int realized;
|
int realized;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether drawing operations are currently clipped by the clipping
|
||||||
|
* rectangle.
|
||||||
|
*/
|
||||||
|
int clipped;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The clipping rectangle.
|
* The clipping rectangle.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user