aboutsummaryrefslogtreecommitdiff
path: root/gui/ThemeModern.cpp
diff options
context:
space:
mode:
authorMax Horn2007-02-10 18:09:13 +0000
committerMax Horn2007-02-10 18:09:13 +0000
commita14e90478c3e45a2fdc8eaf9edb975cf42fc5742 (patch)
tree36dfa4ddff2b3b67382f33c5e3031be39dcd4bd8 /gui/ThemeModern.cpp
parent9dbf7d271b081bec65e33f6c229447adeb39ec01 (diff)
downloadscummvm-rg350-a14e90478c3e45a2fdc8eaf9edb975cf42fc5742.tar.gz
scummvm-rg350-a14e90478c3e45a2fdc8eaf9edb975cf42fc5742.tar.bz2
scummvm-rg350-a14e90478c3e45a2fdc8eaf9edb975cf42fc5742.zip
Added small note to ThemeModern::calcLuminance
svn-id: r25472
Diffstat (limited to 'gui/ThemeModern.cpp')
-rw-r--r--gui/ThemeModern.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/gui/ThemeModern.cpp b/gui/ThemeModern.cpp
index 9b7df9ed59..8452c8a37d 100644
--- a/gui/ThemeModern.cpp
+++ b/gui/ThemeModern.cpp
@@ -1454,6 +1454,10 @@ OverlayColor ThemeModern::calcLuminance(OverlayColor col) {
uint8 r, g, b;
_system->colorToRGB(col, r, g, b);
+ // A better (but slower) formula to calculate the luminance would be:
+ //uint lum = (byte)((0.299 * r + 0.587 * g + 0.114 * b) + 0.5);
+ // Note that the approximation below will only produce values between
+ // (and including) 0 and 221.
uint lum = (r >> 2) + (g >> 1) + (b >> 3);
return _system->RGBToColor(lum, lum, lum);