aboutsummaryrefslogtreecommitdiff
path: root/engines/cine
diff options
context:
space:
mode:
authorJohannes Schickel2010-01-31 18:29:54 +0000
committerJohannes Schickel2010-01-31 18:29:54 +0000
commit420569626c84be5242237125745a117a6ff9a8b9 (patch)
tree314eaa036205a8079d98a497b72e1d2b2854fb5e /engines/cine
parent3dd46d50f53e05548156d6abe43eeb025c4ed82f (diff)
downloadscummvm-rg350-420569626c84be5242237125745a117a6ff9a8b9.tar.gz
scummvm-rg350-420569626c84be5242237125745a117a6ff9a8b9.tar.bz2
scummvm-rg350-420569626c84be5242237125745a117a6ff9a8b9.zip
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
Diffstat (limited to 'engines/cine')
-rw-r--r--engines/cine/pal.cpp6
-rw-r--r--engines/cine/pal.h7
2 files changed, 8 insertions, 5 deletions
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<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() {
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