[Scummvm-cvs-logs] CVS: scummvm/saga gfx.cpp,1.22,1.23 gfx.h,1.6,1.7
Jonathan Gray
khalek at users.sourceforge.net
Mon Aug 2 04:29:02 CEST 2004
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18808
Modified Files:
gfx.cpp gfx.h
Log Message:
move static vars to private members
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- gfx.cpp 1 Aug 2004 11:48:53 -0000 1.22
+++ gfx.cpp 2 Aug 2004 11:27:50 -0000 1.23
@@ -35,11 +35,6 @@
namespace Saga {
-static R_GFX_MODULE GfxModule;
-static OSystem *_system;
-
-static byte cur_pal[R_PAL_ENTRIES * 4];
-
Gfx::Gfx(OSystem *system, int width, int height) {
R_SURFACE r_back_buf;
@@ -59,10 +54,10 @@
r_back_buf.clip_rect.bottom = height - 1;
// Set module data
- GfxModule.r_back_buf = r_back_buf;
- GfxModule.init = 1;
- GfxModule.white_index = -1;
- GfxModule.black_index = -1;
+ _back_buf = r_back_buf;
+ _init = 1;
+ _white_index = -1;
+ _black_index = -1;
// For now, always show the mouse cursor.
setCursor(1);
@@ -815,15 +810,15 @@
}
R_SURFACE *Gfx::getBackBuffer() {
- return &GfxModule.r_back_buf;
+ return &_back_buf;
}
int Gfx::getWhite(void) {
- return GfxModule.white_index;
+ return _white_index;
}
int Gfx::getBlack(void) {
- return GfxModule.black_index;
+ return _black_index;
}
int Gfx::matchColor(unsigned long colormask) {
@@ -839,7 +834,7 @@
int best_index = 0;
byte *ppal;
- for (i = 0, ppal = cur_pal; i < R_PAL_ENTRIES; i++, ppal += 4) {
+ for (i = 0, ppal = _cur_pal; i < R_PAL_ENTRIES; i++, ppal += 4) {
dr = ppal[0] - red;
dr = ABS(dr);
dg = ppal[1] - green;
@@ -875,7 +870,7 @@
int i;
byte *ppal;
- for (i = 0, ppal = cur_pal; i < R_PAL_ENTRIES; i++, ppal += 4) {
+ for (i = 0, ppal = _cur_pal; i < R_PAL_ENTRIES; i++, ppal += 4) {
red = pal[i].red;
ppal[0] = red;
color_delta = red;
@@ -901,15 +896,15 @@
// When the palette changes, make sure the cursor colours are still
// correct. We may have to reconsider this code later, but for now
// there is only one cursor image.
- if (GfxModule.white_index != best_windex) {
+ if (_white_index != best_windex) {
setCursor(best_windex);
}
// Set whitest and blackest color indices
- GfxModule.white_index = best_windex;
- GfxModule.black_index = best_bindex;
+ _white_index = best_windex;
+ _black_index = best_bindex;
- _system->setPalette(cur_pal, 0, R_PAL_ENTRIES);
+ _system->setPalette(_cur_pal, 0, R_PAL_ENTRIES);
return R_SUCCESS;
}
@@ -918,7 +913,7 @@
int i;
byte *ppal;
- for (i = 0, ppal = cur_pal; i < R_PAL_ENTRIES; i++, ppal += 4) {
+ for (i = 0, ppal = _cur_pal; i < R_PAL_ENTRIES; i++, ppal += 4) {
src_pal[i].red = ppal[0];
src_pal[i].green = ppal[1];
src_pal[i].blue = ppal[2];
@@ -945,7 +940,7 @@
fpercent = 1.0 - fpercent;
// Use the correct percentage change per frame for each palette entry
- for (i = 0, ppal = cur_pal; i < R_PAL_ENTRIES; i++, ppal += 4) {
+ for (i = 0, ppal = _cur_pal; i < R_PAL_ENTRIES; i++, ppal += 4) {
new_entry = (int)(src_pal[i].red * fpercent);
if (new_entry < 0) {
@@ -972,7 +967,7 @@
ppal[3] = 0;
}
- _system->setPalette(cur_pal, 0, R_PAL_ENTRIES);
+ _system->setPalette(_cur_pal, 0, R_PAL_ENTRIES);
return R_SUCCESS;
}
@@ -998,7 +993,7 @@
fpercent = 1.0 - fpercent;
// Use the correct percentage change per frame for each palette entry
- for (i = 0, ppal = cur_pal; i < R_PAL_ENTRIES; i++, ppal += 4) {
+ for (i = 0, ppal = _cur_pal; i < R_PAL_ENTRIES; i++, ppal += 4) {
new_entry = (int)(src_pal[i].red - src_pal[i].red * fpercent);
if (new_entry < 0) {
@@ -1027,7 +1022,7 @@
// Find the best white and black color indices again
if (percent >= 1.0) {
- for (i = 0, ppal = cur_pal; i < R_PAL_ENTRIES; i++, ppal += 4) {
+ for (i = 0, ppal = _cur_pal; i < R_PAL_ENTRIES; i++, ppal += 4) {
color_delta = ppal[0];
color_delta += ppal[1];
color_delta += ppal[2];
@@ -1047,11 +1042,11 @@
// When the palette changes, make sure the cursor colours are still
// correct. We may have to reconsider this code later, but for now
// there is only one cursor image.
- if (GfxModule.white_index != best_windex) {
+ if (_white_index != best_windex) {
setCursor(best_windex);
}
- _system->setPalette(cur_pal, 0, R_PAL_ENTRIES);
+ _system->setPalette(_cur_pal, 0, R_PAL_ENTRIES);
return R_SUCCESS;
}
Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- gfx.h 1 Aug 2004 11:48:53 -0000 1.6
+++ gfx.h 2 Aug 2004 11:27:50 -0000 1.7
@@ -81,15 +81,6 @@
#define R_GREEN_WEIGHT 0.587
#define R_BLUE_WEIGHT 0.114
-struct R_GFX_MODULE {
- int init;
-
- R_SURFACE r_back_buf;
-
- int white_index;
- int black_index;
-};
-
class Gfx {
public:
int simpleBlit(R_SURFACE *dst_s, R_SURFACE *src_s);
@@ -115,6 +106,12 @@
int blackToPal(R_SURFACE *surface, PALENTRY *src_pal, double percent);
private:
void setCursor(int best_white);
+ int _init;
+ R_SURFACE _back_buf;
+ int _white_index;
+ int _black_index;
+ byte _cur_pal[R_PAL_ENTRIES * 4];
+ OSystem *_system;
};
} // End of namespace Saga
More information about the Scummvm-git-logs
mailing list