Changeset - r24079:69103d85fd14
[Not reviewed]
master
0 1 0
Jonathan G Rennison - 4 years ago 2020-02-01 18:19:57
j.g.rennison@gmail.com
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.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/viewport.cpp
Show inline comments
 
@@ -1728,7 +1728,7 @@ void ViewportDoDraw(const ViewPort *vp, 
 
 */
 
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);
0 comments (0 inline, 0 general)