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

Tanoku at users.sourceforge.net Tanoku at users.sourceforge.net
Mon Jul 21 21:42:36 CEST 2008


Revision: 33179
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33179&view=rev
Author:   Tanoku
Date:     2008-07-21 19:42:35 +0000 (Mon, 21 Jul 2008)

Log Message:
-----------
Bugfix: Rounded squares at low resolutions were not drawn.
Cleanup.

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

Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp	2008-07-21 19:37:12 UTC (rev 33178)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp	2008-07-21 19:42:35 UTC (rev 33179)
@@ -84,6 +84,87 @@
 		!step.hasAlign ? GUI::Theme::kTextAlignVTop : step.alignVertical);
 }
 
+int VectorRenderer::stepGetRadius(const DrawStep &step, const Common::Rect &area) {
+	int radius = 0;
+
+	if (step.radius == 0xFF)
+		radius = MIN(area.width(), area.height()) / 2;
+	else
+		radius = step.radius;
+
+	if (step.scale != (1 << 16) && step.scale != 0)
+		radius = (radius * step.scale) >> 16;
+
+	return radius;
+}
+
+void VectorRenderer::stepGetPositions(const DrawStep &step, const Common::Rect &area, uint16 &in_x, uint16 &in_y, uint16 &in_w, uint16 &in_h) {
+	if (!step.autoWidth) {
+		in_w = step.w == -1 ? area.height() : step.w;
+		
+		switch(step.xAlign) {
+			case Graphics::DrawStep::kVectorAlignManual:
+				if (step.x >= 0) in_x = area.left + step.x;
+				else in_x = area.left + area.width() + step.x; // value relative to the opposite corner.
+				break;
+				
+			case Graphics::DrawStep::kVectorAlignCenter:
+				in_x = area.left + (area.width() / 2) - (in_w / 2); 
+				break;
+				
+			case Graphics::DrawStep::kVectorAlignLeft:
+				in_x = area.left;
+				break;
+				
+			case Graphics::DrawStep::kVectorAlignRight:
+				in_x = area.left + area.width() - in_w;
+				break;
+				
+			default:
+				error("Vertical alignment in horizontal data.");
+		}
+	} else {
+		in_x = area.left;
+		in_w = area.width();
+	}
+	
+	if (!step.autoHeight) {
+		in_h = step.h == -1 ? area.width() : step.h;
+		
+		switch(step.yAlign) {
+			case Graphics::DrawStep::kVectorAlignManual:
+				if (step.y >= 0) in_y = area.top + step.y;
+				else in_y = area.top + area.height() + step.y; // relative
+				break;
+				
+			case Graphics::DrawStep::kVectorAlignCenter:
+				in_y = area.top + (area.height() / 2) - (in_h / 2); 
+				break;
+				
+			case Graphics::DrawStep::kVectorAlignTop:
+				in_y = area.top;
+				break;
+				
+			case Graphics::DrawStep::kVectorAlignBottom:
+				in_y = area.top + area.height() - in_h;
+				break;
+				
+			default:
+				error("Horizontal alignment in vertical data.");
+		}
+	} else {
+		in_y = area.top;
+		in_h = area.height();
+	}
+
+	if (step.scale != (1 << 16) && step.scale != 0) {
+		in_x = (in_x * step.scale) >> 16;
+		in_y = (in_y * step.scale) >> 16;
+		in_w = (in_w * step.scale) >> 16;
+		in_h = (in_h * step.scale) >> 16;
+	}
+}
+
 /********************************************************************
  * MISCELANEOUS functions
  ********************************************************************/
@@ -356,8 +437,11 @@
 void VectorRendererSpec<PixelType, PixelFormat>::
 drawRoundedSquare(int x, int y, int r, int w, int h) {
 	if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h ||
-		w <= 0 || h <= 0 || x < 0 || y < 0 || (r << 1) > w || (r << 1) > h)
+		w <= 0 || h <= 0 || x < 0 || y < 0)
 		return;
