[Scummvm-git-logs] scummvm master -> b5114fc87f129c62dc397b9df1c8f8f58ef2c05c
npjg
nathanael.gentrydb8 at gmail.com
Mon Jul 13 17:30:45 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:
454be019ff DIRECTOR: Remove maskSurface from MacWidget
a1560296d3 DIRECTOR: Reset channel width on castId change
b5114fc87f DIRECTOR: Fix surface memory leak in transitions
Commit: 454be019ff6e394014b3759f0c2bc47289478d6f
https://github.com/scummvm/scummvm/commit/454be019ff6e394014b3759f0c2bc47289478d6f
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-07-13T13:29:54-04:00
Commit Message:
DIRECTOR: Remove maskSurface from MacWidget
Changed paths:
graphics/macgui/macbutton.cpp
graphics/macgui/macwidget.cpp
graphics/macgui/macwidget.h
diff --git a/graphics/macgui/macbutton.cpp b/graphics/macgui/macbutton.cpp
index 9b32f096d1..33cc489a0d 100644
--- a/graphics/macgui/macbutton.cpp
+++ b/graphics/macgui/macbutton.cpp
@@ -57,7 +57,6 @@ MacButton::MacButton(MacButtonType buttonType, TextAlign textAlignment, MacWidge
_alignOffset.x += offset;
_dims.right += offset;
_composeSurface->create(_dims.width(), _dims.height());
- _maskSurface->create(_dims.width(), _dims.height());
}
void MacButton::setActive(bool active) {
@@ -112,11 +111,10 @@ bool MacButton::draw(bool forceRedraw) {
if ((!_contentIsDirty && !forceRedraw) || _active)
return false;
- _maskSurface->clear(1);
MacText::draw();
Common::Rect r(_dims.width() - 1, _dims.height() - 1);
- Graphics::MacPlotData pd(_composeSurface, _maskSurface, &_wm->getPatterns(), 1, 0, 0, 1, 0);
+ Graphics::MacPlotData pd(_composeSurface, nullptr, &_wm->getPatterns(), 1, 0, 0, 1, 0);
switch (_buttonType) {
case kCheckBox: {
diff --git a/graphics/macgui/macwidget.cpp b/graphics/macgui/macwidget.cpp
index 3c930e00e8..c5664bcae8 100644
--- a/graphics/macgui/macwidget.cpp
+++ b/graphics/macgui/macwidget.cpp
@@ -43,15 +43,9 @@ MacWidget::MacWidget(MacWidget *parent, int x, int y, int w, int h, MacWindowMan
if (parent)
parent->_children.push_back(this);
- _composeSurface = nullptr;
- _maskSurface = nullptr;
-
_composeSurface = new ManagedSurface(_dims.width(), _dims.height());
_composeSurface->clear(_bgcolor);
- _maskSurface = new ManagedSurface(_dims.width(), _dims.height());
- _maskSurface->clear(1);
-
_active = false;
_editable = false;
}
@@ -64,11 +58,6 @@ MacWidget::~MacWidget() {
_composeSurface->free();
delete _composeSurface;
}
-
- if (_maskSurface) {
- _maskSurface->free();
- delete _maskSurface;
- }
}
void MacWidget::setActive(bool active) {
diff --git a/graphics/macgui/macwidget.h b/graphics/macgui/macwidget.h
index e93c47fb74..b853c1498e 100644
--- a/graphics/macgui/macwidget.h
+++ b/graphics/macgui/macwidget.h
@@ -81,7 +81,6 @@ public:
void removeWidget(MacWidget *child, bool del = true);
Graphics::ManagedSurface *getSurface() { return _composeSurface; }
- Graphics::ManagedSurface *getMask() { return _maskSurface; }
protected:
uint16 _border;
@@ -91,7 +90,6 @@ protected:
int _fgcolor, _bgcolor;
Graphics::ManagedSurface *_composeSurface;
- Graphics::ManagedSurface *_maskSurface;
public:
bool _focusable;
Commit: a1560296d353b652bb5e18a5ed1cc9763c8391f3
https://github.com/scummvm/scummvm/commit/a1560296d353b652bb5e18a5ed1cc9763c8391f3
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-07-13T13:29:54-04:00
Commit Message:
DIRECTOR: Reset channel width on castId change
This fixes the elusive buffer overflow in Chop Suey's Mudpup.
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 392a3c789d..52cab47dbc 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -1192,7 +1192,10 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
case kTheCastNum:
if (d.asInt() != sprite->_castId) {
g_director->getCurrentStage()->addDirtyRect(channel->getBbox());
+
sprite->setCast(d.asInt());
+ channel->_width = sprite->_width;
+ channel->_height = sprite->_height;
}
break;
case kTheConstraint:
Commit: b5114fc87f129c62dc397b9df1c8f8f58ef2c05c
https://github.com/scummvm/scummvm/commit/b5114fc87f129c62dc397b9df1c8f8f58ef2c05c
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-07-13T13:29:54-04:00
Commit Message:
DIRECTOR: Fix surface memory leak in transitions
Changed paths:
engines/director/transitions.cpp
diff --git a/engines/director/transitions.cpp b/engines/director/transitions.cpp
index 3408ee7ada..36efb29e94 100644
--- a/engines/director/transitions.cpp
+++ b/engines/director/transitions.cpp
@@ -151,11 +151,11 @@ void Stage::playTransition(uint16 transDuration, uint8 transArea, uint8 transChu
t.duration = 250;
// Cache a copy of the frame before the transition.
- Graphics::ManagedSurface *currentFrame = new Graphics::ManagedSurface(_surface.w, _surface.h);
- currentFrame->copyFrom(_surface);
+ Graphics::ManagedSurface currentFrame(Graphics::ManagedSurface(_surface.w, _surface.h));
+ currentFrame.copyFrom(_surface);
// If a transition is being played, render the frame after the transition.
- Graphics::ManagedSurface *nextFrame = new Graphics::ManagedSurface(_surface.w, _surface.h);
+ Graphics::ManagedSurface nextFrame(Graphics::ManagedSurface(_surface.w, _surface.h));
Common::Rect clipRect;
if (t.area) {
@@ -183,11 +183,11 @@ void Stage::playTransition(uint16 transDuration, uint8 transArea, uint8 transChu
clipRect.clip(Common::Rect(_innerDims.width(), _innerDims.height()));
_dirtyRects.push_back(clipRect);
- render(false, nextFrame);
+ render(false, &nextFrame);
} else {
// Full stage transition
g_director->getCurrentMovie()->getScore()->renderSprites(t.frame, kRenderForceUpdate);
- render(true, nextFrame);
+ render(true, &nextFrame);
clipRect = _innerDims;
clipRect.moveTo(0, 0);
@@ -203,36 +203,36 @@ void Stage::playTransition(uint16 transDuration, uint8 transArea, uint8 transChu
switch (transProps[t.type].algo) {
case kTransAlgoDissolve:
if (t.type == kTransDissolvePatterns)
- dissolvePatternsTrans(t, clipRect, nextFrame);
+ dissolvePatternsTrans(t, clipRect, &nextFrame);
else
- dissolveTrans(t, clipRect, nextFrame);
+ dissolveTrans(t, clipRect, &nextFrame);
return;
case kTransAlgoChecker:
case kTransAlgoStrips:
case kTransAlgoBlinds:
- transMultiPass(t, clipRect, nextFrame);
+ transMultiPass(t, clipRect, &nextFrame);
return;
case kTransAlgoZoom:
- transZoom(t, clipRect, nextFrame);
+ transZoom(t, clipRect, &nextFrame);
return;
case kTransAlgoCenterOut:
case kTransAlgoCover:
case kTransAlgoWipe:
- blitFrom = nextFrame;
+ blitFrom = &nextFrame;
break;
case kTransAlgoEdgesIn:
case kTransAlgoReveal:
case kTransAlgoPush:
- blitFrom = currentFrame;
+ blitFrom = ¤tFrame;
fullredraw = true;
break;
default:
- blitFrom = nextFrame;
+ blitFrom = &nextFrame;
break;
}
@@ -246,7 +246,7 @@ void Stage::playTransition(uint16 transDuration, uint8 transArea, uint8 transChu
if (transProps[t.type].algo == kTransAlgoReveal ||
transProps[t.type].algo == kTransAlgoEdgesIn) {
- _surface.copyRectToSurface(*nextFrame, clipRect.left, clipRect.top, clipRect);
+ _surface.copyRectToSurface(nextFrame, clipRect.left, clipRect.top, clipRect);
}
switch (t.type) {
@@ -318,7 +318,7 @@ void Stage::playTransition(uint16 transDuration, uint8 transArea, uint8 transChu
rto.translate(w - t.xStepSize * i, 0);
rfrom.right -= w - clipRect.findIntersectingRect(rto).width();
rto.clip(clipRect);
- _surface.blitFrom(*nextFrame, rfrom, Common::Point(rto.left, rto.top));
+ _surface.blitFrom(nextFrame, rfrom, Common::Point(rto.left, rto.top));
rfrom.translate(t.xStepSize * i, 0);
rfrom.setWidth(w - t.xStepSize * i);
@@ -328,7 +328,7 @@ void Stage::playTransition(uint16 transDuration, uint8 transArea, uint8 transChu
case kTransPushRight: // 12
rfrom.translate(w - t.xStepSize * i, 0);
rfrom.setWidth(t.xStepSize * i);
- _surface.blitFrom(*nextFrame, rfrom, Common::Point(rto.left, rto.top));
+ _surface.blitFrom(nextFrame, rfrom, Common::Point(rto.left, rto.top));
rto.setWidth(w - t.xStepSize * i);
rto.translate(t.xStepSize * i, 0);
@@ -339,7 +339,7 @@ void Stage::playTransition(uint16 transDuration, uint8 transArea, uint8 transChu
case kTransPushDown: // 13
rfrom.translate(0, h - t.yStepSize * i);
rfrom.setHeight(t.yStepSize * i);
- _surface.blitFrom(*nextFrame, rfrom, Common::Point(rto.left, rto.top));
+ _surface.blitFrom(nextFrame, rfrom, Common::Point(rto.left, rto.top));
rto.setHeight(h - t.yStepSize * i);
rto.translate(0, t.yStepSize * i);
@@ -349,7 +349,7 @@ void Stage::playTransition(uint16 transDuration, uint8 transArea, uint8 transChu
case kTransPushUp: // 14
rto.translate(0, h - t.yStepSize * i);
- _surface.blitFrom(*nextFrame, rfrom, Common::Point(rto.left, rto.top));
+ _surface.blitFrom(nextFrame, rfrom, Common::Point(rto.left, rto.top));
rfrom.translate(0, t.yStepSize * i);
rfrom.setHeight(h - t.yStepSize * i);
@@ -511,7 +511,7 @@ void Stage::playTransition(uint16 transDuration, uint8 transArea, uint8 transChu
g_system->delayMillis(t.stepDuration);
if (processQuitEvent(true)) {
- exitTransition(nextFrame, clipRect);
+ exitTransition(&nextFrame, clipRect);
break;
}
@@ -528,9 +528,6 @@ void Stage::playTransition(uint16 transDuration, uint8 transArea, uint8 transChu
g_system->updateScreen();
g_lingo->executePerFrameHook(t.frame, i);
}
-
- delete currentFrame;
- delete nextFrame;
}
static int getLog2(int n) {
More information about the Scummvm-git-logs
mailing list