diff options
author | Jonathan G Rennison <j.g.rennison@gmail.com> | 2020-02-01 18:19:57 +0000 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2020-02-02 15:37:14 +0100 |
commit | 14af8701df46fb8f40a862ea5eff41e6ae1c2868 (patch) | |
tree | 037cbeba8360423c2fe9969f40d42f360ff292d3 /src/viewport.cpp | |
parent | 196157b29e3b654e2f700b657a4e706d02b26cd6 (diff) | |
download | openttd-14af8701df46fb8f40a862ea5eff41e6ae1c2868.tar.xz |
Fix #6566: Fix signed integer overflow in viewport draw area chunking
This caused drawing areas larger than 2097151 pixels at 8x zoom to
not be subdivided into smaller chunks as required.
This resulted in pathological performance issues in the sprite sorter.
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r-- | src/viewport.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp index 06f502379..1c9dca1ef 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1728,7 +1728,7 @@ void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom */ static void ViewportDrawChk(const ViewPort *vp, int left, int top, int right, int bottom) { - if (ScaleByZoom(bottom - top, vp->zoom) * ScaleByZoom(right - left, vp->zoom) > (int)(180000 * ZOOM_LVL_BASE * ZOOM_LVL_BASE)) { + if ((int64)ScaleByZoom(bottom - top, vp->zoom) * (int64)ScaleByZoom(right - left, vp->zoom) > (int64)(180000 * ZOOM_LVL_BASE * ZOOM_LVL_BASE)) { if ((bottom - top) > (right - left)) { int t = (top + bottom) >> 1; ViewportDrawChk(vp, left, top, right, t); |