| 184 | } |
| 185 | |
| 186 | static void invalidate(const ViewportRect& rect, ZoomLevel zoom) |
| 187 | { |
| 188 | for (auto& viewport : _viewports) |
| 189 | { |
| 190 | // Skip destroyed viewports. |
| 191 | if (viewport.isValid() == 0) |
| 192 | { |
| 193 | continue; |
| 194 | } |
| 195 | |
| 196 | // Skip if zoomed out further than zoom argument |
| 197 | if (viewport.zoom > (uint8_t)zoom) |
| 198 | { |
| 199 | continue; |
| 200 | } |
| 201 | |
| 202 | if (!viewport.intersects(rect)) |
| 203 | { |
| 204 | continue; |
| 205 | } |
| 206 | |
| 207 | auto intersection = viewport.getIntersection(rect); |
| 208 | |
| 209 | // offset rect by (negative) viewport origin |
| 210 | int16_t left = intersection.left - viewport.viewX; |
| 211 | int16_t right = intersection.right - viewport.viewX; |
| 212 | int16_t top = intersection.top - viewport.viewY; |
| 213 | int16_t bottom = intersection.bottom - viewport.viewY; |
| 214 | |
| 215 | // apply zoom |
| 216 | left = left >> viewport.zoom; |
| 217 | right = right >> viewport.zoom; |
| 218 | top = top >> viewport.zoom; |
| 219 | bottom = bottom >> viewport.zoom; |
| 220 | |
| 221 | // offset calculated area by viewport offset |
| 222 | left += viewport.x; |
| 223 | right += viewport.x; |
| 224 | top += viewport.y; |
| 225 | bottom += viewport.y; |
| 226 | |
| 227 | Gfx::invalidateRegion(left, top, right, bottom); |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | // 0x004CBA2D |
| 232 | void invalidate(Station* station) |
no test coverage detected