GLK: GLULX: Fix toolbar rendering in Advent 350
This commit is contained in:
parent
553539a269
commit
59b9d6fb7e
5 changed files with 26 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue