[Scummvm-git-logs] scummvm master -> e604c9760739db24757bc0b7a0645aaf6f944d8b
sev-
sev at scummvm.org
Sat Aug 15 14:09:37 UTC 2020
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
22fc8da09e DIRECTOR: LINGO: Properly catch edge case
43c3407557 GRAPHICS: MACGUI: More work on making MacWindowBorder 32bpp-aware
e604c97607 GRAPHICS: MACGUI: Made MacDrawPixel bpp-aware
Commit: 22fc8da09e857977fc8a410307122df781a94242
https://github.com/scummvm/scummvm/commit/22fc8da09e857977fc8a410307122df781a94242
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-15T16:09:20+02:00
Commit Message:
DIRECTOR: LINGO: Properly catch edge case
Changed paths:
engines/director/lingo/lingo-the.cpp
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 559d1436d6..2ab707038f 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -1280,7 +1280,7 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
break;
case kTheConstraint:
{
- int channelId;
+ int channelId = -1;
if (d.type == CASTNAME || d.type == CASTNUM) {
// Reference: CastMember ID
// Find the first channel that uses this cast.
@@ -1294,7 +1294,7 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
} else {
channelId = d.asInt();
}
- if (channelId != (int)channel->_constraint) {
+ if (channelId != -1 && channelId != (int)channel->_constraint) {
channel->_constraint = d.u.i;
channel->_dirty = true;
}
Commit: 43c34075573c06c0c7756443f008c68a3a8fa952
https://github.com/scummvm/scummvm/commit/43c34075573c06c0c7756443f008c68a3a8fa952
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-15T16:09:20+02:00
Commit Message:
GRAPHICS: MACGUI: More work on making MacWindowBorder 32bpp-aware
Changed paths:
graphics/macgui/macwindow.cpp
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp
index e7a333c600..dc6353c361 100644
--- a/graphics/macgui/macwindow.cpp
+++ b/graphics/macgui/macwindow.cpp
@@ -177,14 +177,19 @@ bool MacWindow::draw(ManagedSurface *g, bool forceRedraw) {
return false;
g->blitFrom(*_composeSurface, Common::Rect(0, 0, _composeSurface->w, _composeSurface->h), Common::Point(_innerDims.left, _innerDims.top));
- g->transBlitFrom(_borderSurface, Common::Rect(0, 0, _borderSurface.w, _borderSurface.h), Common::Point(_dims.left, _dims.top), _wm->_colorGreen);
+
+ uint32 transcolor = (_wm->_pixelformat.bytesPerPixel == 1) ? _wm->_colorGreen : 0;
+
+ g->transBlitFrom(_borderSurface, Common::Rect(0, 0, _borderSurface.w, _borderSurface.h), Common::Point(_dims.left, _dims.top), transcolor);
return true;
}
void MacWindow::blit(ManagedSurface *g, Common::Rect &dest) {
// Only the inner surface is blitted here
- g->transBlitFrom(*_composeSurface, _composeSurface->getBounds(), dest, _wm->_colorGreen2);
+ uint32 transcolor = (_wm->_pixelformat.bytesPerPixel == 1) ? _wm->_colorGreen2 : 0;
+
+ g->transBlitFrom(*_composeSurface, _composeSurface->getBounds(), dest, transcolor);
}
void MacWindow::center(bool toCenter) {
@@ -295,20 +300,26 @@ void MacWindow::drawBorder() {
}
void MacWindow::prepareBorderSurface(ManagedSurface *g) {
- // We draw rect with outer _wm->_colorGreen2 and inner _wm->_colorGreen, so on 2 passes we cut out
- // scene by external shape of the border
- int sz = kBorderWidth / 2;
- int width = g->w;
- int height = g->h;
- g->clear(_wm->_colorGreen2);
- g->fillRect(Common::Rect(sz, sz, width - sz, height - sz), _wm->_colorGreen);
+ if (_wm->_pixelformat.bytesPerPixel == 1) {
+ // We draw rect with outer _wm->_colorGreen2 and inner _wm->_colorGreen, so on 2 passes we cut out
+ // scene by external shape of the border
+ int sz = kBorderWidth / 2;
+ int width = g->w;
+ int height = g->h;
+ g->clear(_wm->_colorGreen2);
+ g->fillRect(Common::Rect(sz, sz, width - sz, height - sz), _wm->_colorGreen);
+ } else {
+ g->clear(0); // Full transparency
+ }
}
void MacWindow::drawBorderFromSurface(ManagedSurface *g) {
- g->clear(_wm->_colorGreen2);
- Common::Rect inside = _innerDims;
- inside.moveTo(_macBorder.getOffset().left, _macBorder.getOffset().top);
- g->fillRect(inside, _wm->_colorGreen);
+ if (_wm->_pixelformat.bytesPerPixel == 1) {
+ g->clear(_wm->_colorGreen2);
+ Common::Rect inside = _innerDims;
+ inside.moveTo(_macBorder.getOffset().left, _macBorder.getOffset().top);
+ g->fillRect(inside, _wm->_colorGreen);
+ }
_macBorder.blitBorderInto(*g, _active, _wm);
}
Commit: e604c9760739db24757bc0b7a0645aaf6f944d8b
https://github.com/scummvm/scummvm/commit/e604c9760739db24757bc0b7a0645aaf6f944d8b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-15T16:09:20+02:00
Commit Message:
GRAPHICS: MACGUI: Made MacDrawPixel bpp-aware
Changed paths:
engines/director/graphics.cpp
engines/director/transitions.cpp
graphics/macgui/macbutton.cpp
graphics/macgui/macwindow.cpp
graphics/macgui/macwindowmanager.cpp
graphics/macgui/macwindowmanager.h
diff --git a/engines/director/graphics.cpp b/engines/director/graphics.cpp
index 23d1416de0..7d88fa5a45 100644
--- a/engines/director/graphics.cpp
+++ b/engines/director/graphics.cpp
@@ -847,7 +847,7 @@ void inkDrawPixel(int x, int y, int src, void *data) {
// Get the pixel that macDrawPixel will give us, but store it to apply the
// ink later.
tmpDst = *dst;
- Graphics::macDrawPixel(x, y, src, p->ms->pd);
+ (p->_wm->getDrawPixel())(x, y, src, p->ms->pd);
src = *dst;
*dst = tmpDst;
diff --git a/engines/director/transitions.cpp b/engines/director/transitions.cpp
index 8052e21410..879b1fc818 100644
--- a/engines/director/transitions.cpp
+++ b/engines/director/transitions.cpp
@@ -1020,10 +1020,10 @@ void Window::transZoom(TransParams &t, Common::Rect &clipRect, Graphics::Managed
r.moveTo(t.xStepSize * (i - s), t.yStepSize * (i - s));
}
- Graphics::drawLine(r.left, r.top, r.right, r.top, 0xffff, Graphics::macDrawPixel, &pd);
- Graphics::drawLine(r.right, r.top, r.right, r.bottom, 0xffff, Graphics::macDrawPixel, &pd);
- Graphics::drawLine(r.left, r.bottom, r.right, r.bottom, 0xffff, Graphics::macDrawPixel, &pd);
- Graphics::drawLine(r.left, r.top, r.left, r.bottom, 0xffff, Graphics::macDrawPixel, &pd);
+ Graphics::drawLine(r.left, r.top, r.right, r.top, 0xffff, _wm->getDrawPixel(), &pd);
+ Graphics::drawLine(r.right, r.top, r.right, r.bottom, 0xffff, _wm->getDrawPixel(), &pd);
+ Graphics::drawLine(r.left, r.bottom, r.right, r.bottom, 0xffff, _wm->getDrawPixel(), &pd);
+ Graphics::drawLine(r.left, r.top, r.left, r.bottom, 0xffff, _wm->getDrawPixel(), &pd);
}
r.setHeight(t.yStepSize * i * 2);
diff --git a/graphics/macgui/macbutton.cpp b/graphics/macgui/macbutton.cpp
index 33e3c1a55f..6721d57f2c 100644
--- a/graphics/macgui/macbutton.cpp
+++ b/graphics/macgui/macbutton.cpp
@@ -74,14 +74,14 @@ void MacButton::invertOuter() {
switch (_buttonType) {
case kCheckBox: {
Common::Rect c = Common::Rect(r.left + 1, r.top + 3, r.left + 9, r.top + 11);
- Graphics::drawRect(c, 0, Graphics::macDrawPixel, &_pd);
+ Graphics::drawRect(c, 0, _wm->getDrawPixel(), &_pd);
}
break;
case kRound:
- Graphics::drawRoundRect(r, 4, 0, true, Graphics::macDrawPixel, &_pd);
+ Graphics::drawRoundRect(r, 4, 0, true, _wm->getDrawPixel(), &_pd);
break;
case kRadio:
- Graphics::drawEllipse(r.left + 1, r.top + 3, r.left + 10, r.top + 12, 0, false, Graphics::macDrawPixel, &_pd);
+ Graphics::drawEllipse(r.left + 1, r.top + 3, r.left + 10, r.top + 12, 0, false, _wm->getDrawPixel(), &_pd);
break;
}
@@ -93,14 +93,14 @@ void MacButton::invertInner() {
switch (_buttonType) {
case kCheckBox:
- Graphics::drawLine(r.left + 1, r.top + 3, r.left + 9, r.top + 11, 0, Graphics::macDrawPixel, &_pd);
- Graphics::drawLine(r.left + 1, r.top + 11, r.left + 9, r.top + 3, 0, Graphics::macDrawPixel, &_pd);
- Graphics::macDrawPixel(5, 7, 0, &_pd);
+ Graphics::drawLine(r.left + 1, r.top + 3, r.left + 9, r.top + 11, 0, _wm->getDrawPixel(), &_pd);
+ Graphics::drawLine(r.left + 1, r.top + 11, r.left + 9, r.top + 3, 0, _wm->getDrawPixel(), &_pd);
+ (_wm->getDrawPixel())(5, 7, 0, &_pd);
break;
case kRound:
break;
case kRadio:
- Graphics::drawEllipse(r.left + 3, r.top + 5, r.left + 8, r.top + 10, 0, true, Graphics::macDrawPixel, &_pd);
+ Graphics::drawEllipse(r.left + 3, r.top + 5, r.left + 8, r.top + 10, 0, true, _wm->getDrawPixel(), &_pd);
break;
}
@@ -119,14 +119,14 @@ bool MacButton::draw(bool forceRedraw) {
switch (_buttonType) {
case kCheckBox: {
Common::Rect c = Common::Rect(r.left, r.top + 2, r.left + 10, r.top + 2 + 10);
- Graphics::drawRect(c, 0, Graphics::macDrawPixel, &pd);
+ Graphics::drawRect(c, 0, _wm->getDrawPixel(), &pd);
break;
}
case kRound:
- Graphics::drawRoundRect(r, 4, 0, _active, Graphics::macDrawPixel, &pd);
+ Graphics::drawRoundRect(r, 4, 0, _active, _wm->getDrawPixel(), &pd);
break;
case kRadio:
- Graphics::drawEllipse(r.left, r.top + 2, r.left + 11, r.top + 13, 0, false, Graphics::macDrawPixel, &pd);
+ Graphics::drawEllipse(r.left, r.top + 2, r.left + 11, r.top + 13, 0, false, _wm->getDrawPixel(), &pd);
break;
}
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp
index dc6353c361..9fbca2d54c 100644
--- a/graphics/macgui/macwindow.cpp
+++ b/graphics/macgui/macwindow.cpp
@@ -374,7 +374,7 @@ void MacWindow::drawSimpleBorder(ManagedSurface *g) {
Common::Rect rr(rx1, ry1, rx2, ry2);
MacPlotData pd(g, nullptr, &_wm->getPatterns(), 1, 0, 0, 1, _wm->_colorBlack, true);
- Graphics::drawFilledRect(rr, _wm->_colorBlack, Graphics::macDrawPixel, &pd);
+ Graphics::drawFilledRect(rr, _wm->_colorBlack, _wm->getDrawPixel(), &pd);
}
}
if (closeable) {
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 1a538cafab..6a65c23cac 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -401,6 +401,7 @@ void MacWindowManager::removeWindow(MacWindow *target) {
_activeWindow = -1;
}
+template<typename T>
void macDrawPixel(int x, int y, int color, void *data) {
MacPlotData *p = (MacPlotData *)data;
@@ -414,11 +415,11 @@ 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)) = p->invert ? ~(*((byte *)p->surface->getBasePtr(xu, yu))) :
+ *((T)p->surface->getBasePtr(xu, yu)) = p->invert ? ~(*((T)p->surface->getBasePtr(xu, yu))) :
(pat[(yu - p->fillOriginY) % 8] & (1 << (7 - (xu - p->fillOriginX) % 8))) ? color : p->bgColor;
if (p->mask)
- *((byte *)p->mask->getBasePtr(xu, yu)) = 0xff;
+ *((T)p->mask->getBasePtr(xu, yu)) = 0xff;
}
} else {
int x1 = x;
@@ -431,15 +432,22 @@ void macDrawPixel(int x, int y, int color, void *data) {
if (x >= 0 && x < p->surface->w && y >= 0 && y < p->surface->h) {
uint xu = (uint)x; // for letting compiler optimize it
uint yu = (uint)y;
- *((byte *)p->surface->getBasePtr(xu, yu)) = p->invert ? ~(*((byte *)p->surface->getBasePtr(xu, yu))) :
+ *((T)p->surface->getBasePtr(xu, yu)) = p->invert ? ~(*((T)p->surface->getBasePtr(xu, yu))) :
(pat[(yu - p->fillOriginY) % 8] & (1 << (7 - (xu - p->fillOriginX) % 8))) ? color : p->bgColor;
if (p->mask)
- *((byte *)p->mask->getBasePtr(xu, yu)) = 0xff;
+ *((T)p->mask->getBasePtr(xu, yu)) = 0xff;
}
}
}
+MacWindowManager::DrawPixPtr MacWindowManager::getDrawPixel() {
+ if (_pixelformat.bytesPerPixel == 1)
+ return &macDrawPixel<byte *>;
+ else
+ return &macDrawPixel<uint32 *>;
+}
+
void MacWindowManager::loadDesktop() {
Common::SeekableReadStream *file = getFile("scummvm_background.bmp");
if (!file)
@@ -481,7 +489,7 @@ void MacWindowManager::drawDesktop() {
MacPlotData pd(_desktop, nullptr, &_patterns, kPatternCheckers, 0, 0, 1, _colorWhite);
- Graphics::drawRoundRect(r, kDesktopArc, _colorBlack, true, macDrawPixel, &pd);
+ Graphics::drawRoundRect(r, kDesktopArc, _colorBlack, true, getDrawPixel(), &pd);
}
}
@@ -549,19 +557,24 @@ void MacWindowManager::draw() {
if (w->isDirty() || forceRedraw) {
w->draw(forceRedraw);
- Surface *surface = g_system->lockScreen();
- ManagedSurface *border = w->getBorderSurface();
-
adjustDimensions(clip, outerDims, adjWidth, adjHeight);
- for (int y = 0; y < adjHeight; y++) {
- const byte *src = (const byte *)border->getBasePtr(clip.left - outerDims.left, y);
- byte *dst = (byte *)surface->getBasePtr(clip.left, y + clip.top);
- for (int x = 0; x < adjWidth; x++, src++, dst++)
- if (*src != _colorGreen2 && *src != _colorGreen)
- *dst = *src;
- }
- g_system->unlockScreen();
+ if (_pixelformat.bytesPerPixel == 1) {
+ Surface *surface = g_system->lockScreen();
+ ManagedSurface *border = w->getBorderSurface();
+
+ for (int y = 0; y < adjHeight; y++) {
+ const byte *src = (const byte *)border->getBasePtr(clip.left - outerDims.left, y);
+ byte *dst = (byte *)surface->getBasePtr(clip.left, y + clip.top);
+ for (int x = 0; x < adjWidth; x++, src++, dst++)
+ if (*src != _colorGreen2 && *src != _colorGreen)
+ *dst = *src;
+ }
+
+ g_system->unlockScreen();
+ } else {
+ g_system->copyRectToScreen(w->getBorderSurface()->getBasePtr(MAX(clip.left - outerDims.left, 0), MAX(clip.top - outerDims.top, 0)), w->getBorderSurface()->pitch, clip.left, clip.top, adjWidth, adjHeight);
+ }
}
adjustDimensions(clip, innerDims, adjWidth, adjHeight);
@@ -789,10 +802,10 @@ void MacWindowManager::renderZoomBox(bool redraw) {
}
void MacWindowManager::zoomBoxInner(Common::Rect &r, Graphics::MacPlotData &pd) {
- Graphics::drawLine(r.left, r.top, r.right, r.top, 0xff, Graphics::macDrawPixel, &pd);
- Graphics::drawLine(r.right, r.top, r.right, r.bottom, 0xff, Graphics::macDrawPixel, &pd);
- Graphics::drawLine(r.left, r.bottom, r.right, r.bottom, 0xff, Graphics::macDrawPixel, &pd);
- Graphics::drawLine(r.left, r.top, r.left, r.bottom, 0xff, Graphics::macDrawPixel, &pd);
+ Graphics::drawLine(r.left, r.top, r.right, r.top, 0xff, getDrawPixel(), &pd);
+ Graphics::drawLine(r.right, r.top, r.right, r.bottom, 0xff, getDrawPixel(), &pd);
+ Graphics::drawLine(r.left, r.bottom, r.right, r.bottom, 0xff, getDrawPixel(), &pd);
+ Graphics::drawLine(r.left, r.top, r.left, r.bottom, 0xff, getDrawPixel(), &pd);
}
/////////////////
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index f6f84f7e52..29eb0fc20c 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -131,8 +131,6 @@ struct ZoomBox {
uint32 nextTime;
};
-void macDrawPixel(int x, int y, int color, void *data);
-
/**
* A manager class to handle window creation, destruction,
* drawing, moving and event handling.
@@ -142,6 +140,9 @@ public:
MacWindowManager(uint32 mode = 0, MacPatterns *patterns = nullptr);
~MacWindowManager();
+ typedef void (* DrawPixPtr)(int, int, int, void *);
+ DrawPixPtr getDrawPixel();
+
/**
* Mutator to indicate the surface onto which the desktop will be drawn.
* Note that this method should be called as soon as the WM is created.
More information about the Scummvm-git-logs
mailing list