From 1d696c6bfa2ccfd6a3655602593dd3dff968aebe Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 24 Jun 2019 16:01:54 +0200 Subject: [PATCH] Remove max area parameter from Region::get_rects() It was unused and added complexity and bugs to the code. So let's remove it rather than trying to clean up a function no one needed. --- common/rfb/Region.cxx | 15 ++++----------- common/rfb/Region.h | 2 +- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/common/rfb/Region.cxx b/common/rfb/Region.cxx index beca482d..e3d06428 100644 --- a/common/rfb/Region.cxx +++ b/common/rfb/Region.cxx @@ -185,7 +185,7 @@ int rfb::Region::numRects() const { } bool rfb::Region::get_rects(std::vector* rects, - bool left2right, bool topdown, int maxArea) const + bool left2right, bool topdown) const { int nRects = xrgn->numRects; int xInc = left2right ? 1 : -1; @@ -209,16 +209,9 @@ bool rfb::Region::get_rects(std::vector* rects, i = firstInNextBand - yInc; while (nRectsInBand > 0) { - int y = xrgn->rects[i].y1; - int h = maxArea / (xrgn->rects[i].x2 - xrgn->rects[i].x1); - if (!h) h = xrgn->rects[i].y2 - y; - do { - if (h > xrgn->rects[i].y2 - y) - h = xrgn->rects[i].y2 - y; - Rect r(xrgn->rects[i].x1, y, xrgn->rects[i].x2, y+h); - rects->push_back(r); - y += h; - } while (y < xrgn->rects[i].y2); + Rect r(xrgn->rects[i].x1, xrgn->rects[i].y1, + xrgn->rects[i].x2, xrgn->rects[i].y2); + rects->push_back(r); i += xInc; nRectsInBand--; } diff --git a/common/rfb/Region.h b/common/rfb/Region.h index 9e53d362..7cc0eaa8 100644 --- a/common/rfb/Region.h +++ b/common/rfb/Region.h @@ -68,7 +68,7 @@ namespace rfb { bool is_empty() const { return numRects() == 0; } bool get_rects(std::vector* rects, bool left2right=true, - bool topdown=true, int maxArea=0) const; + bool topdown=true) const; Rect get_bounding_rect() const; void debug_print(const char *prefix) const; -- 2.39.5