frames: Simplify the clip region calculation

Since GTK+ already clips to the extended region for us, there's no need
to combine the two. This does lose the fast-path, but I don't actually
expect this to fire, as when we're composited, we really won't ever get
partial exposes.
This commit is contained in:
Jasper St. Pierre 2014-06-21 13:40:00 -04:00
parent 4f9b994e73
commit ff8d5281f0

View File

@ -1580,9 +1580,8 @@ meta_frames_destroy_event (GtkWidget *widget,
} }
static void static cairo_region_t *
clip_region_to_visible_frame_border (cairo_region_t *region, get_visible_frame_border_region (MetaUIFrame *frame)
MetaUIFrame *frame)
{ {
MetaRectangle frame_rect; MetaRectangle frame_rect;
cairo_rectangle_int_t area; cairo_rectangle_int_t area;
@ -1620,9 +1619,7 @@ clip_region_to_visible_frame_border (cairo_region_t *region,
/* Visible frame border */ /* Visible frame border */
cairo_region_subtract_rectangle (frame_border, &area); cairo_region_subtract_rectangle (frame_border, &area);
cairo_region_intersect (region, frame_border); return frame_border;
cairo_region_destroy (frame_border);
} }
#define TAU (2*M_PI) #define TAU (2*M_PI)
@ -1744,28 +1741,19 @@ meta_frames_draw (GtkWidget *widget,
{ {
MetaUIFrame *frame; MetaUIFrame *frame;
MetaFrames *frames; MetaFrames *frames;
cairo_rectangle_int_t clip;
cairo_region_t *region; cairo_region_t *region;
frames = META_FRAMES (widget); frames = META_FRAMES (widget);
gdk_cairo_get_clip_rectangle (cr, &clip);
frame = find_frame_to_draw (frames, cr); frame = find_frame_to_draw (frames, cr);
if (frame == NULL) if (frame == NULL)
return FALSE; return FALSE;
region = cairo_region_create_rectangle (&clip); region = get_visible_frame_border_region (frame);
clip_region_to_visible_frame_border (region, frame);
if (cairo_region_is_empty (region))
goto out;
gdk_cairo_region (cr, region); gdk_cairo_region (cr, region);
cairo_clip (cr); cairo_clip (cr);
meta_frames_paint (frames, frame, cr); meta_frames_paint (frames, frame, cr);
out:
cairo_region_destroy (region); cairo_region_destroy (region);
return TRUE; return TRUE;