aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNicola Mettifogo2008-01-29 09:37:03 +0000
committerNicola Mettifogo2008-01-29 09:37:03 +0000
commit0e02a9398ab9208c89b70ff93c06dd3f2077470e (patch)
tree3a8ee7dd2125a986208c19b285a02427de620523 /engines
parentc4ad0a1c0d0053128e16ecbe739e33cdf9f57830 (diff)
downloadscummvm-rg350-0e02a9398ab9208c89b70ff93c06dd3f2077470e.tar.gz
scummvm-rg350-0e02a9398ab9208c89b70ff93c06dd3f2077470e.tar.bz2
scummvm-rg350-0e02a9398ab9208c89b70ff93c06dd3f2077470e.zip
Cleanup (step 2). No code outside Gfx reference screen buffers anymore.
svn-id: r30695
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/callables_ns.cpp4
-rw-r--r--engines/parallaction/graphics.cpp58
-rw-r--r--engines/parallaction/graphics.h15
-rw-r--r--engines/parallaction/gui_ns.cpp8
-rw-r--r--engines/parallaction/parallaction_ns.cpp2
5 files changed, 25 insertions, 62 deletions
diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp
index a493a41a29..fed4368aa1 100644
--- a/engines/parallaction/callables_ns.cpp
+++ b/engines/parallaction/callables_ns.cpp
@@ -538,7 +538,7 @@ void Parallaction_ns::_c_moveSheet(void *parm) {
r.top = 47;
r.right = (x + 32 > 319) ? 319 : (x + 32);
r.bottom = 199;
- _gfx->floodFill(Gfx::kBit2, r, 1);
+ _gfx->fillBackground(r, 1);
if (x >= 104) return;
@@ -546,7 +546,7 @@ void Parallaction_ns::_c_moveSheet(void *parm) {
r.top = 47;
r.right = (x + 247 > 319) ? 319 : (x + 247);
r.bottom = 199;
- _gfx->floodFill(Gfx::kBit2, r, 12);
+ _gfx->fillBackground(r, 12);
return;
}
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index c0a277dace..b290028300 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -382,40 +382,27 @@ void Gfx::updateScreen() {
//
// graphic primitives
//
-void Gfx::clearScreen(Gfx::Buffers buffer) {
- memset(_buffers[buffer]->pixels, 0, _vm->_screenSize);
+void Gfx::clearBackground() {
+ memset(_buffers[kBit2]->pixels, 0, _vm->_screenSize);
}
void Gfx::patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask) {
- if (mask) {
- uint16 z = queryMask(y);
- blitCnv(&surf, x, y, z);
- } else {
- flatBlitCnv(&surf, x, y);
- }
+ Common::Rect r(surf.w, surf.h);
+ r.moveTo(x, y);
+ uint16 z = (mask) ? queryMask(y) : BUFFER_FOREGROUND;
+ blt(r, (byte*)surf.pixels, _buffers[kBit2], z, 0);
}
-void Gfx::floodFill(Gfx::Buffers buffer, const Common::Rect& r, byte color) {
-
- byte *d = (byte*)_buffers[buffer]->getBasePtr(r.left, r.top);
- uint16 w = r.width() + 1;
- uint16 h = r.height() + 1;
-
- for (uint16 i = 0; i < h; i++) {
- memset(d, color, w);
-
- d += _backgroundWidth;
- }
-
- return;
+void Gfx::fillBackground(const Common::Rect& r, byte color) {
+ _buffers[kBit2]->fillRect(r, color);
}
-void Gfx::invertRect(Gfx::Buffers buffer, const Common::Rect& r) {
+void Gfx::invertBackground(const Common::Rect& r) {
- byte *d = (byte*)_buffers[buffer]->getBasePtr(r.left, r.top);
+ byte *d = (byte*)_buffers[kBit2]->getBasePtr(r.left, r.top);
for (int i = 0; i < r.height(); i++) {
for (int j = 0; j < r.width(); j++) {
@@ -423,7 +410,7 @@ void Gfx::invertRect(Gfx::Buffers buffer, const Common::Rect& r) {
d++;
}
- d += (_buffers[buffer]->pitch - r.width());
+ d += (_buffers[kBit2]->pitch - r.width());
}
}
@@ -672,23 +659,6 @@ void Label::resetPosition() {
}
-
-void Gfx::flatBlitCnv(Graphics::Surface *cnv, int16 x, int16 y) {
- Common::Rect r(cnv->w, cnv->h);
- r.moveTo(x, y);
-
- blt(r, (byte*)cnv->pixels, _buffers[kBit2], BUFFER_FOREGROUND, 0);
-}
-
-
-void Gfx::blitCnv(Graphics::Surface *cnv, int16 x, int16 y, uint16 z) {
- Common::Rect r(cnv->w, cnv->h);
- r.moveTo(x, y);
-
- blt(r, (byte*)cnv->pixels, _buffers[kBit2], z, 0);
-}
-
-
void Gfx::getStringExtent(char *text, uint16 maxwidth, int16* width, int16* height) {
uint16 lines = 0;
@@ -762,9 +732,9 @@ void Gfx::copyRect(uint width, uint height, byte *dst, uint dstPitch, byte *src,
return;
}
-void Gfx::grabRect(byte *dst, const Common::Rect& r, Gfx::Buffers srcbuffer, uint16 pitch) {
- byte *s = (byte*)_buffers[srcbuffer]->getBasePtr(r.left, r.top);
- copyRect(r.width(), r.height(), dst, pitch, s, _backgroundWidth);
+void Gfx::grabBackground(const Common::Rect& r, Graphics::Surface &dst) {
+ byte *s = (byte*)_buffers[kBit2]->getBasePtr(r.left, r.top);
+ copyRect(r.width(), r.height(), (byte*)dst.pixels, dst.pitch, s, _backgroundWidth);
return;
}
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index eb8108544c..b5d5b71a9c 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -398,10 +398,10 @@ public:
void freeItems();
// low level surfaces
- void clearScreen(Gfx::Buffers buffer);
- void grabRect(byte *dst, const Common::Rect& r, Gfx::Buffers srcbuffer, uint16 pitch);
- void floodFill(Gfx::Buffers buffer, const Common::Rect& r, byte color);
- void invertRect(Gfx::Buffers buffer, const Common::Rect& r);
+ void clearBackground();
+ void grabBackground(const Common::Rect& r, Graphics::Surface &dst);
+ void fillBackground(const Common::Rect& r, byte color);
+ void invertBackground(const Common::Rect& r);
// palette
void setPalette(Palette palette);
@@ -481,9 +481,6 @@ protected:
void drawItems();
void drawBalloons();
- void initBuffers(int w, int h);
- void freeBuffers();
-
void copyRect(uint width, uint height, byte *dst, uint dstPitch, byte *src, uint srcPitch);
int createBalloon(int16 w, int16 h, int16 winding, uint16 borderThickness);
@@ -494,10 +491,6 @@ protected:
void drawText(Graphics::Surface* surf, uint16 x, uint16 y, const char *text, byte color);
bool drawWrappedText(Graphics::Surface* surf, char *text, byte color, int16 wrapwidth);
-
- void flatBlitCnv(Graphics::Surface *cnv, int16 x, int16 y);
- void blitCnv(Graphics::Surface *cnv, int16 x, int16 y, uint16 z);
-
void blt(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, byte transparentColor);
};
diff --git a/engines/parallaction/gui_ns.cpp b/engines/parallaction/gui_ns.cpp
index 8bdc71514c..d01e2f274c 100644
--- a/engines/parallaction/gui_ns.cpp
+++ b/engines/parallaction/gui_ns.cpp
@@ -365,11 +365,11 @@ int Parallaction_ns::guiGetSelectedBlock(const Common::Point &p) {
}
if ((selection != -1) && (getPlatform() == Common::kPlatformAmiga)) {
- _gfx->invertRect(Gfx::kBit2, codeTrueBlocks[selection]);
+ _gfx->invertBackground(codeTrueBlocks[selection]);
_gfx->updateScreen();
beep();
g_system->delayMillis(100);
- _gfx->invertRect(Gfx::kBit2, codeTrueBlocks[selection]);
+ _gfx->invertBackground(codeTrueBlocks[selection]);
_gfx->updateScreen();
}
@@ -404,7 +404,7 @@ int Parallaction_ns::guiSelectCharacter() {
Graphics::Surface v14;
v14.create(BLOCK_WIDTH * 8, BLOCK_HEIGHT, 1);
Common::Rect rect(SLOT_X, SLOT_Y, SLOT_X + BLOCK_WIDTH * 8, SLOT_Y + BLOCK_HEIGHT);
- _gfx->grabRect((byte*)v14.pixels, rect, Gfx::kBit2, rect.width());
+ _gfx->grabBackground(rect, v14);
Graphics::Surface block;
block.create(BLOCK_WIDTH, BLOCK_HEIGHT, 1);
@@ -426,7 +426,7 @@ int Parallaction_ns::guiSelectCharacter() {
int _si = guiGetSelectedBlock(_mousePos);
if (_si != -1) {
- _gfx->grabRect((byte*)block.pixels, codeTrueBlocks[_si], Gfx::kBit2, BLOCK_WIDTH);
+ _gfx->grabBackground(codeTrueBlocks[_si], block);
_gfx->patchBackground(block, _di * SLOT_WIDTH + SLOT_X, SLOT_Y, false);
if (keys[0][_di] == _si) {
diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp
index 54bbc088e2..fa7fc11237 100644
--- a/engines/parallaction/parallaction_ns.cpp
+++ b/engines/parallaction/parallaction_ns.cpp
@@ -248,7 +248,7 @@ void Parallaction_ns::switchBackground(const char* background, const char* mask)
uint16 v2 = 0;
if (!scumm_stricmp(background, "final")) {
- _gfx->clearScreen(Gfx::kBit2);
+ _gfx->clearBackground();
for (uint16 _si = 0; _si < 32; _si++) {
pal.setEntry(_si, v2, v2, v2);
v2 += 4;