Browse Source

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.
tags/v1.9.90
Pierre Ossman 4 years ago
parent
commit
1d696c6bfa
2 changed files with 5 additions and 12 deletions
  1. 4
    11
      common/rfb/Region.cxx
  2. 1
    1
      common/rfb/Region.h

+ 4
- 11
common/rfb/Region.cxx View File

@@ -185,7 +185,7 @@ int rfb::Region::numRects() const {
}

bool rfb::Region::get_rects(std::vector<Rect>* 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<Rect>* 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--;
}

+ 1
- 1
common/rfb/Region.h View File

@@ -68,7 +68,7 @@ namespace rfb {
bool is_empty() const { return numRects() == 0; }

bool get_rects(std::vector<Rect>* 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;

Loading…
Cancel
Save