[Scummvm-git-logs] scummvm master -> 15119e2ca071d558c389d689367e12acff29f65c
dreammaster
paulfgilbert at gmail.com
Sun Oct 11 15:41:05 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:
15119e2ca0 GLK: GLULX: Fix toolbar rendering in Advent 350
Commit: 15119e2ca071d558c389d689367e12acff29f65c
https://github.com/scummvm/scummvm/commit/15119e2ca071d558c389d689367e12acff29f65c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-10-11T08:40:37-07:00
Commit Message:
GLK: GLULX: Fix toolbar rendering in Advent 350
Changed paths:
engines/glk/conf.cpp
engines/glk/conf.h
engines/glk/glk_api.cpp
engines/glk/window_graphics.cpp
engines/glk/window_graphics.h
diff --git a/engines/glk/conf.cpp b/engines/glk/conf.cpp
index 6ef52815b8..d1ed3fe496 100644
--- a/engines/glk/conf.cpp
+++ b/engines/glk/conf.cpp
@@ -310,6 +310,14 @@ uint Conf::parseColor(const byte *rgb) {
return _screenFormat.RGBToColor(rgb[0], rgb[1], rgb[2]);
}
+uint Conf::parseColor(const uint32 rgb) {
+ byte r = (rgb >> 16) & 0xff,
+ g = (rgb >> 8) & 0xff,
+ b = rgb & 0xff;
+
+ return _screenFormat.RGBToColor(r, g, b);
+}
+
void Conf::syncAsString(const Common::String &name, Common::String &val) {
if (_isLoading && exists(name))
val = ConfMan.get(name);
diff --git a/engines/glk/conf.h b/engines/glk/conf.h
index a0a2134a6a..06d2f23528 100644
--- a/engines/glk/conf.h
+++ b/engines/glk/conf.h
@@ -67,6 +67,11 @@ public:
*/
uint parseColor(const byte *rgb);
+ /**
+ * Convert an RGB uint32 to a color
+ */
+ uint parseColor(const uint32 rgb);
+
/**
* Encode a color to an 6-character RGB hex string
*/
diff --git a/engines/glk/glk_api.cpp b/engines/glk/glk_api.cpp
index 1fe45bc216..d9ea372d00 100644
--- a/engines/glk/glk_api.cpp
+++ b/engines/glk/glk_api.cpp
@@ -1015,7 +1015,8 @@ void GlkAPI::glk_window_fill_rect(winid_t win, uint color, int left, int top,
if (!win) {
warning("window_fill_rect: invalid ref");
} else {
- win->eraseRect(color, Rect(left, top, left + width, top + height));
+ uint c = _conf->parseColor(color);
+ win->fillRect(c, Rect(left, top, left + width, top + height));
}
}
@@ -1023,7 +1024,8 @@ void GlkAPI::glk_window_set_background_color(winid_t win, uint color) {
if (!win) {
warning("window_set_background_color: invalid ref");
} else {
- win->setBackgroundColor(color);
+ uint c = _conf->parseColor(color);
+ win->setBackgroundColor(c);
}
}
diff --git a/engines/glk/window_graphics.cpp b/engines/glk/window_graphics.cpp
index 7efa23570c..95942f3fd7 100644
--- a/engines/glk/window_graphics.cpp
+++ b/engines/glk/window_graphics.cpp
@@ -177,6 +177,10 @@ void GraphicsWindow::fillRect(uint color, const Rect &box) {
touch();
}
+void GraphicsWindow::clear() {
+ fillRect(_bgnd, Rect(0, 0, _bbox.width(), _bbox.width()));
+}
+
void GraphicsWindow::frameRect(uint color, const Rect &box) {
_surface->frameRect(box, color);
touch();
diff --git a/engines/glk/window_graphics.h b/engines/glk/window_graphics.h
index b32bae79fc..4cf964d829 100644
--- a/engines/glk/window_graphics.h
+++ b/engines/glk/window_graphics.h
@@ -108,6 +108,11 @@ public:
*/
void fillRect(uint color, const Rect &box) override;
+ /**
+ * Clear the window
+ */
+ virtual void clear() override;
+
/**
* Draw a rectangle in the given area
*/
More information about the Scummvm-git-logs
mailing list