aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'graphics')
-rw-r--r--graphics/cursorman.cpp2
-rw-r--r--graphics/cursorman.h4
-rw-r--r--graphics/pixelformat.h8
3 files changed, 9 insertions, 5 deletions
diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp
index 3dd7c1d023..b77aac37cf 100644
--- a/graphics/cursorman.cpp
+++ b/graphics/cursorman.cpp
@@ -138,7 +138,7 @@ void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX,
if (format)
cur->_format = *format;
else
- cur->_format = Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0);
+ cur->_format = Graphics::PixelFormat::createFormatCLUT8();
#endif
g_system->setMouseCursor(cur->_data, w, h, hotspotX, hotspotY, keycolor, targetScale, format);
diff --git a/graphics/cursorman.h b/graphics/cursorman.h
index b67241ab7b..ae7008f54c 100644
--- a/graphics/cursorman.h
+++ b/graphics/cursorman.h
@@ -181,13 +181,13 @@ private:
Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 0xFFFFFFFF, int targetScale = 1, const Graphics::PixelFormat *format = NULL) {
#ifdef ENABLE_RGB_COLOR
if (!format)
- _format = Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0);
+ _format = Graphics::PixelFormat::createFormatCLUT8();
else
_format = *format;
_size = w * h * _format.bytesPerPixel;
_keycolor &= ((1 << (_format.bytesPerPixel << 3)) - 1);
#else
- _format = Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0);
+ _format = Graphics::PixelFormat::createFormatCLUT8();
_size = w * h;
_keycolor &= 0xFF;
#endif
diff --git a/graphics/pixelformat.h b/graphics/pixelformat.h
index d7f5e851ad..380df985d9 100644
--- a/graphics/pixelformat.h
+++ b/graphics/pixelformat.h
@@ -65,6 +65,10 @@ struct PixelFormat {
rShift = RShift, gShift = GShift, bShift = BShift, aShift = AShift;
}
+ static inline PixelFormat createFormatCLUT8() {
+ return PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0);
+ }
+
inline bool operator==(const PixelFormat &fmt) const {
// TODO: If aLoss==8, then the value of aShift is irrelevant, and should be ignored.
return 0 == memcmp(this, &fmt, sizeof(PixelFormat));
@@ -150,7 +154,7 @@ struct PixelFormat {
* @param backend The higher priority list, meant to be a list of formats supported by the backend
* @param frontend The lower priority list, meant to be a list of formats supported by the engine
* @return The first item on the backend list that also occurs on the frontend list
- * or PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0) if no matching formats were found.
+ * or PixelFormat::createFormatCLUT8() if no matching formats were found.
*/
inline PixelFormat findCompatibleFormat(Common::List<PixelFormat> backend, Common::List<PixelFormat> frontend) {
#ifdef ENABLE_RGB_COLOR
@@ -161,7 +165,7 @@ inline PixelFormat findCompatibleFormat(Common::List<PixelFormat> backend, Commo
}
}
#endif
- return PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0);
+ return PixelFormat::createFormatCLUT8();
}
} // end of namespace Graphics