[Scummvm-cvs-logs] SF.net SVN: scummvm:[35965] scummvm/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Jan 20 23:52:29 CET 2009


Revision: 35965
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35965&view=rev
Author:   fingolfin
Date:     2009-01-20 22:52:29 +0000 (Tue, 20 Jan 2009)

Log Message:
-----------
Moved Surface::blit to backends/vkeybd/virtual-keyboard-gui.cpp

Modified Paths:
--------------
    scummvm/trunk/backends/vkeybd/virtual-keyboard-gui.cpp
    scummvm/trunk/graphics/surface.cpp
    scummvm/trunk/graphics/surface.h

Modified: scummvm/trunk/backends/vkeybd/virtual-keyboard-gui.cpp
===================================================================
--- scummvm/trunk/backends/vkeybd/virtual-keyboard-gui.cpp	2009-01-20 22:50:59 UTC (rev 35964)
+++ scummvm/trunk/backends/vkeybd/virtual-keyboard-gui.cpp	2009-01-20 22:52:29 UTC (rev 35965)
@@ -32,6 +32,47 @@
 
 namespace Common {
 
+static void blit(Graphics::Surface *surf_dst, Graphics::Surface *surf_src, int16 x, int16 y, OverlayColor transparent) {
+	if (surf_dst->bytesPerPixel != sizeof(OverlayColor) || surf_src->bytesPerPixel != sizeof(OverlayColor))
+		return;
+
+	const OverlayColor *src = (const OverlayColor *)surf_src->pixels;
+	int blitW = surf_src->w;
+	int blitH = surf_src->h;
+
+	// clip co-ordinates
+	if (x < 0) {
+		blitW += x;
+		src -= x;
+		x = 0;
+	}
+	if (y < 0) {
+		blitH += y;
+		src -= y * surf_src->w;
+		y = 0;
+	}
+	if (blitW > surf_dst->w - x)
+		blitW = surf_dst->w - x;
+	if (blitH > surf_dst->h - y)
+		blitH = surf_dst->h - y;
+	if (blitW <= 0 || blitH <= 0)
+		return;
+
+	OverlayColor *dst = (OverlayColor *)surf_dst->getBasePtr(x, y);
+	int dstAdd = surf_dst->w - blitW;
+	int srcAdd = surf_src->w - blitW;
+
+	for (int i = 0; i < blitH; ++i) { 
+		for (int j = 0; j < blitW; ++j, ++dst, ++src) { 
+			OverlayColor col = *src;
+			if (col != transparent)
+				*dst = col;
+		}
+		dst += dstAdd;
+		src += srcAdd; 
+	}
+}
+
 VirtualKeyboardGUI::VirtualKeyboardGUI(VirtualKeyboard *kbd)
 	: _kbd(kbd), _displaying(false), _drag(false),	
 	_drawCaret(false), 	_displayEnabled(false),	_firstRun(true), 
@@ -313,10 +354,10 @@
 		src += _overlayBackup.w;
 	}
 
-	surf.blit(_kbdSurface, _kbdBound.left - _dirtyRect.left, 
+	blit(&surf, _kbdSurface, _kbdBound.left - _dirtyRect.left, 
 			  _kbdBound.top - _dirtyRect.top, _kbdTransparentColor);
 	if (_displayEnabled) {
-		surf.blit(&_dispSurface, _dispX - _dirtyRect.left, 
+		blit(&surf, &_dispSurface, _dispX - _dirtyRect.left, 
 				  _dispY - _dirtyRect.top, _dispBackColor);
 	}
 	_system->copyRectToOverlay((OverlayColor*)surf.pixels, surf.w, 

Modified: scummvm/trunk/graphics/surface.cpp
===================================================================
--- scummvm/trunk/graphics/surface.cpp	2009-01-20 22:50:59 UTC (rev 35964)
+++ scummvm/trunk/graphics/surface.cpp	2009-01-20 22:52:29 UTC (rev 35965)
@@ -225,42 +225,4 @@
 	}
 }
 
-void Surface::blit(Surface *surf_src, int16 x, int16 y, OverlayColor transparent) {
-	if (bytesPerPixel != sizeof(OverlayColor) || surf_src->bytesPerPixel != sizeof(OverlayColor)) return ;
-
-	const OverlayColor *src = (const OverlayColor*)surf_src->pixels;
-	int blitW = surf_src->w;
-	int blitH = surf_src->h;
-
-	// clip co-ordinates
-	if (x < 0) {
-		blitW += x;
-		src -= x;
-		x = 0;
-	}
-	if (y < 0) {
-		blitH += y;
-		src -= y * surf_src->w;
-		y = 0;
-	}
-	if (blitW > w - x) blitW = w - x;
-	if (blitH > h - y) blitH = h - y;
-	if (blitW <= 0 || blitH <= 0)
-		return;
-
-	OverlayColor *dst = (OverlayColor*) getBasePtr(x, y);
-	int dstAdd = w - blitW;
-	int srcAdd = surf_src->w - blitW;
-
-	for (int i = 0; i < blitH; ++i) { 
-		for (int j = 0; j < blitW; ++j, ++dst, ++src) { 
-			OverlayColor col = *src;
-			if (col != transparent)
-				*dst = col;
-		}
-		dst += dstAdd;
-		src += srcAdd; 
-	}
-}
-
 } // End of namespace Graphics

Modified: scummvm/trunk/graphics/surface.h
===================================================================
--- scummvm/trunk/graphics/surface.h	2009-01-20 22:50:59 UTC (rev 35964)
+++ scummvm/trunk/graphics/surface.h	2009-01-20 22:52:29 UTC (rev 35965)
@@ -78,8 +78,6 @@
 	void frameRect(const Common::Rect &r, uint32 color);
 	// See comment in graphics/surface.cpp about it
 	void move(int dx, int dy, int height);
-
-	void blit(Surface *surf_src, int16 x, int16 y, OverlayColor transparent);
 };
 
 /**


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