aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2019-01-16 21:12:03 -0800
committerPaul Gilbert2019-01-16 21:12:03 -0800
commit795e23c05d81ca40f46f38bac0872272de6f9851 (patch)
tree5f452e00600198dad7f21ed96690501cba95794c
parentb076911ae405612bfac834a8891a47916d406359 (diff)
downloadscummvm-rg350-795e23c05d81ca40f46f38bac0872272de6f9851.tar.gz
scummvm-rg350-795e23c05d81ca40f46f38bac0872272de6f9851.tar.bz2
scummvm-rg350-795e23c05d81ca40f46f38bac0872272de6f9851.zip
GLK: Constifying attribute, width calc methods
-rw-r--r--engines/glk/window_text_buffer.cpp3
-rw-r--r--engines/glk/window_text_buffer.h2
-rw-r--r--engines/glk/windows.cpp4
-rw-r--r--engines/glk/windows.h10
4 files changed, 9 insertions, 10 deletions
diff --git a/engines/glk/window_text_buffer.cpp b/engines/glk/window_text_buffer.cpp
index ce4dd7c22e..0faafc803c 100644
--- a/engines/glk/window_text_buffer.cpp
+++ b/engines/glk/window_text_buffer.cpp
@@ -1587,8 +1587,7 @@ void TextBufferWindow::scrollResize() {
_scrollBack += SCROLLBACK;
}
-int TextBufferWindow::calcWidth(uint32 *chars, Attributes *attrs, int startchar,
- int numChars, int spw) {
+int TextBufferWindow::calcWidth(const uint32 *chars, const Attributes *attrs, int startchar, int numChars, int spw) {
Screen &screen = *g_vm->_screen;
int w = 0;
int a, b;
diff --git a/engines/glk/window_text_buffer.h b/engines/glk/window_text_buffer.h
index 47d87a45ab..0ac74d2e2a 100644
--- a/engines/glk/window_text_buffer.h
+++ b/engines/glk/window_text_buffer.h
@@ -91,7 +91,7 @@ private:
void scrollOneLine(bool forced);
void scrollResize();
- int calcWidth(uint32 *chars, Attributes *attrs, int startchar, int numchars, int spw);
+ int calcWidth(const uint32 *chars, const Attributes *attrs, int startchar, int numchars, int spw);
public:
int _width, _height;
int _spaced;
diff --git a/engines/glk/windows.cpp b/engines/glk/windows.cpp
index c8ab44768d..624defa9f5 100644
--- a/engines/glk/windows.cpp
+++ b/engines/glk/windows.cpp
@@ -730,7 +730,7 @@ void Attributes::clear() {
style = 0;
}
-byte *Attributes::attrBg(WindowStyle *styles) {
+const byte *Attributes::attrBg(const WindowStyle *styles) {
int revset = reverse || (styles[style].reverse && !Windows::_overrideReverse);
int zfset = fgset ? fgset : Windows::_overrideFgSet;
@@ -771,7 +771,7 @@ byte *Attributes::attrBg(WindowStyle *styles) {
}
}
-byte *Attributes::attrFg(WindowStyle *styles) {
+const byte *Attributes::attrFg(const WindowStyle *styles) {
int revset = reverse || (styles[style].reverse && !Windows::_overrideReverse);
int zfset = fgset ? fgset : Windows::_overrideFgSet;
diff --git a/engines/glk/windows.h b/engines/glk/windows.h
index c905556f9e..c917d2f04b 100644
--- a/engines/glk/windows.h
+++ b/engines/glk/windows.h
@@ -328,7 +328,7 @@ struct Attributes {
/**
* Equality comparison
*/
- bool operator==(const Attributes &src) {
+ bool operator==(const Attributes &src) const {
return fgset == src.fgset && bgset == src.bgset && reverse == src.reverse
&& style == src.style && fgcolor == src.fgcolor && bgcolor == src.bgcolor
&& hyper == src.hyper;
@@ -336,7 +336,7 @@ struct Attributes {
/**
* Inequality comparison
*/
- bool operator!=(const Attributes &src) {
+ bool operator!=(const Attributes &src) const {
return fgset != src.fgset || bgset != src.bgset || reverse != src.reverse
|| style != src.style || fgcolor != src.fgcolor || bgcolor != src.bgcolor
|| hyper != src.hyper;
@@ -345,17 +345,17 @@ struct Attributes {
/**
* Return the background color for the current font style
*/
- byte *attrBg(WindowStyle *styles);
+ const byte *attrBg(const WindowStyle *styles);
/**
* Return the foreground color for the current font style
*/
- byte *attrFg(WindowStyle *styles);
+ const byte *attrFg(const WindowStyle *styles);
/**
* Get the font for the current font style
*/
- FACES attrFont(WindowStyle *styles) const {
+ FACES attrFont(const WindowStyle *styles) const {
return styles[style].font;
}
};