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 | |
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')
-rw-r--r-- | gui/newgui.cpp | 21 | ||||
-rw-r--r-- | gui/newgui.h | 2 |
2 files changed, 11 insertions, 12 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; } diff --git a/gui/newgui.h b/gui/newgui.h index 7c5dba1ae8..90de55a933 100644 --- a/gui/newgui.h +++ b/gui/newgui.h @@ -128,7 +128,7 @@ public: int16 *getBasePtr(int x, int y); void box(int x, int y, int width, int height, bool inverted = false); void line(int x, int y, int x2, int y2, int16 color); - void blendRect(int x, int y, int w, int h, int16 color); + void blendRect(int x, int y, int w, int h, int16 color, int level = 3); void fillRect(int x, int y, int w, int h, int16 color); void checkerRect(int x, int y, int w, int h, int16 color); void frameRect(int x, int y, int w, int h, int16 color); |