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

Tanoku at users.sourceforge.net Tanoku at users.sourceforge.net
Sun Aug 10 20:56:12 CEST 2008


Revision: 33768
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33768&view=rev
Author:   Tanoku
Date:     2008-08-10 18:56:10 +0000 (Sun, 10 Aug 2008)

Log Message:
-----------
Bugfix: Several text-drawing issues.
Bugfix: Overlapping text in text edit dialogs.

Modified Paths:
--------------
    scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp
    scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h
    scummvm/branches/gsoc2008-gui/gui/ListWidget.cpp
    scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp
    scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h
    scummvm/branches/gsoc2008-gui/gui/themes/scummodern.zip

Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp	2008-08-10 18:44:39 UTC (rev 33767)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp	2008-08-10 18:56:10 UTC (rev 33768)
@@ -323,23 +323,24 @@
 template <typename PixelType, typename PixelFormat>
 void VectorRendererSpec<PixelType, PixelFormat>::
 drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, 
-			GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV, int deltax) {
+			GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV, int deltax, bool ellipsis) {
 
-	int offset = 0;
+	int offset = area.top;
 	
-	switch (alignV) {
-		case GUI::Theme::kTextAlignVCenter:
-			offset = area.top + (area.height() - font->getFontHeight()) / 2;
-			break;
-		case GUI::Theme::kTextAlignVBottom:
-			offset = area.bottom - font->getFontHeight();
-			break;
-		case GUI::Theme::kTextAlignVTop:
-			offset = area.top;
-			break;
+	if (font->getFontHeight() < area.height()) {
+		switch (alignV) {
+			case GUI::Theme::kTextAlignVCenter:
+				offset = area.top + ((area.height() - font->getFontHeight()) >> 1);
+				break;
+			case GUI::Theme::kTextAlignVBottom:
+				offset = area.bottom - font->getFontHeight();
+				break;
+			default:
+				break;
+		}
 	}
 	
-	font->drawString(_activeSurface, text, area.left, offset, area.width(), _fgColor, (Graphics::TextAlignment)alignH, deltax, false);
+	font->drawString(_activeSurface, text, area.left, offset, area.width(), _fgColor, (Graphics::TextAlignment)alignH, deltax, ellipsis);
 }
 
 /** LINES **/

Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h	2008-08-10 18:44:39 UTC (rev 33767)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h	2008-08-10 18:56:10 UTC (rev 33768)
@@ -477,7 +477,7 @@
 	 * Draws a string into the screen. Wrapper for the Graphics::Font string drawing
 	 * method.
 	 */
-	virtual void drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV, int deltax) = 0;
+	virtual void drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV, int deltax, bool useEllipsis) = 0;
 	
 	/**
 	 * Allows to temporarily enable/disable all shadows drawing.
@@ -604,7 +604,7 @@
 	
 	void drawString(const Graphics::Font *font, const Common::String &text, 
 					const Common::Rect &area, GUI::Theme::TextAlign alignH,
-					GUI::Theme::TextAlignVertical alignV, int deltax);
+					GUI::Theme::TextAlignVertical alignV, int deltax, bool elipsis);
 
 	/**
 	 * @see VectorRenderer::setFgColor()

Modified: scummvm/branches/gsoc2008-gui/gui/ListWidget.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ListWidget.cpp	2008-08-10 18:44:39 UTC (rev 33767)
+++ scummvm/branches/gsoc2008-gui/gui/ListWidget.cpp	2008-08-10 18:56:10 UTC (rev 33768)
@@ -407,7 +407,7 @@
 			if (_selectedItem != pos) {
 				width = g_gui.getStringWidth(buffer) + pad;
 				if (width > _w - r.left)
-					width = _w - r.left;
+					width = _w - r.left - _hlRightPadding - _scrollBarWidth;
 			} else
 				width = _w - r.left - _hlRightPadding - _scrollBarWidth;
 			if (width > maxWidth)

Modified: scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp	2008-08-10 18:44:39 UTC (rev 33767)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp	2008-08-10 18:56:10 UTC (rev 33768)
@@ -552,7 +552,7 @@
 		restoreBackground(q.area);
 	
 	_vectorRenderer->setFgColor(_texts[q.type]->_color.r, _texts[q.type]->_color.g, _texts[q.type]->_color.b);
-	_vectorRenderer->drawString(_texts[q.type]->_fontPtr, q.text, q.area, q.alignH, q.alignV, q.deltax);
+	_vectorRenderer->drawString(_texts[q.type]->_fontPtr, q.text, q.area, q.alignH, q.alignV, q.deltax, q.elipsis);
 	addDirtyRect(q.area);
 }
 
@@ -781,18 +781,15 @@
 	if (!ready())
 		return;
 		
-	Common::Rect dr = r;
-	dr.left += deltax;
-		
 	if (inverted) {
 		queueDD(kDDTextSelectionBackground, r);
-		queueDDText(kTextDataInverted, dr, str, false, useEllipsis, align);
+		queueDDText(kTextDataInverted, r, str, false, useEllipsis, align, kTextAlignVCenter, deltax);
 		return;
 	}
 	
 	switch (font) {
 		case kFontStyleNormal:
-			queueDDText(kTextDataNormalFont, dr, str, true, useEllipsis, align);
+			queueDDText(kTextDataNormalFont, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax);
 			return;
 			
 		default:
@@ -801,15 +798,15 @@
 
 	switch (state) {
 		case kStateDisabled:
-			queueDDText(kTextDataDisabled, dr, str, true, useEllipsis, align);
+			queueDDText(kTextDataDisabled, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax);
 			return;
 			
 		case kStateHighlight:
-			queueDDText(kTextDataHover, dr, str, true, useEllipsis, align);
+			queueDDText(kTextDataHover, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax);
 			return;
 		
 		case kStateEnabled:
-			queueDDText(kTextDataDefault, dr, str, true, useEllipsis, align);
+			queueDDText(kTextDataDefault, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax);
 			return;
 	}
 }

Modified: scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h	2008-08-10 18:44:39 UTC (rev 33767)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h	2008-08-10 18:56:10 UTC (rev 33768)
@@ -94,7 +94,7 @@
 	friend class GUI::GuiObject;
 
 	/** Constant value to expand dirty rectangles, to make sure they are fully copied */
-	static const int kDirtyRectangleThreshold = 2;
+	static const int kDirtyRectangleThreshold = 0;
 	
 	/** Sets whether backcaching is enabled */
 	static const bool kEnableBackCaching = true;


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