[Scummvm-cvs-logs] SF.net SVN: scummvm:[39691] scummvm/trunk/engines/cine
buddha_ at users.sourceforge.net
buddha_ at users.sourceforge.net
Wed Mar 25 20:52:08 CET 2009
Revision: 39691
http://scummvm.svn.sourceforge.net/scummvm/?rev=39691&view=rev
Author: buddha_
Date: 2009-03-25 19:52:08 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
Cine::Palette::saturatedAddNormalizedGray: Use fractional representation (dividend/denominator) of the normalized gray value in range [-1, +1] rather than a floating point.
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 2009-03-25 17:51:22 UTC (rev 39690)
+++ scummvm/trunk/engines/cine/pal.cpp 2009-03-25 19:52:08 UTC (rev 39691)
@@ -257,12 +257,11 @@
return output;
}
-Palette &Palette::saturatedAddNormalizedGray(Palette& output, byte firstIndex, byte lastIndex, double normalizedGray) {
- // Calculate the gray value rounded up away from zero
- const double signedHalf = ((normalizedGray >= 0) ? +0.5 : -0.5);
- const signed r = (signed)(_rMax * normalizedGray + signedHalf);
- const signed g = (signed)(_gMax * normalizedGray + signedHalf);
- const signed b = (signed)(_bMax * normalizedGray + signedHalf);
+Palette &Palette::saturatedAddNormalizedGray(Palette& output, byte firstIndex, byte lastIndex, int grayDividend, int grayDenominator) {
+ assert(grayDenominator != 0);
+ const signed r = _rMax * grayDividend / grayDenominator;
+ const signed g = _gMax * grayDividend / grayDenominator;
+ const signed b = _bMax * grayDividend / grayDenominator;
return saturatedAddColor(output, firstIndex, lastIndex, r, g, b);
}
Modified: scummvm/trunk/engines/cine/pal.h
===================================================================
--- scummvm/trunk/engines/cine/pal.h 2009-03-25 17:51:22 UTC (rev 39690)
+++ scummvm/trunk/engines/cine/pal.h 2009-03-25 19:52:08 UTC (rev 39691)
@@ -116,7 +116,18 @@
Palette &rotateRight(byte firstIndex, byte lastIndex);
Palette &saturatedAddColor(Palette& output, byte firstIndex, byte lastIndex, signed r, signed g, signed b);
- Palette &saturatedAddNormalizedGray(Palette& output, byte firstIndex, byte lastIndex, double normalizedGray);
+
+ /*! \brief Saturated add a normalized gray value to current palette's subset and save the modified colors in the given output palette.
+ * \param output The output palette (Only this palette is modified)
+ * \param firstIndex First color index of the palette's subset (Inclusive range)
+ * \param lastIndex Last color index of the palette's subset (Inclusive range)
+ * \param grayDividend Dividend of the normalized gray value
+ * \param grayDenominator Denominator of the normalized gray value
+ * \note The normalized gray value (i.e. in range [-1, +1]) is given as a fractional number
+ * (i.e. the normalized gray value is calculated by dividing grayDividend by grayDenominator).
+ */
+ Palette &saturatedAddNormalizedGray(Palette& output, byte firstIndex, byte lastIndex, signed grayDividend, signed grayDenominator);
+
uint colorCount() const;
Palette &fillWithBlack();
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