[Scummvm-cvs-logs] CVS: scummvm/gui newgui.cpp,1.36,1.37 newgui.h,1.20,1.21
Max Horn
fingolfin at users.sourceforge.net
Sat Dec 14 08:08:02 CET 2002
Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv26488/gui
Modified Files:
newgui.cpp newgui.h
Log Message:
make alpha blend level adjustable, and fixed an overflow bug
Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- newgui.cpp 13 Dec 2002 23:34:07 -0000 1.36
+++ newgui.cpp 14 Dec 2002 16:07:26 -0000 1.37
@@ -315,24 +315,23 @@
}
}
-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;
}
Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- newgui.h 12 Dec 2002 23:22:48 -0000 1.20
+++ newgui.h 14 Dec 2002 16:07:26 -0000 1.21
@@ -128,7 +128,7 @@
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);
More information about the Scummvm-git-logs
mailing list