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



commit e81c1f3e9a199dbd738f335339e2e592f92cae5c
Author: Neil Roberts <neil linux intel com>
Date:   Wed Sep 14 11:13:30 2011 +0100

    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>

 cogl/cogl-journal.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/cogl/cogl-journal.c b/cogl/cogl-journal.c
index c58328c..ad07108 100644
--- a/cogl/cogl-journal.c
+++ b/cogl/cogl-journal.c
@@ -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);
     }
 
+  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;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]