ui: Clip the region once, not every rectangle manually

https://bugzilla.gnome.org/show_bug.cgi?id=630203
This commit is contained in:
Benjamin Otte 2010-09-16 14:23:19 +02:00
parent beb65f011d
commit 3f8e6020f7

View File

@ -2500,12 +2500,6 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
meta_region_subtract (edges, tmp_region); meta_region_subtract (edges, tmp_region);
meta_region_destroy (tmp_region); meta_region_destroy (tmp_region);
/* Now draw remaining portion of region */
meta_region_get_rectangles (edges, &areas, &n_areas);
for (i = 0; i < n_areas; i++)
{
/* Bug 399529: clamp areas[i] so that it doesn't go too far /* Bug 399529: clamp areas[i] so that it doesn't go too far
* off the edge of the screen. This works around a GDK bug * off the edge of the screen. This works around a GDK bug
* which makes gdk_window_begin_paint_rect cause an X error * which makes gdk_window_begin_paint_rect cause an X error
@ -2515,13 +2509,20 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
* because it attempted to decorate the silly window. * because it attempted to decorate the silly window.
*/ */
areas[i].x = MAX (areas[i].x, -DECORATING_BORDER); area.x = -DECORATING_BORDER;
areas[i].y = MAX (areas[i].y, -DECORATING_BORDER); area.y = -DECORATING_BORDER;
if (areas[i].x+areas[i].width > screen_width + DECORATING_BORDER) area.width = screen_width + 2 * DECORATING_BORDER;
areas[i].width = MIN (0, screen_width - areas[i].x); area.height = screen_height + 2 * DECORATING_BORDER;
if (areas[i].y+areas[i].height > screen_height + DECORATING_BORDER) tmp_region = meta_region_new_from_rectangle (&area);
areas[i].height = MIN (0, screen_height - areas[i].y); meta_region_intersect (edges, tmp_region);
meta_region_destroy (tmp_region);
/* Now draw remaining portion of region */
meta_region_get_rectangles (edges, &areas, &n_areas);
for (i = 0; i < n_areas; i++)
{
/* Okay, so let's start painting. */ /* Okay, so let's start painting. */
gdk_window_begin_paint_rect (drawable, &areas[i]); gdk_window_begin_paint_rect (drawable, &areas[i]);