1
0
Fork 0

clutter/stage-cogl: Cleanup the code for scissor region calculation

Ignore the subpixel compensation when this value isn't set, and directly
set the passed rect.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
This commit is contained in:
Marco Trevisan (Treviño) 2019-03-01 02:52:00 +01:00
parent 8b09542fd9
commit 3d89b47757

View file

@ -551,31 +551,19 @@ calculate_scissor_region (cairo_rectangle_int_t *fb_clip_region,
int fb_height, int fb_height,
cairo_rectangle_int_t *out_scissor_rect) cairo_rectangle_int_t *out_scissor_rect)
{ {
int scissor_x; *out_scissor_rect = *fb_clip_region;
int scissor_y;
int scissor_width;
int scissor_height;
scissor_x = fb_clip_region->x; if (subpixel_compensation == 0)
scissor_y = fb_clip_region->y; return;
scissor_width = fb_clip_region->width;
scissor_height = fb_clip_region->height;
if (fb_clip_region->x > 0) if (fb_clip_region->x > 0)
scissor_x += subpixel_compensation; out_scissor_rect->x += subpixel_compensation;
if (fb_clip_region->y > 0) if (fb_clip_region->y > 0)
scissor_y += subpixel_compensation; out_scissor_rect->y += subpixel_compensation;
if (fb_clip_region->x + fb_clip_region->width < fb_width) if (fb_clip_region->x + fb_clip_region->width < fb_width)
scissor_width -= 2 * subpixel_compensation; out_scissor_rect->width -= 2 * subpixel_compensation;
if (fb_clip_region->y + fb_clip_region->height < fb_height) if (fb_clip_region->y + fb_clip_region->height < fb_height)
scissor_height -= 2 * subpixel_compensation; out_scissor_rect->height -= 2 * subpixel_compensation;
*out_scissor_rect = (cairo_rectangle_int_t) {
.x = scissor_x,
.y = scissor_y,
.width = scissor_width,
.height = scissor_height
};
} }
static inline gboolean static inline gboolean