[Scummvm-git-logs] scummvm master -> 2ab965e53ee7e2b34c104b906dd0de5008d31354
sev-
sev at scummvm.org
Thu Apr 1 14:09:06 UTC 2021
This automated email contains information about 12 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0fdf29ca19 GRAPHICS: MACGUI: fix the bug when splitting a new line
63f5de7069 GRAPHICS: MACGUI: init _textShadow at mactext constructor
37b4ca2ed6 WAGE: remove the subtraction used to calc relative coordinate, which was calc by MacGUI
c5481d9c02 GRAPHICS: MACGUI: modify the logic of drawInput and appendText, in order to fix the bug of cursor dislocation and incorr
95230f6b9b WAGE: modify the offset of drawing the design
43e95f3a48 GRAPHICS: MACGUI: set palette in macwindowmanager line 41 as default a palette of MacWindowManager
f2825c85de GRAPHICS: enhance blit in nine-patch with transparency color
0443d5a133 GRAPHICS: MACGUI: remove drawSimpleBorder which draws the border manually
aba96cb38f GRAPHICS: MACGUI: recalc the scrollSize and scrollPos, in order to fix scroll bar for mactextwindow
1afc246a69 GRAPHICS: MACGUI: Added the callback function for drawing invert pixel for default palette, which is used to draw the sc
0dcde7c96a GRAPHICS: MACGUI: add new feature that when scroll wheel, the scroll bar will also display
2ab965e53e GRAPHICS: MACGUI: fix the bug dumping when initializing Wage Engine
Commit: 0fdf29ca19445c5a7ca684fcf0e262ae59a22eb1
https://github.com/scummvm/scummvm/commit/0fdf29ca19445c5a7ca684fcf0e262ae59a22eb1
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-01T16:08:56+02:00
Commit Message:
GRAPHICS: MACGUI: fix the bug when splitting a new line
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index a99de25142..4f2ed50dc5 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -850,7 +850,6 @@ void MacText::resize(int w, int h) {
}
void MacText::appendText(const Common::U32String &str, int fontId, int fontSize, int fontSlant, bool skipAdd) {
-// appendTextDefault(str, skipAdd);
uint oldLen = _textLines.size();
MacFontRun fontRun = MacFontRun(_wm, fontId, fontSlant, fontSize, 0, 0, 0);
Commit: 63f5de70691a5d18d9d35a1424e7c29b102749b8
https://github.com/scummvm/scummvm/commit/63f5de70691a5d18d9d35a1424e7c29b102749b8
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-01T16:08:56+02:00
Commit Message:
GRAPHICS: MACGUI: init _textShadow at mactext constructor
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 4f2ed50dc5..4d79a6bb43 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -170,6 +170,7 @@ MacText::MacText(const Common::U32String &s, MacWindowManager *wm, const MacFont
_textAlignment = textAlignment;
_interLinear = interlinear;
_maxWidth = maxWidth;
+ _textShadow = 0;
if (macFont) {
_defaultFormatting = MacFontRun(_wm, macFont->getId(), macFont->getSlant(), macFont->getSize(), 0, 0, 0);
@@ -198,6 +199,7 @@ MacText::MacText(const Common::String &s, MacWindowManager *wm, const MacFont *m
_textAlignment = textAlignment;
_interLinear = interlinear;
_maxWidth = maxWidth;
+ _textShadow = 0;
if (macFont) {
_defaultFormatting = MacFontRun(_wm, macFont->getId(), macFont->getSlant(), macFont->getSize(), 0, 0, 0);
Commit: 37b4ca2ed6626b0d9a2d5a623a4098ae15764822
https://github.com/scummvm/scummvm/commit/37b4ca2ed6626b0d9a2d5a623a4098ae15764822
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-01T16:08:56+02:00
Commit Message:
WAGE: remove the subtraction used to calc relative coordinate, which was calc by MacGUI
Changed paths:
engines/wage/gui.cpp
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index ee997ad04d..728a2c27d5 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -190,8 +190,7 @@ static bool sceneWindowCallback(WindowClick click, Common::Event &event, void *g
bool Gui::processSceneEvents(WindowClick click, Common::Event &event) {
if (click == kBorderInner && event.type == Common::EVENT_LBUTTONUP) {
- Designed *obj = _scene->lookUpEntity(event.mouse.x - _sceneWindow->getDimensions().left,
- event.mouse.y - _sceneWindow->getDimensions().top);
+ Designed *obj = _scene->lookUpEntity(event.mouse.x, event.mouse.y);
if (obj != nullptr)
_engine->processTurn(NULL, obj);
Commit: c5481d9c02c626902717f6ad5d7bb58759d1caa7
https://github.com/scummvm/scummvm/commit/c5481d9c02c626902717f6ad5d7bb58759d1caa7
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-01T16:08:56+02:00
Commit Message:
GRAPHICS: MACGUI: modify the logic of drawInput and appendText, in order to fix the bug of cursor dislocation and incorrectly drawing the input
Changed paths:
graphics/macgui/mactext.cpp
graphics/macgui/mactext.h
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 4d79a6bb43..084e900646 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -747,6 +747,12 @@ int MacText::getLineCharWidth(int line, bool enforce) {
return width;
}
+int MacText::getLastLineWidth() {
+ if (_textLines.size() == 0)
+ return 0;
+ return getLineWidth(_textLines.size() - 1, true);
+}
+
int MacText::getLineHeight(int line) {
if ((uint)line >= _textLines.size())
return 0;
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index 310c812e12..cf1bc1db7f 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -181,6 +181,7 @@ public:
void removeLastLine();
int getLineCount() { return _textLines.size(); }
int getLineCharWidth(int line, bool enforce = false);
+ int getLastLineWidth();
int getTextHeight() { return _textMaxHeight; }
int getLineHeight(int line);
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 71df2b6fc7..cc62e53d61 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -91,9 +91,13 @@ void MacTextWindow::resize(int w, int h, bool inner) {
}
void MacTextWindow::appendText(const Common::U32String &str, const MacFont *macFont, bool skipAdd) {
+ // the reason we put undrawInput here before appendText, is we don't want the appended text affect our input
+ // thus, we first delete all of out input, and we append new text, and we redraw the input
+ undrawInput();
_mactext->appendText(str, macFont->getId(), macFont->getSize(), macFont->getSlant(), skipAdd);
_contentIsDirty = true;
+ _inputIsDirty = true; //force it to redraw input
if (_editable) {
_scrollPos = MAX(0, _mactext->getTextHeight() - getInnerDimensions().height());
@@ -470,18 +474,15 @@ void MacTextWindow::undrawInput() {
}
void MacTextWindow::drawInput() {
- undrawInput();
-
- Common::Array<Common::U32String> text;
+ int oldLen = _mactext->getLineCount() - _inputTextHeight;
- // Now recalc new text height
- _fontRef->wordWrapText(_inputText, _maxWidth, text);
- _inputTextHeight = MAX((uint)1, text.size()); // We always have line to clean
-
- // And add new input line to the text
+ // add new input line to the text
appendText(_inputText, _font, true);
- _cursorX = _inputText.empty() ? 0 : _fontRef->getStringWidth(text[_inputTextHeight - 1]);
+ // Now recalc new text height
+ int newLen = _mactext->getLineCount();
+ _inputTextHeight = newLen - oldLen;
+ _cursorX = _inputText.empty() ? 0 : _mactext->getLastLineWidth();
updateCursorPos();
Commit: 95230f6b9bf44e60d2b2beec20f7a6463f2dc964
https://github.com/scummvm/scummvm/commit/95230f6b9bf44e60d2b2beec20f7a6463f2dc964
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-01T16:08:56+02:00
Commit Message:
WAGE: modify the offset of drawing the design
Changed paths:
engines/wage/design.cpp
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index d74f99fa74..7a57501a7c 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -133,7 +133,7 @@ void Design::paint(Graphics::ManagedSurface *surface, Graphics::MacPatterns &pat
render(patterns);
if (_bounds->width() && _bounds->height()) {
- const int padding = 20;
+ const int padding = 14;
// Common::Rect from(padding, padding, _bounds->width() - 2 * padding, _bounds->height() - 2 * padding);
// in order to restore the design, we just cut the left and top part of that
Common::Rect from(padding, padding, _bounds->width(), _bounds->height());
Commit: 43e95f3a486b7470df9a7dc329a06a164b5d442f
https://github.com/scummvm/scummvm/commit/43e95f3a486b7470df9a7dc329a06a164b5d442f
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-01T16:08:56+02:00
Commit Message:
GRAPHICS: MACGUI: set palette in macwindowmanager line 41 as default a palette of MacWindowManager
Changed paths:
graphics/macgui/macwindowmanager.cpp
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 8f376bf80f..aac6c4c833 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -189,9 +189,6 @@ MacWindowManager::MacWindowManager(uint32 mode, MacPatterns *patterns) {
_fullRefresh = true;
- _palette = nullptr;
- _paletteSize = 0;
-
if (mode & kWMMode32bpp)
_pixelformat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
else
@@ -206,6 +203,11 @@ MacWindowManager::MacWindowManager(uint32 mode, MacPatterns *patterns) {
g_system->getPaletteManager()->setPalette(palette, 0, ARRAYSIZE(palette) / 3);
+ _paletteSize = ARRAYSIZE(palette) / 3;
+ _palette = (byte *)malloc(_paletteSize * 3);
+ if (_palette)
+ memcpy(_palette, palette, _paletteSize * 3);
+
_fontMan = new MacFontManager(mode);
_cursor = nullptr;
@@ -953,7 +955,8 @@ void MacWindowManager::passPalette(const byte *pal, uint size) {
free(_palette);
_palette = (byte *)malloc(size * 3);
- memcpy(_palette, pal, size * 3);
+ if (_palette)
+ memcpy(_palette, pal, size * 3);
_paletteSize = size;
_colorHash.clear();
Commit: f2825c85de12c3a059b02fbc4d0e055dc5b312ce
https://github.com/scummvm/scummvm/commit/f2825c85de12c3a059b02fbc4d0e055dc5b312ce
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-01T16:08:56+02:00
Commit Message:
GRAPHICS: enhance blit in nine-patch with transparency color
Changed paths:
graphics/nine_patch.cpp
graphics/nine_patch.h
diff --git a/graphics/nine_patch.cpp b/graphics/nine_patch.cpp
index dc1940c4d0..6e74d4f464 100644
--- a/graphics/nine_patch.cpp
+++ b/graphics/nine_patch.cpp
@@ -208,7 +208,7 @@ bad_bitmap:
}
}
-void NinePatchBitmap::blit(Graphics::Surface &target, int dx, int dy, int dw, int dh, byte *palette, int numColors, MacWindowManager *wm) {
+void NinePatchBitmap::blit(Graphics::Surface &target, int dx, int dy, int dw, int dh, byte *palette, int numColors, MacWindowManager *wm, uint32 transColor) {
/* don't draw bitmaps that are smaller than the fixed area */
if (dw < _h._fix || dh < _v._fix)
return;
@@ -249,7 +249,7 @@ void NinePatchBitmap::blit(Graphics::Surface &target, int dx, int dy, int dw, in
for (uint i = 0; i < srf->w; ++i) {
for (uint j = 0; j < srf->h; ++j) {
uint32 color = *(uint32*)srf->getBasePtr(i, j);
- if (color > 0) {
+ if (color != transColor) {
*((byte *)target.getBasePtr(i, j)) = closestGrayscale(color, palette, numColors);
}
}
@@ -258,9 +258,9 @@ void NinePatchBitmap::blit(Graphics::Surface &target, int dx, int dy, int dw, in
for (uint i = 0; i < srf->w; ++i) {
for (uint j = 0; j < srf->h; ++j) {
uint32 color = *(uint32*)srf->getBasePtr(i, j);
- byte r, g, b;
- _bmp->format.colorToRGB(color, r, g, b);
- if (color > 0) {
+ byte a, r, g, b;
+ _bmp->format.colorToARGB(color, a, r, g, b);
+ if (a > 0 && color != transColor) {
*((byte *)target.getBasePtr(i, j)) = wm->findBestColor(r, g, b);
}
}
diff --git a/graphics/nine_patch.h b/graphics/nine_patch.h
index c79c66b711..24b8be4236 100644
--- a/graphics/nine_patch.h
+++ b/graphics/nine_patch.h
@@ -89,7 +89,7 @@ public:
NinePatchBitmap(Graphics::TransparentSurface *bmp, bool owns_bitmap);
~NinePatchBitmap();
- void blit(Graphics::Surface &target, int dx, int dy, int dw, int dh, byte *palette = NULL, int numColors = 0, MacWindowManager *wm = NULL);
+ void blit(Graphics::Surface &target, int dx, int dy, int dw, int dh, byte *palette = NULL, int numColors = 0, MacWindowManager *wm = NULL, uint32 transColor = 0);
void blitClip(Graphics::Surface &target, Common::Rect clip, int dx, int dy, int dw, int dh);
int getWidth() { return _width; }
Commit: 0443d5a133e571b3937ba3ca2d045708448a77ca
https://github.com/scummvm/scummvm/commit/0443d5a133e571b3937ba3ca2d045708448a77ca
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-01T16:08:56+02:00
Commit Message:
GRAPHICS: MACGUI: remove drawSimpleBorder which draws the border manually
Changed paths:
graphics/macgui/macwindow.cpp
graphics/macgui/macwindow.h
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp
index 9fbca2d54c..34aca45b42 100644
--- a/graphics/macgui/macwindow.cpp
+++ b/graphics/macgui/macwindow.cpp
@@ -273,11 +273,8 @@ void MacWindow::drawBorder() {
titleHeight = _macBorder.getOffset().top - titleY - _macBorder.getOffset().titleBottom;
sidesWidth = _macBorder.getOffset().left + _macBorder.getOffset().right;
} else {
- drawSimpleBorder(g);
- titleColor = _wm->_colorBlack;
- titleY = 0;
- titleHeight = _borderWidth;
- sidesWidth = _borderWidth * 2;
+ warning("MacWindow: No Border Loaded");
+ setBorderType(0xff);
}
if (!_title.empty()) {
@@ -299,93 +296,14 @@ void MacWindow::drawBorder() {
}
}
-void MacWindow::prepareBorderSurface(ManagedSurface *g) {
- 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) {
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);
+ g->clear(_wm->_colorGreen);
}
_macBorder.blitBorderInto(*g, _active, _wm);
}
-void MacWindow::drawSimpleBorder(ManagedSurface *g) {
- bool active = _active, scrollable = _scrollable, closeable = _active;
- const int size = kBorderWidth;
- int x = 0;
- int y = 0;
- int width = _borderSurface.w;
- int height = _borderSurface.h;
-
- prepareBorderSurface(g);
-
- drawBox(g, x, y, size, size);
- drawBox(g, x + width - size - 1, y, size, size);
- drawBox(g, x + width - size - 1, y + height - size - 1, size, size);
- drawBox(g, x, y + height - size - 1, size, size);
- drawBox(g, x + size, y + 2, width - 2 * size - 1, size - 4);
- drawBox(g, x + size, y + height - size + 1, width - 2 * size - 1, size - 4);
- drawBox(g, x + 2, y + size, size - 4, height - 2 * size - 1);
- drawBox(g, x + width - size + 1, y + size, size - 4, height - 2 * size - 1);
-
- if (active) {
- fillRect(g, x + size, y + 5, width - 2 * size - 1, 8, _wm->_colorBlack);
- fillRect(g, x + size, y + height - 13, width - 2 * size - 1, 8, _wm->_colorBlack);
- fillRect(g, x + 5, y + size, 8, height - 2 * size - 1, _wm->_colorBlack);
- if (!scrollable) {
- fillRect(g, x + width - 13, y + size, 8, height - 2 * size - 1, _wm->_colorBlack);
- } else {
- int x1 = x + width - 15;
- int y1 = y + size + 1;
-
- for (int yy = 0; yy < ARROW_H; yy++) {
- for (int xx = 0; xx < ARROW_W; xx++)
- g->hLine(x1 + xx, y1 + yy, x1 + xx, (arrowPixels[yy][xx] != 0 ? _wm->_colorBlack : _wm->_colorWhite));
- }
-
- fillRect(g, x + width - 13, y + size + ARROW_H, 8, height - 2 * size - 1 - ARROW_H * 2, _wm->_colorBlack);
-
- y1 += height - 2 * size - ARROW_H - 2;
- for (int yy = 0; yy < ARROW_H; yy++) {
- for (int xx = 0; xx < ARROW_W; xx++)
- g->hLine(x1 + xx, y1 + yy, x1 + xx, (arrowPixels[ARROW_H - yy - 1][xx] != 0 ? _wm->_colorBlack : _wm->_colorWhite));
- }
-
- if (_highlightedPart == kBorderScrollUp || _highlightedPart == kBorderScrollDown) {
- int rx1 = x + width - kBorderWidth + 2;
- int ry1 = y + size + _dims.height() * _scrollPos;
- int rx2 = rx1 + size - 4;
- int ry2 = ry1 + _dims.height() * _scrollSize;
- 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, _wm->getDrawPixel(), &pd);
- }
- }
- if (closeable) {
- if (_highlightedPart == kBorderCloseButton) {
- fillRect(g, x + 6, y + 6, 6, 6, _wm->_colorBlack);
- } else {
- drawBox(g, x + 5, y + 5, 7, 7);
- }
- }
- }
-}
void MacWindow::drawPattern() {
byte *pat = _wm->getPatterns()[_pattern - 1];
diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h
index 60d46fea9b..f27cdc884f 100644
--- a/graphics/macgui/macwindow.h
+++ b/graphics/macgui/macwindow.h
@@ -332,8 +332,6 @@ public:
virtual bool isDirty() override { return _borderIsDirty || _contentIsDirty; }
private:
- void prepareBorderSurface(ManagedSurface *g);
- void drawSimpleBorder(ManagedSurface *g);
void drawBorderFromSurface(ManagedSurface *g);
void drawPattern();
void drawBox(ManagedSurface *g, int x, int y, int w, int h);
Commit: aba96cb38f8654dcdba13bd3c5147b71764af47c
https://github.com/scummvm/scummvm/commit/aba96cb38f8654dcdba13bd3c5147b71764af47c
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-01T16:08:56+02:00
Commit Message:
GRAPHICS: MACGUI: recalc the scrollSize and scrollPos, in order to fix scroll bar for mactextwindow
Changed paths:
graphics/macgui/mactextwindow.cpp
graphics/macgui/macwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index cc62e53d61..6c13b85b5f 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -355,15 +355,15 @@ bool MacTextWindow::processEvent(Common::Event &event) {
if (click == kBorderScrollUp || click == kBorderScrollDown) {
if (event.type == Common::EVENT_LBUTTONDOWN) {
- int consoleHeight = getInnerDimensions().height();
- int textFullSize = _mactext->getTextHeight();
- float scrollPos = (float)_scrollPos / textFullSize;
- float scrollSize = (float)consoleHeight / textFullSize;
-
+ int maxText = _mactext->getTextHeight() + getInnerDimensions().height();
+ int drawableHeight = getInnerDimensions().height();
+ float scrollSize = (float)drawableHeight * drawableHeight / (float)maxText;
+ float scrollPos = (float)_scrollPos * drawableHeight / (float)maxText;
+ setHighlight(click);
setScroll(scrollPos, scrollSize);
-
return true;
} else if (event.type == Common::EVENT_LBUTTONUP) {
+ setHighlight(kBorderNone);
switch (click) {
case kBorderScrollUp:
scroll(-1);
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp
index 34aca45b42..b372b85bb0 100644
--- a/graphics/macgui/macwindow.cpp
+++ b/graphics/macgui/macwindow.cpp
@@ -262,9 +262,6 @@ void MacWindow::drawBorder() {
if (_macBorder.hasBorder(_active)) {
drawBorderFromSurface(g);
- if (_macBorder.getOffset().titleTop == -1 && _macBorder.getOffset().titleBottom == -1)
- return;
-
titleColor = _wm->_colorGray88;
if (_active)
titleColor = _macBorder.getOffset().dark ? _wm->_colorWhite : _wm->_colorBlack;
@@ -277,6 +274,19 @@ void MacWindow::drawBorder() {
setBorderType(0xff);
}
+ // draw highlight scroll bar
+ if (_highlightedPart == kBorderScrollUp || _highlightedPart == kBorderScrollDown) {
+ int size = _borderWidth;
+ int rx1 = 0 + width - size + 2;
+ int ry1 = 0 + size + _scrollPos + 1;
+ int rx2 = rx1 + size - 6;
+ int ry2 = ry1 + _scrollSize ;
+ Common::Rect rr(rx1, ry1, rx2, ry2);
+
+ MacPlotData pd(g, nullptr, &_wm->getPatterns(), 1, 0, 0, 1, _wm->_colorWhite, true);
+ Graphics::drawFilledRect(rr, _wm->_colorWhite, _wm->getDrawPixel(), &pd);
+ }
+
if (!_title.empty()) {
const Graphics::Font *font = getTitleFont();
int yOff = _wm->_fontMan->hasBuiltInFonts() ? 3 : 1;
Commit: 1afc246a69ff88f9991a3ca16c0927f878b0cb18
https://github.com/scummvm/scummvm/commit/1afc246a69ff88f9991a3ca16c0927f878b0cb18
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-01T16:08:56+02:00
Commit Message:
GRAPHICS: MACGUI: Added the callback function for drawing invert pixel for default palette, which is used to draw the scroll bar
Changed paths:
graphics/macgui/macwindow.cpp
graphics/macgui/macwindowmanager.cpp
graphics/macgui/macwindowmanager.h
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp
index b372b85bb0..0192179c4e 100644
--- a/graphics/macgui/macwindow.cpp
+++ b/graphics/macgui/macwindow.cpp
@@ -284,7 +284,7 @@ void MacWindow::drawBorder() {
Common::Rect rr(rx1, ry1, rx2, ry2);
MacPlotData pd(g, nullptr, &_wm->getPatterns(), 1, 0, 0, 1, _wm->_colorWhite, true);
- Graphics::drawFilledRect(rr, _wm->_colorWhite, _wm->getDrawPixel(), &pd);
+ Graphics::drawFilledRect(rr, _wm->_colorWhite, _wm->getDrawInvertPixel(), &pd);
}
if (!_title.empty()) {
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index aac6c4c833..f85fba1460 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -455,6 +455,30 @@ void macDrawPixel(int x, int y, int color, void *data) {
}
}
+void macDrawInvertPixel(int x, int y, int color, void *data) {
+ MacPlotData *p = (MacPlotData *)data;
+
+ if (p->fillType > p->patterns->size() || !p->fillType)
+ return;
+
+ 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 cur_color = *((byte *)p->surface->getBasePtr(xu, yu));
+ // 0 represent black in default palette, and 4 represent white
+ // if color is black, we invert it to white, otherwise, we invert it to black
+ byte invert_color = 0;
+ if (cur_color == 0) {
+ invert_color = 4;
+ }
+ *((byte *)p->surface->getBasePtr(xu, yu)) = invert_color;
+
+ if (p->mask)
+ *((byte *)p->mask->getBasePtr(xu, yu)) = 0xff;
+ }
+}
+
MacDrawPixPtr MacWindowManager::getDrawPixel() {
if (_pixelformat.bytesPerPixel == 1)
return &macDrawPixel<byte *>;
@@ -462,6 +486,14 @@ MacDrawPixPtr MacWindowManager::getDrawPixel() {
return &macDrawPixel<uint32 *>;
}
+// get the function of drawing invert pixel for default palette
+MacDrawPixPtr MacWindowManager::getDrawInvertPixel() {
+ if (_pixelformat.bytesPerPixel == 1)
+ return &macDrawInvertPixel;
+ warning("function of drawing invert pixel for default palette has not implemented yet");
+ return nullptr;
+}
+
void MacWindowManager::loadDesktop() {
Common::SeekableReadStream *file = getFile("scummvm_background.bmp");
if (!file)
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index 9df4c2790f..005c9b85e2 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -144,6 +144,7 @@ public:
~MacWindowManager();
MacDrawPixPtr getDrawPixel();
+ MacDrawPixPtr getDrawInvertPixel();
/**
* Mutator to indicate the surface onto which the desktop will be drawn.
Commit: 0dcde7c96a218ae7e60f642f72a3ba9f6da573a7
https://github.com/scummvm/scummvm/commit/0dcde7c96a218ae7e60f642f72a3ba9f6da573a7
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-01T16:08:56+02:00
Commit Message:
GRAPHICS: MACGUI: add new feature that when scroll wheel, the scroll bar will also display
Changed paths:
graphics/macgui/mactextwindow.cpp
graphics/macgui/mactextwindow.h
graphics/macgui/macwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 6c13b85b5f..e496c5f203 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -299,6 +299,14 @@ Common::U32String MacTextWindow::cutSelection() {
return selection;
}
+void MacTextWindow::calcScrollBar() {
+ int maxText = _mactext->getTextHeight() + getInnerDimensions().height();
+ int drawableHeight = getInnerDimensions().height();
+ float scrollSize = (float)drawableHeight * drawableHeight / (float)maxText;
+ float scrollPos = (float)_scrollPos * drawableHeight / (float)maxText;
+ setScroll(scrollPos, scrollSize);
+}
+
bool MacTextWindow::processEvent(Common::Event &event) {
WindowClick click = isInBorder(event.mouse.x, event.mouse.y);
@@ -344,26 +352,25 @@ bool MacTextWindow::processEvent(Common::Event &event) {
return MacWindow::processEvent(event); // Pass it to upstream
if (event.type == Common::EVENT_WHEELUP) {
+ setHighlight(kBorderScrollUp);
+ calcScrollBar();
scroll(-2);
return true;
}
if (event.type == Common::EVENT_WHEELDOWN) {
+ setHighlight(kBorderScrollDown);
+ calcScrollBar();
scroll(2);
return true;
}
if (click == kBorderScrollUp || click == kBorderScrollDown) {
if (event.type == Common::EVENT_LBUTTONDOWN) {
- int maxText = _mactext->getTextHeight() + getInnerDimensions().height();
- int drawableHeight = getInnerDimensions().height();
- float scrollSize = (float)drawableHeight * drawableHeight / (float)maxText;
- float scrollPos = (float)_scrollPos * drawableHeight / (float)maxText;
setHighlight(click);
- setScroll(scrollPos, scrollSize);
+ calcScrollBar();
return true;
} else if (event.type == Common::EVENT_LBUTTONUP) {
- setHighlight(kBorderNone);
switch (click) {
case kBorderScrollUp:
scroll(-1);
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index 690ce29c86..2df7e5f6d4 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -67,6 +67,7 @@ private:
bool isCutAllowed();
void scroll(int delta);
+ void calcScrollBar();
void undrawInput();
void drawInput();
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp
index 0192179c4e..fe0e320b64 100644
--- a/graphics/macgui/macwindow.cpp
+++ b/graphics/macgui/macwindow.cpp
@@ -285,6 +285,7 @@ void MacWindow::drawBorder() {
MacPlotData pd(g, nullptr, &_wm->getPatterns(), 1, 0, 0, 1, _wm->_colorWhite, true);
Graphics::drawFilledRect(rr, _wm->_colorWhite, _wm->getDrawInvertPixel(), &pd);
+ setHighlight(kBorderNone);
}
if (!_title.empty()) {
Commit: 2ab965e53ee7e2b34c104b906dd0de5008d31354
https://github.com/scummvm/scummvm/commit/2ab965e53ee7e2b34c104b906dd0de5008d31354
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-04-01T16:08:56+02:00
Commit Message:
GRAPHICS: MACGUI: fix the bug dumping when initializing Wage Engine
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 084e900646..b0318a103e 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -494,7 +494,7 @@ void MacText::splitString(const Common::U32String &str, int curLine) {
for (int i = 1; i < (int)word.size(); i++) {
word_width += word[i].getFont()->getStringWidth(word[i].text);
- debugN(9, "\"%s\"", Common::toPrintable(word[i].text.encode()).c_str());
+ D(9, "** word \"%s\" textslant [%d]", Common::toPrintable(word[i].text.encode()).c_str(), word[i].textSlant);
}
int cur_width = getLineWidth(curLine, true);
@@ -868,10 +868,12 @@ void MacText::appendText(const Common::U32String &str, int fontId, int fontSize,
_str += fontRun.toString();
_str += str;
}
+
splitString(str);
recalcDims();
render(oldLen - 1, _textLines.size());
+
_contentIsDirty = true;
if (_editable) {
More information about the Scummvm-git-logs
mailing list