diff options
author | Eugene Sandulenko | 2015-12-18 19:02:19 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2015-12-27 15:40:53 +0100 |
commit | 9ae6992c7c8b9479d2c0dc7fd238f07e7cf37dab (patch) | |
tree | f45099f45c9d1fb57e5d71a467f2c09e344bb15f /engines | |
parent | f483bc0d83c5039207f43a4d342890c2c2de4f71 (diff) | |
download | scummvm-rg350-9ae6992c7c8b9479d2c0dc7fd238f07e7cf37dab.tar.gz scummvm-rg350-9ae6992c7c8b9479d2c0dc7fd238f07e7cf37dab.tar.bz2 scummvm-rg350-9ae6992c7c8b9479d2c0dc7fd238f07e7cf37dab.zip |
WAGE: Switched rectangle drawing to general code
Diffstat (limited to 'engines')
-rw-r--r-- | engines/wage/design.cpp | 39 | ||||
-rw-r--r-- | engines/wage/design.h | 3 |
2 files changed, 17 insertions, 25 deletions
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp index 8ce9805ca4..f4d9299e4c 100644 --- a/engines/wage/design.cpp +++ b/engines/wage/design.cpp @@ -144,7 +144,20 @@ void Design::drawRect(Graphics::Surface *surface, Common::ReadStream &in, bool m } fillType = 7; Common::Rect inner(x1 + borderThickness, y1 + borderThickness, x2 - borderThickness, y2 - borderThickness); - patternThickRect(surface, patterns, outer, inner, borderFillType, fillType); + + plotData pd; + + pd.surface = surface; + pd.patterns = &patterns; + pd.fillType = borderFillType; + pd.x0 = x1; + pd.y0 = y1; + + drawFilledRect(outer, kColorBlack, drawPixel, &pd); + + pd.fillType = fillType; + + drawFilledRect(inner, kColorBlack, drawPixel, &pd); } void Design::drawPolygon(Graphics::Surface *surface, Common::ReadStream &in, bool mask, @@ -324,15 +337,9 @@ void Design::drawBitmap(Graphics::Surface *surface, Common::ReadStream &in, bool } } -void Design::patternThickRect(Graphics::Surface *surface, Patterns &patterns, Common::Rect &outer, - Common::Rect &inner, byte borderFillType, byte fillType) { - patternRect(surface, patterns, outer, borderFillType); - patternRect(surface, patterns, inner, fillType); -} - -void Design::patternRect(Graphics::Surface *surface, Patterns &patterns, Common::Rect &rect, byte fillType) { +void Design::drawFilledRect(Common::Rect &rect, int color, void (*plotProc)(int, int, int, void *), void *data) { for (int y = rect.top; y < rect.bottom; y++) - patternHLine(surface, patterns, fillType, rect.left, rect.right, y, rect.left, rect.top); + drawHLine(rect.left, rect.right, y, color, plotProc, data); } @@ -443,20 +450,6 @@ void Design::drawHLine(int x1, int x2, int y, int color, void (*plotProc)(int, i (*plotProc)(x, y, color, data); } -void Design::patternHLine(Graphics::Surface *surface, Patterns &patterns, byte fillType, int x1, int x2, int y, int x0, int y0) { - if (x1 > x2) - SWAP(x1, x2); - - if (fillType > patterns.size()) - return; - - for (int x = x1; x < x2; x++) - if (x >= 0 && x < surface->w && y >= 0 && y < surface->h) - *((byte *)surface->getBasePtr(x, y)) = - (patterns[fillType - 1][(y - y0) % 8] & (1 << (7 - (x - x0) % 8))) ? - kColorBlack : kColorWhite; -} - void Design::patternVLine(Graphics::Surface *surface, Patterns &patterns, byte fillType, int x, int y1, int y2, int x0, int y0) { if (y1 > y2) SWAP(y1, y2); diff --git a/engines/wage/design.h b/engines/wage/design.h index 4bc781acfe..2da3b6e201 100644 --- a/engines/wage/design.h +++ b/engines/wage/design.h @@ -93,12 +93,11 @@ private: void patternThickRect(Graphics::Surface *surface, Patterns &patterns, Common::Rect &outer, Common::Rect &inner, byte borderFillType, byte fillType); - void patternRect(Graphics::Surface *surface, Patterns &patterns, Common::Rect &rect, byte fillType); + void drawFilledRect(Common::Rect &rect, int color, void (*plotProc)(int, int, int, void *), void *data); void drawPolygonScan(int *polyX, int *polyY, int npoints, Common::Rect &bbox, int color, void (*plotProc)(int, int, int, void *), void *data); void drawFilledEllipse(int x0, int y0, int x1, int y1, void (*plotProc)(int, int, int, void *), void *data); void drawHLine(int x1, int x2, int y, int color, void (*plotProc)(int, int, int, void *), void *data); - void patternHLine(Graphics::Surface *surface, Patterns &patterns, byte fillType, int x1, int x2, int y, int x0, int y0); void patternVLine(Graphics::Surface *surface, Patterns &patterns, byte fillType, int x, int y1, int y2, int x0, int y0); void drawThickLine (int x1, int y1, int x2, int y2, int thick, int color, void (*plotProc)(int, int, int, void *), void *data); |