[Scummvm-cvs-logs] SF.net SVN: scummvm:[33166] scummvm/branches/gsoc2008-gui

Tanoku at users.sourceforge.net Tanoku at users.sourceforge.net
Mon Jul 21 11:53:34 CEST 2008


Revision: 33166
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33166&view=rev
Author:   Tanoku
Date:     2008-07-21 09:53:06 +0000 (Mon, 21 Jul 2008)

Log Message:
-----------
Valgrind fix: Invalid read/write while restoring background

Modified Paths:
--------------
    scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp
    scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h
    scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp

Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp	2008-07-21 09:25:40 UTC (rev 33165)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp	2008-07-21 09:53:06 UTC (rev 33166)
@@ -1019,13 +1019,13 @@
 	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);

Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h	2008-07-21 09:25:40 UTC (rev 33165)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h	2008-07-21 09:53:06 UTC (rev 33166)
@@ -658,8 +658,8 @@
 	 * @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;

Modified: scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp	2008-07-21 09:25:40 UTC (rev 33165)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp	2008-07-21 09:53:06 UTC (rev 33166)
@@ -388,19 +388,7 @@
 }
 
 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) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list