aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2018-10-29 20:07:36 -0700
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit4fc1c30423aa8e161a3ea2edd1f45c4ad681a92a (patch)
tree7cd2d73fa89e18f4c4ae8ca52e5e67d081928c58 /engines
parent0a21220707b879b5fcfe0cbed1774e808ddac68f (diff)
downloadscummvm-rg350-4fc1c30423aa8e161a3ea2edd1f45c4ad681a92a.tar.gz
scummvm-rg350-4fc1c30423aa8e161a3ea2edd1f45c4ad681a92a.tar.bz2
scummvm-rg350-4fc1c30423aa8e161a3ea2edd1f45c4ad681a92a.zip
GLK: Fix Attributes equality checks
Diffstat (limited to 'engines')
-rw-r--r--engines/gargoyle/window_text_buffer.cpp9
-rw-r--r--engines/gargoyle/window_text_grid.cpp2
-rw-r--r--engines/gargoyle/windows.h17
3 files changed, 21 insertions, 7 deletions
diff --git a/engines/gargoyle/window_text_buffer.cpp b/engines/gargoyle/window_text_buffer.cpp
index d40dcf1602..4db0bf9c86 100644
--- a/engines/gargoyle/window_text_buffer.cpp
+++ b/engines/gargoyle/window_text_buffer.cpp
@@ -960,9 +960,8 @@ void TextBufferWindow::redraw() {
x = x0 + SLOP + ln->_lm;
a = 0;
- for (b = 0; b < linelen; b++)
- {
- if (ln->_attrs[a] == ln->_attrs[b]) {
+ for (b = 0; b < linelen; b++) {
+ if (ln->_attrs[a] != ln->_attrs[b]) {
link = ln->_attrs[a].hyper;
font = ln->_attrs[a].attrFont(_styles);
color = ln->_attrs[a].attrBg(_styles);
@@ -1015,7 +1014,7 @@ void TextBufferWindow::redraw() {
a = 0;
for (b = 0; b < linelen; b++)
{
- if (ln->_attrs[a] == ln->_attrs[b]) {
+ if (ln->_attrs[a] != ln->_attrs[b]) {
link = ln->_attrs[a].hyper;
font = ln->_attrs[a].attrFont(_styles);
color = link ? g_conf->_linkColor : ln->_attrs[a].attrFg(_styles);
@@ -1603,7 +1602,7 @@ int TextBufferWindow::calcWidth(glui32 *chars, Attributes *attrs, int startchar,
a = startchar;
for (b = startchar; b < numChars; b++) {
- if (attrs[a] == attrs[b]) {
+ if (attrs[a] != attrs[b]) {
w += screen.stringWidthUni(attrs[a].attrFont(_styles),
Common::U32String(chars + a, b - a), spw);
a = b;
diff --git a/engines/gargoyle/window_text_grid.cpp b/engines/gargoyle/window_text_grid.cpp
index cad18af48f..6d1aff4946 100644
--- a/engines/gargoyle/window_text_grid.cpp
+++ b/engines/gargoyle/window_text_grid.cpp
@@ -599,7 +599,7 @@ void TextGridWindow::redraw() {
a = 0;
for (b = 0; b < _width; b++) {
- if (ln->_attrs[a] == ln->_attrs[b]) {
+ if (ln->_attrs[a] != ln->_attrs[b]) {
link = ln->_attrs[a].hyper;
font = ln->_attrs[a].attrFont(styles);
fgcolor = link ? g_conf->_linkColor : ln->_attrs[a].attrFg(styles);
diff --git a/engines/gargoyle/windows.h b/engines/gargoyle/windows.h
index 93d7ac24f6..d753d5311e 100644
--- a/engines/gargoyle/windows.h
+++ b/engines/gargoyle/windows.h
@@ -261,12 +261,27 @@ struct Attributes {
&& style == src.style && fgcolor == src.fgcolor && bgcolor == src.bgcolor
&& hyper == src.hyper;
}
+ /**
+ * Inequality comparison
+ */
+ bool operator!=(const Attributes &src) {
+ return fgset != src.fgset || bgset != src.bgset || reverse != src.reverse
+ || style != src.style || fgcolor != src.fgcolor || bgcolor != src.bgcolor
+ || hyper != src.hyper;
+ }
+ /**
+ * Return the background color for the current font style
+ */
byte *attrBg(WindowStyle *styles);
+
+ /**
+ * Return the foreground color for the current font style
+ */
byte *attrFg(WindowStyle *styles);
/**
- * Get the font from the attribute's style
+ * Get the font for the current font style
*/
FACES attrFont(WindowStyle *styles) const { return styles[style].font; }
};