[Scummvm-git-logs] scummvm master -> d8725510b6a010f8354946e9a15e106a6b43c7d6
djsrv
dservilla at gmail.com
Mon Jul 6 17:13:11 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d8725510b6 GRAPHICS: MACGUI: Don't draw border over contents
Commit: d8725510b6a010f8354946e9a15e106a6b43c7d6
https://github.com/scummvm/scummvm/commit/d8725510b6a010f8354946e9a15e106a6b43c7d6
Author: djsrv (dservilla at gmail.com)
Date: 2020-07-06T13:12:55-04:00
Commit Message:
GRAPHICS: MACGUI: Don't draw border over contents
Changed paths:
engines/director/movie.cpp
engines/director/stage.cpp
engines/director/transitions.cpp
graphics/macgui/macwindow.cpp
graphics/macgui/macwindow.h
diff --git a/engines/director/movie.cpp b/engines/director/movie.cpp
index fe9520ca49..961da7bdbc 100644
--- a/engines/director/movie.cpp
+++ b/engines/director/movie.cpp
@@ -99,7 +99,7 @@ bool Movie::loadArchive() {
// If the stage dimensions are different, delete it and start again.
// Otherwise, do not clear it so there can be a nice transition.
if (_stage->getSurface()->w != _movieRect.width() || _stage->getSurface()->h != _movieRect.height()) {
- _stage->resize(_movieRect.width(), _movieRect.height());
+ _stage->resize(_movieRect.width(), _movieRect.height(), true);
}
// TODO: Add more options for desktop dimensions
uint16 windowWidth = debugChannelSet(-1, kDebugDesktop) ? 1024 : _movieRect.width();
diff --git a/engines/director/stage.cpp b/engines/director/stage.cpp
index f2a51480ae..da6ef1c629 100644
--- a/engines/director/stage.cpp
+++ b/engines/director/stage.cpp
@@ -111,7 +111,7 @@ void Stage::reset() {
void Stage::addDirtyRect(const Common::Rect &r) {
Common::Rect bounds = r;
- Common::Rect clip = _dims;
+ Common::Rect clip = _innerDims;
clip.moveTo(0, 0);
bounds.clip(clip);
@@ -222,7 +222,7 @@ void Stage::inkBlitSurface(DirectorPlotData *pd, Common::Rect &srcRect, const Gr
}
Common::Point Stage::getMousePos() {
- return g_system->getEventManager()->getMousePos() - Common::Point(_dims.left, _dims.top);
+ return g_system->getEventManager()->getMousePos() - Common::Point(_innerDims.left, _innerDims.top);
}
bool Stage::step() {
diff --git a/engines/director/transitions.cpp b/engines/director/transitions.cpp
index c9119fba56..de2329c803 100644
--- a/engines/director/transitions.cpp
+++ b/engines/director/transitions.cpp
@@ -188,7 +188,7 @@ void Stage::playTransition(uint16 transDuration, uint8 transArea, uint8 transChu
g_director->getCurrentMovie()->getScore()->renderSprites(t.frame, kRenderForceUpdate);
render(true, nextFrame);
- clipRect = _dims;
+ clipRect = _innerDims;
clipRect.moveTo(0, 0);
}
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp
index f617f89122..f413f734d9 100644
--- a/graphics/macgui/macwindow.cpp
+++ b/graphics/macgui/macwindow.cpp
@@ -107,25 +107,30 @@ void MacWindow::setActive(bool active) {
bool MacWindow::isActive() { return _active; }
-void MacWindow::resize(int w, int h) {
+void MacWindow::resize(int w, int h, bool inner) {
if (_surface.w == w && _surface.h == h)
return;
+ if (inner) {
+ _innerDims.setWidth(w);
+ _innerDims.setHeight(h);
+ updateOuterDims();
+ } else {
+ _dims.setWidth(w);
+ _dims.setHeight(h);
+ updateInnerDims();
+ }
+
_surface.free();
- _surface.create(w, h, PixelFormat::createFormatCLUT8());
+ _surface.create(_innerDims.width(), _innerDims.height(), PixelFormat::createFormatCLUT8());
if (_hasPattern)
drawPattern();
_borderSurface.free();
- _borderSurface.create(w, h, PixelFormat::createFormatCLUT8());
+ _borderSurface.create(_dims.width(), _dims.height(), PixelFormat::createFormatCLUT8());
_composeSurface->free();
- _composeSurface->create(w, h, PixelFormat::createFormatCLUT8());
-
- _dims.setWidth(w);
- _dims.setHeight(h);
-
- updateInnerDims();
+ _composeSurface->create(_dims.width(), _dims.height(), PixelFormat::createFormatCLUT8());
_contentIsDirty = true;
_borderIsDirty = true;
@@ -166,7 +171,7 @@ bool MacWindow::draw(bool forceRedraw) {
_contentIsDirty = false;
// Compose
- _composeSurface->blitFrom(_surface, Common::Rect(0, 0, _surface.w - 2, _surface.h - 2), Common::Point(2, 2));
+ _composeSurface->blitFrom(_surface, Common::Rect(0, 0, _surface.w, _surface.h), Common::Point(_innerDims.left - _dims.left, _innerDims.top - _dims.top));
_composeSurface->transBlitFrom(_borderSurface, kColorGreen);
return true;
@@ -176,7 +181,7 @@ bool MacWindow::draw(ManagedSurface *g, bool forceRedraw) {
if (!draw(forceRedraw))
return false;
- g->transBlitFrom(*_composeSurface, _composeSurface->getBounds(), Common::Point(_dims.left - 2, _dims.top - 2), kColorGreen2);
+ g->transBlitFrom(*_composeSurface, _composeSurface->getBounds(), Common::Point(_dims.left, _dims.top), kColorGreen2);
return true;
}
@@ -211,6 +216,22 @@ void MacWindow::updateInnerDims() {
}
}
+void MacWindow::updateOuterDims() {
+ if (_innerDims.isEmpty())
+ return;
+
+ if (_macBorder.hasBorder(_active) && _macBorder.hasOffsets()) {
+ _dims = Common::Rect(
+ _innerDims.left - _macBorder.getOffset().left,
+ _innerDims.top - _macBorder.getOffset().top,
+ _innerDims.right + _macBorder.getOffset().right,
+ _innerDims.bottom + _macBorder.getOffset().bottom);
+ } else {
+ _dims = _innerDims;
+ _dims.grow(kBorderWidth);
+ }
+}
+
void MacWindow::drawBorder() {
_borderIsDirty = false;
diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h
index cc83606af8..8b9ba67fbc 100644
--- a/graphics/macgui/macwindow.h
+++ b/graphics/macgui/macwindow.h
@@ -173,8 +173,9 @@ public:
* Change the width and the height of the window.
* @param w New width of the window.
* @param h New height of the window.
+ * @param inner True to set the inner dimensions.
*/
- virtual void resize(int w, int h);
+ virtual void resize(int w, int h, bool inner = false);
/**
* Change the dimensions of the window ([0, 0, 0, 0] by default).
@@ -274,6 +275,7 @@ private:
void fillRect(ManagedSurface *g, int x, int y, int w, int h, int color);
const Font *getTitleFont();
void updateInnerDims();
+ void updateOuterDims();
bool isInCloseButton(int x, int y);
bool isInResizeButton(int x, int y);
@@ -287,6 +289,7 @@ protected:
ManagedSurface _borderSurface;
bool _borderIsDirty;
+ Common::Rect _innerDims;
private:
MacWindowBorder _macBorder;
@@ -300,7 +303,6 @@ private:
bool _closeable;
int _borderWidth;
- Common::Rect _innerDims;
bool _beingDragged, _beingResized;
int _draggedX, _draggedY;
More information about the Scummvm-git-logs
mailing list