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

Tanoku at users.sourceforge.net Tanoku at users.sourceforge.net
Sun Sep 7 11:43:26 CEST 2008


Revision: 34398
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34398&view=rev
Author:   Tanoku
Date:     2008-09-07 09:43:10 +0000 (Sun, 07 Sep 2008)

Log Message:
-----------
Misc performance fixes.

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-06 22:09:34 UTC (rev 34397)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRendererSpec.cpp	2008-09-07 09:43:10 UTC (rev 34398)
@@ -75,9 +75,9 @@
 inline uint32 fp_sqroot(uint32 x) {
     int bit;
 
-#if defined(__arm__)
-	__asm__ ("clz  %0, %1\nrsb  %0, %0, #31\n" : "=r"(bit) : "r" (x));
-#elif defined(__i386__)
+//#if defined(ARM9)
+//	__asm__ ("clz  %0, %1\nrsb  %0, %0, #31\n" : "=r"(bit) : "r" (x));
+#if defined(__i386__)
 	__asm__("bsrl %1, %0" : "=r" (bit) : "r" (x));
 #else
 	unsigned int mask = 0x40000000;
@@ -100,7 +100,10 @@
 }
 
 
-/** HELPER MACROS for BESENHALM's circle drawing algorithm **/
+/*
+	HELPER MACROS for Bresenham's circle drawing algorithm 
+	Note the proper spelling on this header.
+*/
 #define __BE_ALGORITHM() { \
 	if (f >= 0) { \
 		y--; \
@@ -175,17 +178,6 @@
 	blendPixelPtr(ptr4 + (y) + (px), color, a); \
 }
 
-/*#define __WU_ALGORITHM() { \
-	oldT = T; \
-	T = fp_sqroot(rsq - ((y * y) << 16)) ^ 0xFFFF; \
-	py += p; \
-	if (T < oldT) { \
-		x--; px -= p; \
-	} \
-	a2 = (T >> 8); \
-	a1 = ~a2; \
-} */
-
 // optimized Wu's algorithm
 #define __WU_ALGORITHM() {\
 	py += p; \
@@ -400,13 +392,6 @@
 template <typename PixelType, typename PixelFormat>
 inline void VectorRendererSpec<PixelType, PixelFormat>::
 blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha)	{
-	if (!ptr) return;
-		
-	if (alpha == 255) {
-		*ptr = color;
-		return;
-	}
-
 	register int idst = *ptr;
 	register int isrc = color;
 

Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRendererSpec.h
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRendererSpec.h	2008-09-06 22:09:34 UTC (rev 34397)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRendererSpec.h	2008-09-07 09:43:10 UTC (rev 34398)
@@ -76,15 +76,15 @@
 	void setBevelColor(uint8 r, uint8 g, uint8 b) { _bevelColor = RGBToColor<PixelFormat>(r, g, b); }
     void setGradientColors(uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2);
 
-    virtual void copyFrame(OSystem *sys, const Common::Rect &r);
-    virtual void copyWholeFrame(OSystem *sys) { copyFrame(sys, Common::Rect(0, 0, _activeSurface->w, _activeSurface->h)); }
+    void copyFrame(OSystem *sys, const Common::Rect &r);
+    void copyWholeFrame(OSystem *sys) { copyFrame(sys, Common::Rect(0, 0, _activeSurface->w, _activeSurface->h)); }
     
-    virtual void fillSurface();
-    virtual void blitSurface(const Graphics::Surface *source, const Common::Rect &r);
-    virtual void blitSubSurface(const Graphics::Surface *source, const Common::Rect &r);
-    virtual void blitAlphaBitmap(const Graphics::Surface *source, const Common::Rect &r);
+    void fillSurface();
+    void blitSurface(const Graphics::Surface *source, const Common::Rect &r);
+    void blitSubSurface(const Graphics::Surface *source, const Common::Rect &r);
+    void blitAlphaBitmap(const Graphics::Surface *source, const Common::Rect &r);
 	
-    virtual void applyScreenShading(GUI::Theme::ShadingStyle shadingStyle);
+    void applyScreenShading(GUI::Theme::ShadingStyle shadingStyle);
 
 protected:
 
@@ -96,7 +96,7 @@
 	 * @param y Vertical coordinate of the pixel.
 	 * @param color Color of the pixel
 	 */
-	virtual inline void putPixel(int x, int y, PixelType color) {
+	inline void putPixel(int x, int y, PixelType color) {
 		PixelType *ptr = (PixelType *)_activeSurface->getBasePtr(x, y);
 		*ptr = color;
 	}
@@ -110,11 +110,8 @@
 	 * @param color Color of the pixel
 	 * @param alpha Alpha intensity of the pixel (0-255)
 	 */
-	virtual inline void blendPixel(int x, int y, PixelType color, uint8 alpha) {
-		if (alpha == 255)
-			putPixel(x, y, color);
-		else if (alpha > 0)
-			blendPixelPtr((PixelType*)Base::_activeSurface->getBasePtr(x, y), color, alpha);
+	inline void blendPixel(int x, int y, PixelType color, uint8 alpha) {
+		blendPixelPtr((PixelType*)Base::_activeSurface->getBasePtr(x, y), color, alpha);
 	}
 
 	/**
@@ -129,7 +126,7 @@
 	 * @param color Color of the pixel
 	 * @param alpha Alpha intensity of the pixel (0-255)
 	 */
-    virtual inline void blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha);
+    inline void blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha);
 
 	/**
 	 * PRIMITIVE DRAWING ALGORITHMS
@@ -194,7 +191,7 @@
 	 * @param max Maximum amount of the progress.
 	 * @return Composite color of the gradient at the given "progress" amount.
 	 */
-    virtual inline PixelType calcGradient(uint32 pos, uint32 max);
+    inline PixelType calcGradient(uint32 pos, uint32 max);
 
 	/**
 	 * Fills several pixels in a row with a given color and the specifed alpha blending.
@@ -206,7 +203,7 @@
 	 * @param color Color of the pixel
 	 * @param alpha Alpha intensity of the pixel (0-255)
 	 */
-	virtual inline void blendFill(PixelType *first, PixelType *last, PixelType color, uint8 alpha) {
+	inline void blendFill(PixelType *first, PixelType *last, PixelType color, uint8 alpha) {
 		while (first != last) blendPixelPtr(first++, color, alpha);
 	}
 
@@ -226,9 +223,9 @@
 	 * @param last Pointer to the last pixel to fill.
 	 * @param color Color of the pixel
 	 */
-    virtual inline void colorFill(PixelType *first, PixelType *last, PixelType color);
+    inline void colorFill(PixelType *first, PixelType *last, PixelType color);
 	
-	virtual void areaConvolution(const Common::Rect &area, const int filter[3][3], int filterDiv, int offset);
+	void areaConvolution(const Common::Rect &area, const int filter[3][3], int filterDiv, int offset);
 
 	PixelType _fgColor; /** Foreground color currently being used to draw on the renderer */
 	PixelType _bgColor; /** Background color currently being used to draw on the renderer */


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