cogl-journal: Fix software clipping for non-intersecting rectangles

When the clip contains two rectangles which do not intersect it was
generating a clip bounds where the bottom-right corner was above or to
the left of the top-left corner. This would end up allowing the pixels
between the two rectangles instead of clipping everything like it
should. To fix this there is now an extra check which detects this
situation and just clears the clip bounds to all zeroes in a similar
way to what cogl-clip-stack does.

https://bugzilla.gnome.org/show_bug.cgi?id=659029

Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Neil Roberts 2011-09-14 11:13:30 +01:00
parent 17449423fa
commit e81c1f3e9a

View File

@ -908,6 +908,10 @@ can_software_clip_entry (CoglJournalEntry *journal_entry,
clip_bounds_out->y_2 = MIN (clip_bounds_out->y_2, rect_y2 - ty); clip_bounds_out->y_2 = MIN (clip_bounds_out->y_2, rect_y2 - ty);
} }
if (clip_bounds_out->x_2 <= clip_bounds_out->x_1 ||
clip_bounds_out->y_2 <= clip_bounds_out->y_1)
memset (clip_bounds_out, 0, sizeof (ClipBounds));
return TRUE; return TRUE;
} }