[Scummvm-git-logs] scummvm master -> 83615f0d86d74904f3c22857139a9197072d7933
ysj1173886760
42030331+ysj1173886760 at users.noreply.github.com
Mon Sep 6 13:00:04 UTC 2021
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:
83615f0d86 GRAPHICS: MACGUI: fix text display issue in mactextwindow.
Commit: 83615f0d86d74904f3c22857139a9197072d7933
https://github.com/scummvm/scummvm/commit/83615f0d86d74904f3c22857139a9197072d7933
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-09-06T20:58:53+08:00
Commit Message:
GRAPHICS: MACGUI: fix text display issue in mactextwindow.
Changed paths:
graphics/macgui/mactext.cpp
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 361cffd47b..4d38f9474e 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -1150,8 +1150,16 @@ void MacText::resize(int w, int h) {
if (_surface->w == w && _surface->h == h)
return;
- _maxWidth = w;
- setMaxWidth(_maxWidth);
+ setMaxWidth(w);
+ if (_composeSurface->w != w || _composeSurface->h != h) {
+ delete _composeSurface;
+ _composeSurface = new Graphics::ManagedSurface(w, h);
+ _dims.right = _dims.left + w;
+ _dims.bottom = _dims.top + h;
+
+ _contentIsDirty = true;
+ _fullRefresh = true;
+ }
}
void MacText::appendText(const Common::U32String &str, int fontId, int fontSize, int fontSlant, bool skipAdd) {
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 6808f7f8e5..320c6335d1 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -47,7 +47,7 @@ MacTextWindow::MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgco
MacWindow(wm->getLastId(), true, true, true, wm), _bgcolor(bgcolor), _maxWidth(maxWidth), _menu(menu) {
_font = font;
- _mactext = new MacText(Common::U32String(""), _wm, font, fgcolor, bgcolor, maxWidth, textAlignment);
+ _mactext = new MacText(this, 0, 0, 0, 0, _wm, Common::U32String(""), font, fgcolor, bgcolor, maxWidth, textAlignment);
_fontRef = wm->_fontMan->getFont(*font);
@@ -109,7 +109,7 @@ void MacTextWindow::resize(int w, int h, bool inner) {
MacWindow::resize(w, h);
_maxWidth = getInnerDimensions().width();
- _mactext->setMaxWidth(_maxWidth);
+ _mactext->resize(_maxWidth, h);
}
void MacTextWindow::appendText(const Common::U32String &str, const MacFont *macFont, bool skipAdd) {
@@ -215,13 +215,7 @@ bool MacTextWindow::draw(bool forceRedraw) {
_cursorDirty = false;
// Compose
- _mactext->draw(_composeSurface, 0, _scrollPos, _composeSurface->w, _scrollPos + _composeSurface->h, 1, 1);
-
- if (_cursorState && _selectedText.endY == -1)
- _composeSurface->blitFrom(*_cursorSurface, *_cursorRect, Common::Point(_cursorX + 1, _cursorY + 1));
-
- if (_selectedText.endY != -1)
- drawSelection();
+ _mactext->draw(_composeSurface, true);
return true;
}
More information about the Scummvm-git-logs
mailing list