[Scummvm-cvs-logs] SF.net SVN: scummvm:[47771] scummvm/trunk/engines/cine

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Jan 31 19:29:54 CET 2010


Revision: 47771
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47771&view=rev
Author:   lordhoto
Date:     2010-01-31 18:29:54 +0000 (Sun, 31 Jan 2010)

Log Message:
-----------
Fix return of a reference to a temporary object introduced with r47766. (Hopefully this "workaround" will work also for Chrilith's compiler ;-).

Modified Paths:
--------------
    scummvm/trunk/engines/cine/pal.cpp
    scummvm/trunk/engines/cine/pal.h

Modified: scummvm/trunk/engines/cine/pal.cpp
===================================================================
--- scummvm/trunk/engines/cine/pal.cpp	2010-01-31 18:24:49 UTC (rev 47770)
+++ scummvm/trunk/engines/cine/pal.cpp	2010-01-31 18:29:54 UTC (rev 47771)
@@ -244,7 +244,7 @@
 		// For more information about this gcc specific problem, you can read up on the following bug
 		// report: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36043
 		const Color src = _colors[i];
-		output._colors[i] = saturatedAddColor(src, r, g, b);
+		saturatedAddColor(output._colors[i], src, r, g, b);
 	}
 
 	return output;
@@ -269,12 +269,10 @@
 }
 
 // a.k.a. transformColor
-Palette::Color &Palette::saturatedAddColor(Color baseColor, signed r, signed g, signed b) const {
-	Cine::Palette::Color result;
+void Palette::saturatedAddColor(Color &result, Color baseColor, signed r, signed g, signed b) const {
 	result.r = CLIP<int>(baseColor.r + r, 0, _format.rMax());
 	result.g = CLIP<int>(baseColor.g + g, 0, _format.gMax());
 	result.b = CLIP<int>(baseColor.b + b, 0, _format.bMax());
-	return result;
 }
 
 Palette::Palette(const Graphics::PixelFormat format, const uint numColors) : _format(format), _colors() {

Modified: scummvm/trunk/engines/cine/pal.h
===================================================================
--- scummvm/trunk/engines/cine/pal.h	2010-01-31 18:24:49 UTC (rev 47770)
+++ scummvm/trunk/engines/cine/pal.h	2010-01-31 18:29:54 UTC (rev 47771)
@@ -186,8 +186,13 @@
 
 private:
 	void setColorFormat(const Graphics::PixelFormat format);
-	Color &saturatedAddColor(Color baseColor, signed r, signed g, signed b) const;
 
+	// WORKAROUND: Using a reference to a result here instead of returning an Color object.
+	// This is needed because when using a Color as return value, this would crash Chrilith's
+	// compiler for PalmOS.
+	// TODO: Add more information about the compiler.
+	void saturatedAddColor(Color &result, Color baseColor, signed r, signed g, signed b) const;
+
 private:
 	Graphics::PixelFormat _format; ///< The used source color format
 	Common::Array<Color> _colors;  ///< The actual palette data


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