From 40d8209bca78b548e41f5895da7febe61152b92c Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Thu, 16 Jul 2009 11:37:36 +0000 Subject: Fixed issue with beveled shapes being drawn outside their shapes. Possible regressions. svn-id: r42529 --- graphics/VectorRendererSpec.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'graphics/VectorRendererSpec.cpp') diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 49dc2c0ef0..f99e20ec26 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -596,12 +596,15 @@ drawSquare(int x, int y, int w, int h) { template void VectorRendererSpec:: drawRoundedSquare(int x, int y, int r, int w, int h) { + + x++; y++; w--; h--; + if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h || w <= 0 || h <= 0 || x < 0 || y < 0 || r <= 0) return; - if ((r << 1) > w || (r << 1) > h) - r = MIN(w >> 1, h >> 1); + if ((r * 2) > w || (r * 2) > h) + r = MIN(w /2, h / 2); if (Base::_fillMode != kFillDisabled && Base::_shadowOffset && x + w + Base::_shadowOffset < Base::_activeSurface->w @@ -919,10 +922,14 @@ drawBevelSquareAlg(int x, int y, int w, int h, int bevel, PixelType top_color, P } int i, j; + +#if 0 x = MAX(x - bevel, 0); y = MAX(y - bevel, 0); - h += bevel << 1; - w += bevel << 1; + + w = w + (bevel * 2); + h = h + (bevel * 2); +#endif PixelType *ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y); -- cgit v1.2.3 From 16c949d24ae9674158b782c483408be6953cc750 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 16 Jul 2009 11:41:45 +0000 Subject: Formatting. svn-id: r42530 --- graphics/VectorRendererSpec.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'graphics/VectorRendererSpec.cpp') diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index f99e20ec26..4a7a301faf 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -596,8 +596,7 @@ drawSquare(int x, int y, int w, int h) { template void VectorRendererSpec:: drawRoundedSquare(int x, int y, int r, int w, int h) { - - x++; y++; w--; h--; + x++; y++; w--; h--; if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h || w <= 0 || h <= 0 || x < 0 || y < 0 || r <= 0) @@ -927,8 +926,8 @@ drawBevelSquareAlg(int x, int y, int w, int h, int bevel, PixelType top_color, P x = MAX(x - bevel, 0); y = MAX(y - bevel, 0); - w = w + (bevel * 2); - h = h + (bevel * 2); + w = w + (bevel * 2); + h = h + (bevel * 2); #endif PixelType *ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y); -- cgit v1.2.3 From af289bdb03d7f0a5e8f01c03e462f230835e0077 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Thu, 16 Jul 2009 17:29:31 +0000 Subject: Fixed bug 2820514 ("Help dialog causes crash") svn-id: r42537 --- graphics/VectorRendererSpec.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'graphics/VectorRendererSpec.cpp') diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 4a7a301faf..b68f4822d8 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -596,8 +596,6 @@ drawSquare(int x, int y, int w, int h) { template void VectorRendererSpec:: drawRoundedSquare(int x, int y, int r, int w, int h) { - x++; y++; w--; h--; - if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h || w <= 0 || h <= 0 || x < 0 || y < 0 || r <= 0) return; @@ -606,8 +604,8 @@ drawRoundedSquare(int x, int y, int r, int w, int h) { r = MIN(w /2, h / 2); if (Base::_fillMode != kFillDisabled && Base::_shadowOffset - && x + w + Base::_shadowOffset < Base::_activeSurface->w - && y + h + Base::_shadowOffset < Base::_activeSurface->h) { + && x + w + Base::_shadowOffset + 1 < Base::_activeSurface->w + && y + h + Base::_shadowOffset + 1 < Base::_activeSurface->h) { drawRoundedSquareShadow(x, y, r, w, h, Base::_shadowOffset); } @@ -922,13 +920,11 @@ drawBevelSquareAlg(int x, int y, int w, int h, int bevel, PixelType top_color, P int i, j; -#if 0 x = MAX(x - bevel, 0); y = MAX(y - bevel, 0); - w = w + (bevel * 2); - h = h + (bevel * 2); -#endif + w = MIN(w + (bevel * 2), (int)_activeSurface->w); + h = MIN(h + (bevel * 2), (int)_activeSurface->h); PixelType *ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y); -- cgit v1.2.3