diff options
author | Max Horn | 2002-12-14 16:07:26 +0000 |
---|---|---|
committer | Max Horn | 2002-12-14 16:07:26 +0000 |
commit | 9fee7b23264113f11fa6a6edfe9ff6154724fb7f (patch) | |
tree | dc5a43f858b2d66041f684d97613a2f709679763 /gui/newgui.cpp | |
parent | 29ea4a4c49714139d57422560487855711aebf64 (diff) | |
download | scummvm-rg350-9fee7b23264113f11fa6a6edfe9ff6154724fb7f.tar.gz scummvm-rg350-9fee7b23264113f11fa6a6edfe9ff6154724fb7f.tar.bz2 scummvm-rg350-9fee7b23264113f11fa6a6edfe9ff6154724fb7f.zip |
make alpha blend level adjustable, and fixed an overflow bug
svn-id: r5958
Diffstat (limited to 'gui/newgui.cpp')
-rw-r--r-- | gui/newgui.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/gui/newgui.cpp b/gui/newgui.cpp index 4b57bca753..ec7fb3802d 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -315,24 +315,23 @@ void NewGui::line(int x, int y, int x2, int y2, int16 color) } } -void NewGui::blendRect(int x, int y, int w, int h, int16 color) +void NewGui::blendRect(int x, int y, int w, int h, int16 color, int level) { - #define ALPHA_LEVEL 3 - uint8 r, g, b; + int r, g, b; uint8 ar, ag, ab; - _system->colorToRBG(color, r, g, b); - - r *= ALPHA_LEVEL; - g *= ALPHA_LEVEL; - b *= ALPHA_LEVEL; + _system->colorToRBG(color, ar, ag, ab); + r = ar * level; + g = ag * level; + b = ab * level; + int16 *ptr = getBasePtr(x, y); while (h--) { for (int i = 0; i < w; i++) { _system->colorToRBG(ptr[i], ar, ag, ab); - ptr[i] = _system->RBGToColor((ar+r)/(ALPHA_LEVEL+1), - (ag+g)/(ALPHA_LEVEL+1), - (ab+b)/(ALPHA_LEVEL+1)); + ptr[i] = _system->RBGToColor((ar+r)/(level+1), + (ag+g)/(level+1), + (ab+b)/(level+1)); } ptr += _screenPitch; } |