From 9b69b86f2972c93395ce6ee88f5566a31a05ce0d Mon Sep 17 00:00:00 2001 From: Ori Avtalion Date: Sat, 26 Mar 2016 19:26:43 +0300 Subject: GRAPHICS: Prevent crash when drawing 0-height rounded corners Opening/closing the console when scroll bars were visible caused occasional crashes. Fixes #7089. --- graphics/VectorRendererSpec.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 26f0ced625..258d935440 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -2256,6 +2256,9 @@ drawBorderRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, template void VectorRendererAA:: drawInteriorRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, VectorRenderer::FillMode fill_m) { + w -= 2*Base::_strokeWidth; + h -= 2*Base::_strokeWidth; + // Do not draw empty space rounded squares. if (w <= 0 || h <= 0) { return; @@ -2272,8 +2275,6 @@ drawInteriorRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType colo r -= Base::_strokeWidth; x1 += Base::_strokeWidth; y1 += Base::_strokeWidth; - w -= 2*Base::_strokeWidth; - h -= 2*Base::_strokeWidth; rsq = r*r; PixelType *ptr_tl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + r); -- cgit v1.2.3