aboutsummaryrefslogtreecommitdiff
path: root/graphics/VectorRendererSpec.cpp
diff options
context:
space:
mode:
authorOri Avtalion2016-03-26 19:26:43 +0300
committerOri Avtalion2016-03-26 19:43:16 +0300
commit9b69b86f2972c93395ce6ee88f5566a31a05ce0d (patch)
treeec873cbbd3403a85ee99d51ae580ebdaa8a24fd3 /graphics/VectorRendererSpec.cpp
parenta2250d74ed1bcda6b6726bb7e6866be9129700c7 (diff)
downloadscummvm-rg350-9b69b86f2972c93395ce6ee88f5566a31a05ce0d.tar.gz
scummvm-rg350-9b69b86f2972c93395ce6ee88f5566a31a05ce0d.tar.bz2
scummvm-rg350-9b69b86f2972c93395ce6ee88f5566a31a05ce0d.zip
GRAPHICS: Prevent crash when drawing 0-height rounded corners
Opening/closing the console when scroll bars were visible caused occasional crashes. Fixes #7089.
Diffstat (limited to 'graphics/VectorRendererSpec.cpp')
-rw-r--r--graphics/VectorRendererSpec.cpp5
1 files 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<typename PixelType>
void VectorRendererAA<PixelType>::
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);