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

} }


bool rfb::Region::get_rects(std::vector<Rect>* rects, 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 nRects = xrgn->numRects;
int xInc = left2right ? 1 : -1; int xInc = left2right ? 1 : -1;
i = firstInNextBand - yInc; i = firstInNextBand - yInc;


while (nRectsInBand > 0) { 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; i += xInc;
nRectsInBand--; nRectsInBand--;
} }

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

bool is_empty() const { return numRects() == 0; } bool is_empty() const { return numRects() == 0; }


bool get_rects(std::vector<Rect>* rects, bool left2right=true, 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; Rect get_bounding_rect() const;


void debug_print(const char *prefix) const; void debug_print(const char *prefix) const;

Loading…
Cancel
Save