+		
+	while ((r << 1) > w || (r << 1) > h)
+		r <<= 1;
 
 	if (Base::_fillMode != kFillDisabled && Base::_shadowOffset
 		&& x + w + Base::_shadowOffset < Base::_activeSurface->w

Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h	2008-07-21 19:37:12 UTC (rev 33178)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h	2008-07-21 19:42:35 UTC (rev 33179)
@@ -338,87 +338,10 @@
 			_gradientFactor = factor;
 	}
 
-	void stepGetPositions(const DrawStep &step, const Common::Rect &area, uint16 &in_x, uint16 &in_y, uint16 &in_w, uint16 &in_h) {
-		if (!step.autoWidth) {
-			in_w = step.w == -1 ? area.height() : step.w;
-			
-			switch(step.xAlign) {
-				case Graphics::DrawStep::kVectorAlignManual:
-					if (step.x >= 0) in_x = area.left + step.x;
-					else in_x = area.left + area.width() + step.x; // value relative to the opposite corner.
-					break;
-					
-				case Graphics::DrawStep::kVectorAlignCenter:
-					in_x = area.left + (area.width() / 2) - (in_w / 2); 
-					break;
-					
-				case Graphics::DrawStep::kVectorAlignLeft:
-					in_x = area.left;
-					break;
-					
-				case Graphics::DrawStep::kVectorAlignRight:
-					in_x = area.left + area.width() - in_w;
-					break;
-					
-				default:
-					error("Vertical alignment in horizontal data.");
-			}
-		} else {
-			in_x = area.left;
-			in_w = area.width();
-		}
-		
-		if (!step.autoHeight) {
-			in_h = step.h == -1 ? area.width() : step.h;
-			
-			switch(step.yAlign) {
-				case Graphics::DrawStep::kVectorAlignManual:
-					if (step.y >= 0) in_y = area.top + step.y;
-					else in_y = area.top + area.height() + step.y; // relative
-					break;
-					
-				case Graphics::DrawStep::kVectorAlignCenter:
-					in_y = area.top + (area.height() / 2) - (in_h / 2); 
-					break;
-					
-				case Graphics::DrawStep::kVectorAlignTop:
-					in_y = area.top;
-					break;
-					
-				case Graphics::DrawStep::kVectorAlignBottom:
-					in_y = area.top + area.height() - in_h;
-					break;
-					
-				default:
-					error("Horizontal alignment in vertical data.");
-			}
-		} else {
-			in_y = area.top;
-			in_h = area.height();
-		}
+	void stepGetPositions(const DrawStep &step, const Common::Rect &area, uint16 &in_x, uint16 &in_y, uint16 &in_w, uint16 &in_h);
 
-		if (step.scale != (1 << 16) && step.scale != 0) {
-			in_x = (in_x * step.scale) >> 16;
-			in_y = (in_y * step.scale) >> 16;
-			in_w = (in_w * step.scale) >> 16;
-			in_h = (in_h * step.scale) >> 16;
-		}
-	}
+	int stepGetRadius(const DrawStep &step, const Common::Rect &area);
 
-	int stepGetRadius(const DrawStep &step, const Common::Rect &area) {
-		int radius = 0;
-
-		if (step.radius == 0xFF)
-			radius = MIN(area.width(), area.height()) / 2;
-		else
-			radius = step.radius;
-
-		if (step.scale != (1 << 16) && step.scale != 0)
-			radius = (radius * step.scale) >> 16;
-
-		return radius;
-	}
-
 	/**
 	 * DrawStep callback functions for each drawing feature 
 	 */

Modified: scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h	2008-07-21 19:37:12 UTC (rev 33178)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h	2008-07-21 19:42:35 UTC (rev 33179)
@@ -223,7 +223,10 @@
 
 	/** Since the rendering pipeline changes, closing all dialogs causes no effect 
 		TODO: remove this from the original GUI::Theme API */
-	void closeAllDialogs() {}
+	void closeAllDialogs() {
+		memset(_backBuffer->pixels, 0, _backBuffer->w * _backBuffer->h * _backBuffer->bytesPerPixel);
+		
+	}
 	
 	/** Drawing area has been removed: it was too hackish. A workaround is on the works.
 	 	TODO: finish the workaround for the credits dialog


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