[Scummvm-cvs-logs] SF.net SVN: scummvm:[55664] scummvm/trunk/engines/sword25/gfx

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun Jan 30 21:36:18 CET 2011


Revision: 55664
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55664&view=rev
Author:   thebluegr
Date:     2011-01-30 20:36:17 +0000 (Sun, 30 Jan 2011)

Log Message:
-----------
SWORD25: Added alternative code for video frame blitting (currently disabled)

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/gfx/dynamicbitmap.cpp
    scummvm/trunk/engines/sword25/gfx/image/renderedimage.cpp
    scummvm/trunk/engines/sword25/gfx/image/renderedimage.h

Modified: scummvm/trunk/engines/sword25/gfx/dynamicbitmap.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/dynamicbitmap.cpp	2011-01-30 20:34:47 UTC (rev 55663)
+++ scummvm/trunk/engines/sword25/gfx/dynamicbitmap.cpp	2011-01-30 20:36:17 UTC (rev 55664)
@@ -81,10 +81,27 @@
 	// Draw the bitmap
 	bool result;
 	if (_scaleFactorX == 1.0f && _scaleFactorY == 1.0f) {
+#if 1
+		// This is what the game does originally, which can be
+		// a bit slow when drawing videos, but it's not the main
+		// bottleneck.
 		result = _image->blit(_absoluteX, _absoluteY,
 		                       (_flipV ? BitmapResource::FLIP_V : 0) |
 		                       (_flipH ? BitmapResource::FLIP_H : 0),
 		                       0, _modulationColor, -1, -1);
+#else
+		// WIP: A bit faster code
+
+		// We don't need to check for transparency when drawing
+		// videos, thus just copy the buffer contents directly.
+		// This messes up the fire animation in the menu, for
+		// some odd reason. It also makes the video colors a
+		// bit lighter, resulting in a visible black border
+		// around the typed letters in the intro (which are
+		// drawn over a black border)
+		_image->copyDirectly(_absoluteX, _absoluteY);
+#endif
+		return true;
 	} else {
 		result = _image->blit(_absoluteX, _absoluteY,
 		                       (_flipV ? BitmapResource::FLIP_V : 0) |

Modified: scummvm/trunk/engines/sword25/gfx/image/renderedimage.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/renderedimage.cpp	2011-01-30 20:34:47 UTC (rev 55663)
+++ scummvm/trunk/engines/sword25/gfx/image/renderedimage.cpp	2011-01-30 20:36:17 UTC (rev 55664)
@@ -337,6 +337,30 @@
 	return true;
 }
 
+void RenderedImage::copyDirectly(int posX, int posY) {
+	byte *data = _data;
+	int w = _width;
+	int h = _height;
+
+	// Handle off-screen clipping
+	if (posY < 0) {
+		h = MAX(0, (int)_height - -posY);
+		data = (byte *)_data + _width * -posY;
+		posY = 0;
+	}
+
+	if (posX < 0) {
+		w = MAX(0, (int)_width - -posX);
+		data = (byte *)_data + (-posX * 4);
+		posX = 0;
+	}
+
+	w = CLIP((int)w, 0, (int)MAX((int)_backSurface->w - posX, 0));
+	h = CLIP((int)h, 0, (int)MAX((int)_backSurface->h - posY, 0));
+
+	g_system->copyRectToScreen(data, _backSurface->pitch, posX, posY, w, h);
+}
+
 /**
  * Scales a passed surface, creating a new surface with the result
  * @param srcImage		Source image to scale

Modified: scummvm/trunk/engines/sword25/gfx/image/renderedimage.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/renderedimage.h	2011-01-30 20:34:47 UTC (rev 55663)
+++ scummvm/trunk/engines/sword25/gfx/image/renderedimage.h	2011-01-30 20:36:17 UTC (rev 55664)
@@ -72,6 +72,8 @@
 		return GraphicEngine::CF_ARGB32;
 	}
 
+	void copyDirectly(int posX, int posY);
+
 	virtual bool blit(int posX = 0, int posY = 0,
 	                  int flipping = Image::FLIP_NONE,
 	                  Common::Rect *pPartRect = NULL,
@@ -105,6 +107,7 @@
 	}
 
 	static Graphics::Surface *scale(const Graphics::Surface &srcImage, int xSize, int ySize);
+
 private:
 	byte *_data;
 	int  _width;


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