From 15cfed465c6d1d94dd8bc9346af70adcc00707a2 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Fri, 27 Jun 2003 06:21:50 +0000 Subject: [PATCH] Fixed sort_rects(). Rects are sorted by their top value, not by their left as I tought in the first place. I had already fixed or_region_no_x, I just forgot to update sort_rects(). Fixed a typing bug in PrintToStream(). Added a comment. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3689 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Region.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/kits/interface/Region.cpp b/src/kits/interface/Region.cpp index 3af118f4e2..fe17de757e 100644 --- a/src/kits/interface/Region.cpp +++ b/src/kits/interface/Region.cpp @@ -49,6 +49,7 @@ cleanup_region(BRegion *region) } +// Sort the given rects by their top value void sort_rects(clipping_rect *rects, long count) { @@ -56,7 +57,7 @@ sort_rects(clipping_rect *rects, long count) bool again; //flag that tells we changed rects positions if (count == 2) { - if (rects[0].left > rects[1].left) { + if (rects[0].top > rects[1].top) { clipping_rect tmp = rects[0]; rects[0] = rects[1]; rects[1] = tmp; @@ -65,7 +66,7 @@ sort_rects(clipping_rect *rects, long count) do { again = false; for (int c = 1; c < count; c++) { - if (rects[c - 1].left > rects[c].left) { + if (rects[c - 1].top > rects[c].top) { clipping_rect tmp = rects[c - 1]; rects[c - 1] = rects[c]; rects[c] = tmp; @@ -557,7 +558,7 @@ BRegion::PrintToStream() const for (int c = 0; c < count; c++) { clipping_rect *rect = &data[c]; - printf("data = BRect(l:%ld, t:%ld.0, r:%ld.0, b:%ld.0)\n", + printf("data = BRect(l:%ld.0, t:%ld.0, r:%ld.0, b:%ld.0)\n", rect->left, rect->top, rect->right, rect->bottom); } }