| 1876 | } |
| 1877 | |
| 1878 | static inline void ViewportDraw(const Viewport &vp, int left, int top, int right, int bottom) |
| 1879 | { |
| 1880 | if (right <= vp.left || bottom <= vp.top) return; |
| 1881 | |
| 1882 | if (left >= vp.left + vp.width) return; |
| 1883 | |
| 1884 | if (left < vp.left) left = vp.left; |
| 1885 | if (right > vp.left + vp.width) right = vp.left + vp.width; |
| 1886 | |
| 1887 | if (top >= vp.top + vp.height) return; |
| 1888 | |
| 1889 | if (top < vp.top) top = vp.top; |
| 1890 | if (bottom > vp.top + vp.height) bottom = vp.top + vp.height; |
| 1891 | |
| 1892 | ViewportDoDraw(vp, |
| 1893 | ScaleByZoom(left - vp.left, vp.zoom) + vp.virtual_left, |
| 1894 | ScaleByZoom(top - vp.top, vp.zoom) + vp.virtual_top, |
| 1895 | ScaleByZoom(right - vp.left, vp.zoom) + vp.virtual_left, |
| 1896 | ScaleByZoom(bottom - vp.top, vp.zoom) + vp.virtual_top |
| 1897 | ); |
| 1898 | } |
| 1899 | |
| 1900 | /** |
| 1901 | * Draw the viewport of this window. |
no test coverage detected