aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-06-05 23:55:57 +0000
committerMax Horn2003-06-05 23:55:57 +0000
commit6f9b34df1e7897f490e24f768e7e942cb105193a (patch)
treec932c9fb3cc56d00bc799030c55a2446d1887dfa
parentba81aa9f769881176bf49cbd68e3813e40804b71 (diff)
downloadscummvm-rg350-6f9b34df1e7897f490e24f768e7e942cb105193a.tar.gz
scummvm-rg350-6f9b34df1e7897f490e24f768e7e942cb105193a.tar.bz2
scummvm-rg350-6f9b34df1e7897f490e24f768e7e942cb105193a.zip
unified some code
svn-id: r8339
-rw-r--r--scumm/gfx.cpp101
1 files changed, 37 insertions, 64 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index 934cefcea6..73dbf90e2c 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -1056,7 +1056,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi
}
}
if (left <= theX && theX < right) {
- dst -= height * _vm->_screenWidth - 1;
+ dst -= _vertStripNextInc;
}
}
@@ -1073,45 +1073,30 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi
theX = 0;
}
while (theX < right) {
- if (run & 0x80) {
+ const byte runFlag = run & 0x80;
+ if (runFlag) {
run &= 0x7f;
data = *src++;
- do {
- if (left <= theX) {
- *mask_ptr = data;
- mask_ptr += _numStrips;
- }
- theY++;
- if (theY >= height) {
- if (left <= theX) {
- mask_ptr -= height * _numStrips - 1;
- }
- theY = 0;
- theX += 8;
- if (theX >= right)
- break;
- }
- } while (--run);
- } else {
- do {
+ }
+ do {
+ if (!runFlag)
data = *src++;
-
+
+ if (left <= theX) {
+ *mask_ptr = data;
+ mask_ptr += _numStrips;
+ }
+ theY++;
+ if (theY >= height) {
if (left <= theX) {
- *mask_ptr = data;
- mask_ptr += _numStrips;
- }
- theY++;
- if (theY >= height) {
- if (left <= theX) {
- mask_ptr -= _numStrips * height - 1;
- }
- theY = 0;
- theX += 8;
- if (theX >= right)
- break;
+ mask_ptr -= _numStrips * height - 1;
}
- } while (--run);
- }
+ theY = 0;
+ theX += 8;
+ if (theX >= right)
+ break;
+ }
+ } while (--run);
run = *src++;
}
}
@@ -1318,38 +1303,26 @@ StripTable *Gdi::generateStripTable(const byte *src, int width, int height, Stri
for (;;) {
length = *src++;
- if (length & 0x80) {
+ const byte runFlag = length & 0x80;
+ if (runFlag) {
length &= 0x7f;
data = *src++;
- do {
- if (y == height) {
- assert(x < 120);
- table->zoffsets[x] = src - bitmapStart - 1;
- table->zrun[x] = length | 0x80;
- }
- if (--y == 0) {
- if (--width == 0)
- return table;
- x++;
- y = height;
- }
- } while (--length);
- } else {
- do {
- data = *src++;
- if (y == height) {
- assert(x < 120);
- table->zoffsets[x] = src - bitmapStart - 1;
- table->zrun[x] = length;
- }
- if (--y == 0) {
- if (--width == 0)
- return table;
- x++;
- y = height;
- }
- } while (--length);
}
+ do {
+ if (!runFlag)
+ data = *src++;
+ if (y == height) {
+ assert(x < 120);
+ table->zoffsets[x] = src - bitmapStart - 1;
+ table->zrun[x] = length | runFlag;
+ }
+ if (--y == 0) {
+ if (--width == 0)
+ return table;
+ x++;
+ y = height;
+ }
+ } while (--length);
}
return table;