* Align parameters of a line to the given DPI and check simple clipping. * @param dpi Screen parameters to align with. * @param x X coordinate of first point. * @param y Y coordinate of first point. * @param x2 X coordinate of second point. * @param y2 Y coordinate of second point. * @param width Width of the line. * @return True if the line is likely to be visible, false if it's certainly
| 376 | * invisible. |
| 377 | */ |
| 378 | static inline bool GfxPreprocessLine(DrawPixelInfo *dpi, int &x, int &y, int &x2, int &y2, int width) |
| 379 | { |
| 380 | x -= dpi->left; |
| 381 | x2 -= dpi->left; |
| 382 | y -= dpi->top; |
| 383 | y2 -= dpi->top; |
| 384 | |
| 385 | /* Check simple clipping */ |
| 386 | if (x + width / 2 < 0 && x2 + width / 2 < 0 ) return false; |
| 387 | if (y + width / 2 < 0 && y2 + width / 2 < 0 ) return false; |
| 388 | if (x - width / 2 > dpi->width && x2 - width / 2 > dpi->width ) return false; |
| 389 | if (y - width / 2 > dpi->height && y2 - width / 2 > dpi->height) return false; |
| 390 | return true; |
| 391 | } |
| 392 | |
| 393 | void GfxDrawLine(int x, int y, int x2, int y2, PixelColour colour, int width, int dash) |
| 394 | { |
no outgoing calls
no test coverage detected