From 420569626c84be5242237125745a117a6ff9a8b9 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 31 Jan 2010 18:29:54 +0000 Subject: Fix return of a reference to a temporary object introduced with r47766. (Hopefully this "workaround" will work also for Chrilith's compiler ;-). svn-id: r47771 --- engines/cine/pal.cpp | 6 ++---- engines/cine/pal.h | 7 ++++++- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'engines/cine') diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp index 3602187352..88b7f9ef6d 100644 --- a/engines/cine/pal.cpp +++ b/engines/cine/pal.cpp @@ -244,7 +244,7 @@ Palette &Palette::saturatedAddColor(Palette &output, byte firstIndex, byte lastI // 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 @@ Palette &Palette::saturatedAddNormalizedGray(Palette &output, byte firstIndex, b } // 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(baseColor.r + r, 0, _format.rMax()); result.g = CLIP(baseColor.g + g, 0, _format.gMax()); result.b = CLIP(baseColor.b + b, 0, _format.bMax()); - return result; } Palette::Palette(const Graphics::PixelFormat format, const uint numColors) : _format(format), _colors() { diff --git a/engines/cine/pal.h b/engines/cine/pal.h index 57dbea5d62..c8c1ad62a5 100644 --- a/engines/cine/pal.h +++ b/engines/cine/pal.h @@ -186,7 +186,12 @@ public: 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 -- cgit v1.2.3