aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Marti2008-07-21 09:53:06 +0000
committerVicent Marti2008-07-21 09:53:06 +0000
commit89a21f1613cfe9ded3de22c5d4261ed40a39a1c3 (patch)
treead667bc514495f89afcbbd93faf28d734603e56b
parent5a4fcb83e24829334f12b046c120f200792f0ea9 (diff)
downloadscummvm-rg350-89a21f1613cfe9ded3de22c5d4261ed40a39a1c3.tar.gz
scummvm-rg350-89a21f1613cfe9ded3de22c5d4261ed40a39a1c3.tar.bz2
scummvm-rg350-89a21f1613cfe9ded3de22c5d4261ed40a39a1c3.zip
Valgrind fix: Invalid read/write while restoring background
svn-id: r33166
-rw-r--r--graphics/VectorRenderer.cpp4
-rw-r--r--graphics/VectorRenderer.h4
-rw-r--r--gui/ThemeRenderer.cpp14
3 files changed, 5 insertions, 17 deletions
diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp
index baadd3ae41..190bbbb40a 100644
--- a/graphics/VectorRenderer.cpp
+++ b/graphics/VectorRenderer.cpp
@@ -1019,13 +1019,13 @@ drawRoundedSquareShadow(int x1, int y1, int r, int w, int h, int blur) {
while (x++ < y) {
__BE_ALGORITHM();
- if ((1 << x) & hb == 0) {
+ if (((1 << x) & hb) == 0) {
blendFill(ptr_tr - px - r, ptr_tr + y - px, 0, alpha);
blendFill(ptr_bl - y + px, ptr_br + y + px, 0, alpha);
hb |= (1 << x);
}
- if ((1 << y) & hb == 0) {
+ if (((1 << y) & hb) == 0) {
blendFill(ptr_tr - r - py, ptr_tr + x - py, 0, alpha);
blendFill(ptr_bl - x + py, ptr_br + x + py, 0, alpha);
hb |= (1 << y);
diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h
index c7ba0676b3..ee8129bd67 100644
--- a/graphics/VectorRenderer.h
+++ b/graphics/VectorRenderer.h
@@ -658,8 +658,8 @@ public:
* @see VectorRenderer::blitSurface()
*/
virtual void blitSurface(Graphics::Surface *source, const Common::Rect &r) {
- PixelType *dst_ptr = (PixelType *)_activeSurface->getBasePtr(r.top, r.left);
- PixelType *src_ptr = (PixelType *)source->getBasePtr(0, 0);
+ PixelType *dst_ptr = (PixelType *)_activeSurface->getBasePtr(r.left, r.top);
+ PixelType *src_ptr = (PixelType *)source->getBasePtr(r.left, r.top);
int dst_pitch = surfacePitch();
int src_pitch = source->pitch / source->bytesPerPixel;
diff --git a/gui/ThemeRenderer.cpp b/gui/ThemeRenderer.cpp
index b287406ba5..b7483b810d 100644
--- a/gui/ThemeRenderer.cpp
+++ b/gui/ThemeRenderer.cpp
@@ -388,19 +388,7 @@ void ThemeRenderer::calcBackgroundOffset(DrawData type) {
}
void ThemeRenderer::restoreBackground(Common::Rect r, bool special) {
- const OverlayColor *src = (const OverlayColor*)_backBuffer->getBasePtr(r.left, r.top);
- OverlayColor *dst = (OverlayColor*)_screen->getBasePtr(r.left, r.top);
-
- int h = r.height();
- int w = r.width();
- while (h--) {
- memcpy(dst, src, w * sizeof(OverlayColor));
- src += _backBuffer->w;
- dst += _screen->w;
- }
-
-// debugWidgetPosition("", r);
-// printf(" BG_RESTORE ");
+ _vectorRenderer->blitSurface(_backBuffer, r);
}
void ThemeRenderer::drawButton(const Common::Rect &r, const Common::String &str, WidgetStateInfo state, uint16 hints) {