mirror of
https://github.com/brl/mutter.git
synced 2024-11-09 23:46:33 -05:00
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:
parent
8b09542fd9
commit
3d89b47757
@ -551,31 +551,19 @@ calculate_scissor_region (cairo_rectangle_int_t *fb_clip_region,
|
||||
int fb_height,
|
||||
cairo_rectangle_int_t *out_scissor_rect)
|
||||
{
|
||||
int scissor_x;
|
||||
int scissor_y;
|
||||
int scissor_width;
|
||||
int scissor_height;
|
||||
*out_scissor_rect = *fb_clip_region;
|
||||
|
||||
scissor_x = fb_clip_region->x;
|
||||
scissor_y = fb_clip_region->y;
|
||||
scissor_width = fb_clip_region->width;
|
||||
scissor_height = fb_clip_region->height;
|
||||
if (subpixel_compensation == 0)
|
||||
return;
|
||||
|
||||
if (fb_clip_region->x > 0)
|
||||
scissor_x += subpixel_compensation;
|
||||
out_scissor_rect->x += subpixel_compensation;
|
||||
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)
|
||||
scissor_width -= 2 * subpixel_compensation;
|
||||
out_scissor_rect->width -= 2 * subpixel_compensation;
|
||||
if (fb_clip_region->y + fb_clip_region->height < fb_height)
|
||||
scissor_height -= 2 * subpixel_compensation;
|
||||
|
||||
*out_scissor_rect = (cairo_rectangle_int_t) {
|
||||
.x = scissor_x,
|
||||
.y = scissor_y,
|
||||
.width = scissor_width,
|
||||
.height = scissor_height
|
||||
};
|
||||
out_scissor_rect->height -= 2 * subpixel_compensation;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
|
Loading…
Reference in New Issue
Block a user