aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNicola Mettifogo2007-03-13 23:30:36 +0000
committerNicola Mettifogo2007-03-13 23:30:36 +0000
commitb1abd5e6ca4b6166406d5e003e9f7dedeaa7dd56 (patch)
treecea8727e2d79682d64f99ce90150777819ac7bb0 /engines
parentf447d9d38fc5676db08757819cfdbde0279601ab (diff)
downloadscummvm-rg350-b1abd5e6ca4b6166406d5e003e9f7dedeaa7dd56.tar.gz
scummvm-rg350-b1abd5e6ca4b6166406d5e003e9f7dedeaa7dd56.tar.bz2
scummvm-rg350-b1abd5e6ca4b6166406d5e003e9f7dedeaa7dd56.zip
enforced use of Common::Rect on all graphic routines
svn-id: r26128
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/graphics.cpp43
-rw-r--r--engines/parallaction/graphics.h7
-rw-r--r--engines/parallaction/intro.cpp20
-rw-r--r--engines/parallaction/inventory.cpp8
-rw-r--r--engines/parallaction/location.cpp8
-rw-r--r--engines/parallaction/menu.cpp5
6 files changed, 58 insertions, 33 deletions
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 056e683bec..89852312b9 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -110,8 +110,16 @@ byte _resBalloon[2][BALLOON_WIDTH*BALLOON_HEIGHT] = {
void Gfx::drawBalloon(const Common::Rect& r, uint16 winding) {
// printf("Gfx::drawBalloon(%i, %i, %i, %i, %i)...", left, top, width, height, winding);
- floodFill(0, r.left, r.top, r.right+5, r.bottom, kBitFront);
- floodFill(1, r.left+1, r.top+2, r.right+5-1, r.bottom-1, kBitFront);
+ Common::Rect q = r;
+
+ q.right += 5;
+ floodFill(kBitFront, q, 0);
+
+ q.left++;
+ q.top+=2;
+ q.right--;
+ q.bottom--;
+ floodFill(kBitFront, q, 1);
winding = (winding == 0 ? 1 : 0);
byte *s = _resBalloon[winding];
@@ -330,12 +338,12 @@ void Gfx::copyRect(Gfx::Buffers srcbuffer, uint16 sx, uint16 sy, Gfx::Buffers ds
}
*/
-void Gfx::floodFill(byte color, uint16 left, uint16 top, uint16 right, uint16 bottom, Gfx::Buffers buffer) {
+void Gfx::floodFill(Gfx::Buffers buffer, const Common::Rect& r, byte color) {
// printf("Gfx::floodFill(%i, %i, %i, %i, %i)\n", color, left, top, right, bottom);
- byte *d = _buffers[buffer] + (left + top * SCREEN_WIDTH);
- uint16 w = right - left + 1;
- uint16 h = bottom - top + 1;
+ byte *d = _buffers[buffer] + (r.left + r.top * SCREEN_WIDTH);
+ uint16 w = r.width() + 1;
+ uint16 h = r.height() + 1;
for (uint16 i = 0; i < h; i++) {
memset(d, color, w);
@@ -809,10 +817,13 @@ void Gfx::restoreBackground(const Common::Rect& r) {
if (left+width >= SCREEN_WIDTH) width = SCREEN_WIDTH - left;
if (top+height >= SCREEN_HEIGHT) height = SCREEN_HEIGHT - top;
+ Common::Rect q(width, height);
+ q.moveTo(left, top);
+
copyRect(
kBitBack,
- left, top, width, height,
- _buffers[kBit2] + left + top * SCREEN_WIDTH,
+ q,
+ _buffers[kBit2] + q.left + q.top * SCREEN_WIDTH,
SCREEN_WIDTH
);
@@ -943,13 +954,13 @@ void Gfx::setMask(byte *mask) {
-void Gfx::copyRect(Gfx::Buffers dstbuffer, uint16 x, uint16 y, uint16 w, uint16 h, byte *src, uint16 pitch) {
+void Gfx::copyRect(Gfx::Buffers dstbuffer, const Common::Rect& r, byte *src, uint16 pitch) {
- byte *d = _buffers[dstbuffer] + x + SCREEN_WIDTH * y;
+ byte *d = _buffers[dstbuffer] + r.left + SCREEN_WIDTH * r.top;
byte *s = src;
- for (uint16 _si = 0; _si < h; _si++) {
- memcpy(d, s, w);
+ for (uint16 _si = 0; _si < r.height(); _si++) {
+ memcpy(d, s, r.width());
s += pitch;
d += SCREEN_WIDTH;
@@ -959,12 +970,12 @@ void Gfx::copyRect(Gfx::Buffers dstbuffer, uint16 x, uint16 y, uint16 w, uint16
}
-void Gfx::grabRect(Gfx::Buffers srcbuffer, byte *dst, uint16 x, uint16 y, uint16 w, uint16 h, uint16 pitch) {
+void Gfx::grabRect(byte *dst, const Common::Rect& r, Gfx::Buffers srcbuffer, uint16 pitch) {
- byte *s = _buffers[srcbuffer] + x + SCREEN_WIDTH * y;
+ byte *s = _buffers[srcbuffer] + r.left + SCREEN_WIDTH * r.top;
- for (uint16 i = 0; i < h; i++) {
- memcpy(dst, s, w);
+ for (uint16 i = 0; i < r.height(); i++) {
+ memcpy(dst, s, r.width());
s += SCREEN_WIDTH;
dst += pitch;
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index ac5eee619d..58877aed2a 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -112,10 +112,9 @@ public:
void updateScreen();
void clearScreen(Gfx::Buffers buffer);
void copyScreen(Gfx::Buffers srcbuffer, Gfx::Buffers dstbuffer);
- void copyRect(Gfx::Buffers dstbuffer, uint16 x, uint16 y, uint16 w, uint16 h, byte *src, uint16 pitch);
- void grabRect(Gfx::Buffers srcbuffer, byte *dst, uint16 x, uint16 y, uint16 w, uint16 h, uint16 pitch);
- void drawBorder(Gfx::Buffers buffer, uint16 x, uint16 y, uint16 w, uint16 h, byte color);
- void floodFill(byte color, uint16 left, uint16 top, uint16 right, uint16 bottom, Gfx::Buffers buffer);
+ void copyRect(Gfx::Buffers dstbuffer, const Common::Rect& r, byte *src, uint16 pitch);
+ 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 flatBlitCnv(StaticCnv *cnv, int16 x, int16 y, Gfx::Buffers buffer, byte *unused);
void blitCnv(StaticCnv *cnv, int16 x, int16 y, uint16 z, Gfx::Buffers buffer, Gfx::Buffers mask);
diff --git a/engines/parallaction/intro.cpp b/engines/parallaction/intro.cpp
index fc7f0d0a98..94bc7d52ac 100644
--- a/engines/parallaction/intro.cpp
+++ b/engines/parallaction/intro.cpp
@@ -167,15 +167,23 @@ void _c_moveSheet(void *parm) {
if (x > 66)
x -= 16;
- uint16 _ax = (x + 32 > 319) ? 319 : (x + 32);
- _vm->_gfx->floodFill(1, x, 47, _ax, 199, Gfx::kBitBack);
- _vm->_gfx->floodFill(1, x, 47, _ax, 199, Gfx::kBit2);
+ Common::Rect r;
+
+ r.left = x;
+ r.top = 47;
+ r.right = (x + 32 > 319) ? 319 : (x + 32);
+ r.bottom = 199;
+ _vm->_gfx->floodFill(Gfx::kBitBack, r, 1);
+ _vm->_gfx->floodFill(Gfx::kBit2, r, 1);
if (x >= 104) return;
- _ax = (x + 247 > 319) ? 319 : (x + 247);
- _vm->_gfx->floodFill(12, x+215, 47, _ax, 199, Gfx::kBitBack);
- _vm->_gfx->floodFill(12, x+215, 47, _ax, 199, Gfx::kBit2);
+ r.left = x+215;
+ r.top = 47;
+ r.right = (x + 247 > 319) ? 319 : (x + 247);
+ r.bottom = 199;
+ _vm->_gfx->floodFill(Gfx::kBitBack, r, 12);
+ _vm->_gfx->floodFill(Gfx::kBit2, r, 12);
return;
}
diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp
index a71cf1aec0..e51a380d9f 100644
--- a/engines/parallaction/inventory.cpp
+++ b/engines/parallaction/inventory.cpp
@@ -268,12 +268,12 @@ void jobShowInventory(void *parm, Job *j) {
_numInvLines = (_numInvLines + 4) / INVENTORY_ITEMS_PER_LINE;
+ Common::Rect r(INVENTORY_WIDTH, _numInvLines * INVENTORYITEM_HEIGHT);
+ r.moveTo(_invPosition._x, _invPosition._y);
+
_vm->_gfx->copyRect(
Gfx::kBitBack,
- _invPosition._x,
- _invPosition._y,
- INVENTORY_WIDTH,
- _numInvLines * INVENTORYITEM_HEIGHT,
+ r,
_buffer,
INVENTORY_WIDTH
);
diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp
index c61ed61666..e0ee7b4a81 100644
--- a/engines/parallaction/location.cpp
+++ b/engines/parallaction/location.cpp
@@ -458,8 +458,12 @@ void Parallaction::doLocationEnterTransition() {
int16 v7C, v7A;
_vm->_gfx->getStringExtent(_vm->_location._comment, 130, &v7C, &v7A);
- _vm->_gfx->floodFill(0, 5, 5, 10 + v7C, 5 + v7A, Gfx::kBitFront);
- _vm->_gfx->floodFill(1, 6, 6, 9 + v7C, 4 + v7A, Gfx::kBitFront);
+
+ Common::Rect r(10 + v7C, 5 + v7A);
+ r.moveTo(5, 5);
+ _vm->_gfx->floodFill(Gfx::kBitFront, r, 0);
+ r.grow(-1);
+ _vm->_gfx->floodFill(Gfx::kBitFront, r, 1);
_vm->_gfx->displayWrappedString(_vm->_location._comment, 3, 5, 130, 0);
// FIXME: ???
diff --git a/engines/parallaction/menu.cpp b/engines/parallaction/menu.cpp
index 703b7fbab4..d1b3b96e79 100644
--- a/engines/parallaction/menu.cpp
+++ b/engines/parallaction/menu.cpp
@@ -327,7 +327,10 @@ void Menu::selectCharacter() {
if (!r.contains(x, y)) continue;
- _vm->_gfx->grabRect(Gfx::kBitFront, v14._data0, _si * BLOCK_X_OFFSET + BLOCK_X, BLOCK_Y - _si * BLOCK_Y_OFFSET, BLOCK_WIDTH, BLOCK_HEIGHT, BLOCK_WIDTH);
+ r.setWidth(BLOCK_WIDTH);
+ r.setHeight(BLOCK_HEIGHT);
+ r.moveTo(_si * BLOCK_X_OFFSET + BLOCK_X, BLOCK_Y - _si * BLOCK_Y_OFFSET);
+ _vm->_gfx->grabRect(v14._data0, r, Gfx::kBitFront, BLOCK_WIDTH);
_vm->_gfx->flatBlitCnv(&v14, _di * SLOT_WIDTH + SLOT_X, SLOT_Y, Gfx::kBitBack, 0);
_vm->_gfx->flatBlitCnv(&v14, _di * SLOT_WIDTH + SLOT_X, SLOT_Y, Gfx::kBitFront, 0);