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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Sep 1 14:41:47 CEST 2008


Revision: 34238
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34238&view=rev
Author:   fingolfin
Date:     2008-09-01 12:41:46 +0000 (Mon, 01 Sep 2008)

Log Message:
-----------
Use memcpy instead of hand-rolled colorCopy (on many systems, memcpy is hand-optimized asm or even a compiler built-in and *way* faster than any C code you could roll yourself -- it's way faster on my system, too)

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

Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRendererSpec.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRendererSpec.cpp	2008-09-01 10:54:03 UTC (rev 34237)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRendererSpec.cpp	2008-09-01 12:41:46 UTC (rev 34238)
@@ -262,7 +262,7 @@
 	int h = r.height(), w = r.width();
 
 	while (h--) {
-		colorCopy(src_ptr, dst_ptr, w);
+		memcpy(dst_ptr, src_ptr, w * sizeof(PixelType));
 		dst_ptr += dst_pitch;
 		src_ptr += src_pitch;
 	}
@@ -280,7 +280,7 @@
 	int h = r.height(), w = r.width();
 	
 	while (h--) {
-		colorCopy(src_ptr, dst_ptr, w);
+		memcpy(dst_ptr, src_ptr, w * sizeof(PixelType));
 		dst_ptr += dst_pitch;
 		src_ptr += src_pitch;
 	}
@@ -411,24 +411,6 @@
 	}
 }
 
-template <typename PixelType, typename PixelFormat>
-inline void VectorRendererSpec<PixelType, PixelFormat>::
-colorCopy(PixelType *src, PixelType *dst, int count) {
-	register int n = (count + 7) >> 3;
-	switch (count % 8) {
-	case 0: do { 
-				*dst++ = *src++;
-	case 7:		*dst++ = *src++;
-	case 6:		*dst++ = *src++;
-	case 5:		*dst++ = *src++;
-	case 4:		*dst++ = *src++;
-	case 3:		*dst++ = *src++;
-	case 2:		*dst++ = *src++;
-	case 1:		*dst++ = *src++;
-			} while (--n > 0);
-	}
-}
-
 /********************************************************************
  ********************************************************************
  * Primitive shapes drawing - Public API calls - VectorRendererSpec *

Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRendererSpec.h
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRendererSpec.h	2008-09-01 10:54:03 UTC (rev 34237)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRendererSpec.h	2008-09-01 12:41:46 UTC (rev 34238)
@@ -227,17 +227,6 @@
 	 * @param color Color of the pixel
 	 */
     virtual inline void colorFill(PixelType *first, PixelType *last, PixelType color);
-
-	/**
-	 * Copies several pixes in a row from a surface to another one.
-	 * Used for surface blitting.
-	 * See colorFill() for optimization guidelines.
-	 *
-	 * @param src Source surface.
-	 * @param dst Destination surface.
-	 * @param count Amount of pixels to copy over.
-	 */
-    virtual inline void colorCopy(PixelType *src, PixelType *dst, int count);
 	
 	virtual void areaConvolution(const Common::Rect &area, const int filter[3][3], int filterDiv, int offset);
 


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