GLK: FROTZ: More properly fix transparency handling of header

This commit is contained in:
Paul Gilbert 2019-02-17 14:32:42 -08:00
parent 046f65a2c4
commit 8fcf009668
8 changed files with 35 additions and 32 deletions

View File

@ -296,18 +296,20 @@ void Processor::z_set_true_colour() {
}
void Processor::z_set_colour() {
int fg = zargs[0];
int bg = zargs[1];
int fg = (short)zargs[0];
int bg = (short)zargs[1];
zword win = (h_version == V6) ? winarg2() : 0;
if (win == 1 && h_version == V6)
bg = zcolor_Transparent;
flush_buffer();
if ((short)fg == -1)
if (fg == -1)
// Get color at cursor
fg = os_peek_color();
if ((short)bg == -1)
// Get color at cursor
bg = os_peek_color();
if (bg == -1)
bg = zcolor_Transparent;
if (fg == 0)
// keep current colour
@ -320,9 +322,9 @@ void Processor::z_set_colour() {
if (bg == 1)
bg = h_default_background;
if (fg < zcolor_NUMCOLORS)
if (fg >= 0 && fg < zcolor_NUMCOLORS)
fg = zcolors[fg];
if (bg < zcolor_NUMCOLORS)
if (bg >= 0 && bg < zcolor_NUMCOLORS)
bg = zcolors[bg];
if (h_version == V6 && h_interpreter_number == INTERP_AMIGA) {
@ -333,9 +335,9 @@ void Processor::z_set_colour() {
int fg2 = _wp[i][TRUE_FG_COLOR];
if (bg2 < 16)
bg2 = (bg2 == _wp[0][TRUE_BG_COLOR]) ? fg : bg;
bg2 = (bg2 == (int)_wp[0][TRUE_BG_COLOR]) ? fg : bg;
if (fg2 < 16)
fg2 = (fg2 == _wp[0][TRUE_FG_COLOR]) ? fg : bg;
fg2 = (fg2 == (int)_wp[0][TRUE_FG_COLOR]) ? fg : bg;
_wp[i][TRUE_FG_COLOR] = fg2;
_wp[i][TRUE_BG_COLOR] = bg2;

View File

@ -118,14 +118,14 @@ void Window::setPosition(const Point &newPos) {
_win->setPosition(Point((newPos.x - 1) * g_conf->_monoInfo._cellW, (newPos.y - 1) * g_conf->_monoInfo._cellH));
}
const zword &Window::getProperty(WindowProperty propType) {
const uint &Window::getProperty(WindowProperty propType) {
if (_win)
update();
return _properties[propType];
}
void Window::setProperty(WindowProperty propType, zword value) {
void Window::setProperty(WindowProperty propType, uint value) {
switch (propType) {
case TRUE_FG_COLOR:
case TRUE_BG_COLOR:

View File

@ -63,14 +63,14 @@ class Window {
/**
* Get
*/
operator zword() const {
operator uint() const {
return _owner->getProperty(_prop);
}
/**
* Set
*/
PropertyAccessor &operator=(zword val) {
PropertyAccessor &operator=(uint val) {
_owner->setProperty(_prop, val);
return *this;
}
@ -78,17 +78,17 @@ class Window {
private:
Windows *_windows;
winid_t _win;
zword _properties[TRUE_BG_COLOR + 1];
uint _properties[TRUE_BG_COLOR + 1];
private:
/**
* Get a property value
*/
const zword &getProperty(WindowProperty propType);
const uint &getProperty(WindowProperty propType);
/**
* Set a property value
*/
void setProperty(WindowProperty propType, zword value);
void setProperty(WindowProperty propType, uint value);
/**
* Called when trying to reposition or resize windows. Does special handling for the lower window

View File

@ -200,10 +200,10 @@ enum giDisp {
};
enum zcolor {
zcolor_Transparent = (uint)-4,
zcolor_Cursor = (uint)-3,
zcolor_Current = (uint)-2,
zcolor_Default = (uint)-1
zcolor_Transparent = 0x7FFFFFFCU,
zcolor_Cursor = 0x7FFFFFFDU,
zcolor_Current = 0x7FFFFFFEU,
zcolor_Default = 0x7FFFFFFFU
};
#ifdef GLK_MODULE_IMAGE

View File

@ -262,7 +262,7 @@ void WindowStream::setZColors(uint fg, uint bg) {
}
}
if (bg != zcolor_Transparent && bg != zcolor_Cursor) {
if (/*bg != zcolor_Transparent &&*/ bg != zcolor_Cursor) {
if (bg == zcolor_Default) {
_window->_attr.bgset = 0;
_window->_attr.bgcolor = 0;

View File

@ -139,6 +139,11 @@ void PairWindow::rearrange(const Rect &box) {
}
void PairWindow::redraw() {
// When the windows can be in arbitrary positions, some of them may be transparent, so we always
// need to force a full screen redraw in such cases
if (_dir == winmethod_Arbitrary)
Windows::_forceRedraw = true;
Window::redraw();
for (int ctr = 0, idx = (_backward ? (int)_children.size() - 1 : 0); ctr < (int)_children.size();

View File

@ -602,13 +602,9 @@ void Window::requestLineEventUni(uint32 *buf, uint maxlen, uint initlen) {
void Window::redraw() {
if (Windows::_forceRedraw) {
PairWindow *parent = dynamic_cast<PairWindow *>(_parent);
if (!parent || parent->_dir != winmethod_Arbitrary) {
uint color = Windows::_overrideBgSet ? g_conf->_windowColor : _bgColor;
int y0 = _yAdj ? _bbox.top - _yAdj : _bbox.top;
g_vm->_screen->fillRect(Rect(_bbox.left, y0, _bbox.right, _bbox.bottom), color);
}
uint color = Windows::_overrideBgSet ? g_conf->_windowColor : _bgColor;
int y0 = _yAdj ? _bbox.top - _yAdj : _bbox.top;
g_vm->_screen->fillRect(Rect(_bbox.left, y0, _bbox.right, _bbox.bottom), color);
}
}

View File

@ -321,9 +321,9 @@ struct Attributes {
unsigned reverse : 1;
unsigned : 1;
unsigned style : 4;
unsigned fgcolor : 24;
unsigned bgcolor : 24;
unsigned hyper : 32;
uint fgcolor;
uint bgcolor;
uint hyper;
/**
* Constructor