aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Percival2020-01-11 11:27:21 +0800
committerScott Percival2020-01-11 11:27:21 +0800
commitb31d5ac2b9efe04fa717f6c39b4ce1526b55fd19 (patch)
treecaa28efd10bb09b4b04fafdbca265db8998d0630
parentc56584724049a609a31f49890c5dd9bec2a085b4 (diff)
downloadscummvm-rg350-b31d5ac2b9efe04fa717f6c39b4ce1526b55fd19.tar.gz
scummvm-rg350-b31d5ac2b9efe04fa717f6c39b4ce1526b55fd19.tar.bz2
scummvm-rg350-b31d5ac2b9efe04fa717f6c39b4ce1526b55fd19.zip
DIRECTOR: Align fill patterns to global origin
-rw-r--r--engines/director/frame.cpp6
-rw-r--r--engines/director/score.cpp2
-rw-r--r--graphics/macgui/macwindowmanager.cpp6
-rw-r--r--graphics/macgui/macwindowmanager.h6
4 files changed, 11 insertions, 9 deletions
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 28be1c5fb7..71bbc348d3 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -727,8 +727,8 @@ void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteId) {
tmpSurface.clear(255);
// No minus one on the pattern here! MacPlotData will do that for us!
- //Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), 1, 1, sp->_backColor);
- Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), sp->getPattern(), lineSize, backColor);
+ //Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), 1, 0, 0, 1, sp->_backColor);
+ Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), sp->getPattern(), -shapeRect.left, -shapeRect.top, lineSize, backColor);
Common::Rect fillRect(MAX((int)shapeRect.width() - lineSize, 0), MAX((int)shapeRect.height() - lineSize, 0));
switch (spriteType) {
@@ -797,7 +797,7 @@ void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId) {
break;
case kTypeButton: {
_rect = Common::Rect(x, y, x + width, y + height + 3);
- Graphics::MacPlotData pd(&surface, &_vm->getMacWindowManager()->getPatterns(), Graphics::MacGUIConstants::kPatternSolid, 1, invert ? Graphics::kColorBlack : Graphics::kColorWhite);
+ Graphics::MacPlotData pd(&surface, &_vm->getMacWindowManager()->getPatterns(), Graphics::MacGUIConstants::kPatternSolid, 0, 0, 1, invert ? Graphics::kColorBlack : Graphics::kColorWhite);
Graphics::drawRoundRect(_rect, 4, 0, invert, Graphics::macDrawPixel, &pd);
addDrawRect(spriteId, _rect);
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 9cdc069ed2..8b600e5da5 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1518,7 +1518,7 @@ void Score::renderZoomBox(bool redraw) {
end = MIN(start + 3 - box->step % 2, 8);
}
- Graphics::MacPlotData pd(_surface, &_vm->_wm->getPatterns(), Graphics::kPatternCheckers, 1, 0);
+ Graphics::MacPlotData pd(_surface, &_vm->_wm->getPatterns(), Graphics::kPatternCheckers, 0, 0, 1, 0);
for (int i = start; i <= end; i++) {
Common::Rect r(box->start.left + (box->end.left - box->start.left) * i / 8,
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 12cd391f92..19448053a3 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -295,7 +295,7 @@ void macDrawPixel(int x, int y, int color, void *data) {
uint yu = (uint)y;
*((byte *)p->surface->getBasePtr(xu, yu)) =
- (pat[yu % 8] & (1 << (7 - xu % 8))) ?
+ (pat[(yu - p->fillOriginY) % 8] & (1 << (7 - (xu - p->fillOriginX) % 8))) ?
color : p->bgColor;
}
} else {
@@ -310,7 +310,7 @@ void macDrawPixel(int x, int y, int color, void *data) {
uint xu = (uint)x; // for letting compiler optimize it
uint yu = (uint)y;
*((byte *)p->surface->getBasePtr(xu, yu)) =
- (pat[yu % 8] & (1 << (7 - xu % 8))) ?
+ (pat[(yu - p->fillOriginY) % 8] & (1 << (7 - (xu - p->fillOriginX) % 8))) ?
color : p->bgColor;
}
}
@@ -319,7 +319,7 @@ void macDrawPixel(int x, int y, int color, void *data) {
void MacWindowManager::drawDesktop() {
Common::Rect r(_screen->getBounds());
- MacPlotData pd(_screen, &_patterns, kPatternCheckers, 1, _colorWhite);
+ MacPlotData pd(_screen, &_patterns, kPatternCheckers, 0, 0, 1, _colorWhite);
Graphics::drawRoundRect(r, kDesktopArc, _colorBlack, true, macDrawPixel, &pd);
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index c412e64f0a..5846bcba07 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -83,11 +83,13 @@ struct MacPlotData {
Graphics::ManagedSurface *surface;
MacPatterns *patterns;
uint fillType;
+ int fillOriginX;
+ int fillOriginY;
int thickness;
uint bgColor;
- MacPlotData(Graphics::ManagedSurface *s, MacPatterns *p, int f, int t, uint bg) :
- surface(s), patterns(p), fillType(f), thickness(t), bgColor(bg) {
+ MacPlotData(Graphics::ManagedSurface *s, MacPatterns *p, uint f, int fx, int fy, int t, uint bg) :
+ surface(s), patterns(p), fillType(f), fillOriginX(fx), fillOriginY(fy), thickness(t), bgColor(bg) {
}
};