| 32 | } |
| 33 | |
| 34 | ScreenArea * PegasusDistributor::next() { |
| 35 | const double thikness = 0.15; |
| 36 | double x, y; |
| 37 | |
| 38 | if (_dx == 0 && _dy == 0) { |
| 39 | _dx = 0; |
| 40 | _dy = -1; |
| 41 | _width = thikness; |
| 42 | _height = 1.0f / areaCountOnSideEdge(); |
| 43 | x = 1.0f - _width; |
| 44 | y = 1.0f - _height; |
| 45 | } else if (_dy < 0 && cmp(_currentArea->vScanStart(), 0.0, .01) <= 0) { |
| 46 | cleanCurrentArea(); |
| 47 | _dx = 0; |
| 48 | _dy = 1; |
| 49 | _width = thikness; |
| 50 | _height = 1.0 / areaCountOnSideEdge(); |
| 51 | x = 0.0; |
| 52 | y = 0.0; |
| 53 | } |
| 54 | |
| 55 | ScreenArea *result = NULL; |
| 56 | if (!_currentArea) { |
| 57 | result = new ScreenArea( x, x + _width, y, y + _height); |
| 58 | } else { |
| 59 | ScreenArea *cf = _currentArea; |
| 60 | double dx = _width * (double)_dx; |
| 61 | double dy = _height * (double)_dy; |
| 62 | |
| 63 | result = new ScreenArea(within1(cf->hScanStart() + dx), within1(cf->hScanEnd() + dx), |
| 64 | within1(cf->vScanStart() + dy), within1(cf->vScanEnd() + dy)); |
| 65 | cleanCurrentArea(); |
| 66 | } |
| 67 | |
| 68 | _currentArea = result; |
| 69 | return new ScreenArea(*_currentArea); |
| 70 | |
| 71 | } |
| 72 | |
| 73 | size_t PegasusDistributor::areaCountOnTopEdge() const |
| 74 | { |
no test coverage detected