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

Tanoku at users.sourceforge.net Tanoku at users.sourceforge.net
Mon Jul 14 00:25:11 CEST 2008


Revision: 33047
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33047&view=rev
Author:   Tanoku
Date:     2008-07-13 15:25:11 -0700 (Sun, 13 Jul 2008)

Log Message:
-----------
Bugfix: Triangle AA at low resolutions.

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

Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp	2008-07-13 22:24:55 UTC (rev 33046)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp	2008-07-13 22:25:11 UTC (rev 33047)
@@ -33,6 +33,8 @@
 #include "gui/ThemeRenderer.h"
 #include "graphics/VectorRenderer.h"
 
+#define VECTOR_RENDERER_FAST_TRIANGLES
+
 namespace Graphics {
 
 VectorRenderer *createRenderer(int mode) {
@@ -391,6 +393,12 @@
 template<typename PixelType, typename PixelFormat>
 void VectorRendererSpec<PixelType, PixelFormat>::
 drawTriangle(int x, int y, int w, int h, TriangleOrientation orient) {
+	// Awesome hack: the AA messes up the last pixel triangles if their width is even
+	// ...fix the width instead of fixing the AA :p
+	if (w % 2 == 0) {
+		w++; h++;
+	}
+	
 	if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h)
 		return;
 
@@ -643,7 +651,8 @@
 void VectorRendererSpec<PixelType,PixelFormat>::
 drawTriangleFast(int x1, int y1, int size, bool inverted, PixelType color, VectorRenderer::FillMode fill_m) {
 	int pitch = Base::surfacePitch();
-	int hstep = 0;
+	int hstep = 0, dy = size;
+	bool grad = (fill_m == kFillGradient);
 	
 	PixelType *ptr_right = 0, *ptr_left = 0;
 	
@@ -656,15 +665,28 @@
 		pitch = -pitch;
 	}
 	
-	while (ptr_left != ptr_right) {
-		colorFill(ptr_left, ptr_right, color);
-		ptr_left += pitch;
-		ptr_right += pitch;
-		if (hstep++ % 3) {
-			ptr_left++;
-			ptr_right--;
-		}	
-	}	
+	if (fill_m == kFillDisabled) {
+		while (ptr_left < ptr_right) {
+			*ptr_left = color;
+			*ptr_right = color;
+			ptr_left += pitch;
+			ptr_right += pitch;
+			if (hstep++ % 2) {
+				ptr_left++;
+				ptr_right--;
+			}
+		}
+	} else {
+		while (ptr_left < ptr_right) {
+			colorFill(ptr_left, ptr_right, grad ? calcGradient(dy--, size) : color);
+			ptr_left += pitch;
+			ptr_right += pitch;
+			if (hstep++ % 2) {
+				ptr_left++;
+				ptr_right--;
+			}	
+		}
+	}
 }
 
 /** ROUNDED SQUARE ALGORITHM **/

Modified: scummvm/branches/gsoc2008-gui/gui/ThemeDefaultXML.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeDefaultXML.cpp	2008-07-13 22:24:55 UTC (rev 33046)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeDefaultXML.cpp	2008-07-13 22:25:11 UTC (rev 33047)
@@ -70,12 +70,12 @@
 	"</drawdata>"
 
 	"<drawdata id = 'checkbox_disabled' cache = false>"
-		"<text vertical_align = 'top' horizontal_align = 'left' color = '255, 255, 255' />"
+		"<text vertical_align = 'top' horizontal_align = 'left' color = '0,0,0' />"
 		"<drawstep func = 'square' fill = 'gradient' gradient_start = '206, 121, 99' gradient_end = '173, 40, 8' shadow = 0 />"
 	"</drawdata>"
 
 	"<drawdata id = 'checkbox_enabled' cache = false>"
-		"<text vertical_align = 'top' horizontal_align = 'left' color = '255, 255, 255' />"
+		"<text vertical_align = 'top' horizontal_align = 'left' color = '0,0,0' />"
 		"<drawstep func = 'square' fill = 'gradient' gradient_start = '206, 121, 99' gradient_end = '173, 40, 8' shadow = 0 />"
 		"<drawstep func = 'circle' radius = 'auto' fill = 'foreground' />"
 	"</drawdata>"


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