aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJody Northup2009-07-08 16:07:58 +0000
committerJody Northup2009-07-08 16:07:58 +0000
commit828ed66555b99363fed62b4cbb83c36de68c3024 (patch)
tree954ef2912744813160ed95984808ac21c2b68a17
parent3e47aaa151ff751af867c57344b063c30f5f75f3 (diff)
downloadscummvm-rg350-828ed66555b99363fed62b4cbb83c36de68c3024.tar.gz
scummvm-rg350-828ed66555b99363fed62b4cbb83c36de68c3024.tar.bz2
scummvm-rg350-828ed66555b99363fed62b4cbb83c36de68c3024.zip
Reinstated static inline Graphics::PixelFormat::createFormatCLUT8(), which I am told was not supposed to be removed with the others.
svn-id: r42268
-rw-r--r--backends/platform/sdl/graphics.cpp2
-rw-r--r--backends/platform/sdl/sdl.cpp4
-rw-r--r--backends/platform/sdl/sdl.h51
-rw-r--r--common/system.h6
-rw-r--r--engines/groovie/groovie.cpp4
-rw-r--r--graphics/cursorman.cpp2
-rw-r--r--graphics/cursorman.h4
-rw-r--r--graphics/pixelformat.h8
8 files changed, 35 insertions, 46 deletions
diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp
index 95a3276fa5..27f32ee8d2 100644
--- a/backends/platform/sdl/graphics.cpp
+++ b/backends/platform/sdl/graphics.cpp
@@ -361,7 +361,7 @@ void OSystem_SDL::initSize(uint w, uint h, const Graphics::PixelFormat *format)
//avoid redundant format changes
Graphics::PixelFormat newFormat;
if (!format)
- newFormat = Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0);
+ newFormat = Graphics::PixelFormat::createFormatCLUT8();
else
newFormat = *format;
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index f7bd71361f..105206ec07 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -197,8 +197,8 @@ OSystem_SDL::OSystem_SDL()
#endif
_hwscreen(0), _screen(0), _tmpscreen(0),
#ifdef ENABLE_RGB_COLOR
- _screenFormat(Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0)),
- _cursorFormat(Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0)),
+ _screenFormat(Graphics::PixelFormat::createFormatCLUT8()),
+ _cursorFormat(Graphics::PixelFormat::createFormatCLUT8()),
#endif
_overlayVisible(false),
_overlayscreen(0), _tmpscreen2(0),
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index b8ab2f6d97..c2648e8ed7 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -94,44 +94,29 @@ public:
if (HWFormat->BitsPerPixel >= 32)
{
list.push_back(Graphics::PixelFormat::createFormatRGBA8888());
- list.push_back(Graphics::PixelFormat(4, 0, 0, 0, 0, 16, 8, 0, 24)
-);
- list.push_back(Graphics::PixelFormat(4, 0, 0, 0, 0, 0, 8, 16, 24)
-);
- list.push_back(Graphics::PixelFormat(4, 0, 0, 0, 0, 8, 16, 24, 0)
-); }
+ list.push_back(Graphics::PixelFormat(4, 0, 0, 0, 0, 16, 8, 0, 24));
+ list.push_back(Graphics::PixelFormat(4, 0, 0, 0, 0, 0, 8, 16, 24));
+ list.push_back(Graphics::PixelFormat(4, 0, 0, 0, 0, 8, 16, 24, 0));
+ }
if (HWFormat->BitsPerPixel >= 24)
{
- list.push_back(Graphics::PixelFormat(3, 0, 0, 0, 8, 16, 8, 0, 0)
-);
- list.push_back(Graphics::PixelFormat(3, 0, 0, 0, 8, 0, 8, 16, 0)
-);
+ list.push_back(Graphics::PixelFormat(3, 0, 0, 0, 8, 16, 8, 0, 0));
+ list.push_back(Graphics::PixelFormat(3, 0, 0, 0, 8, 0, 8, 16, 0));
}
#endif //ENABLE_32BIT
- if (HWFormat->BitsPerPixel >= 16)
- {
- list.push_back(Graphics::PixelFormat(2, 3, 2, 3, 8, 11, 5, 0, 0)
-);
- list.push_back(Graphics::PixelFormat(2, 3, 3, 3, 7, 10, 5, 0, 15)
-);
- list.push_back(Graphics::PixelFormat(2, 3, 3, 3, 8, 10, 5, 0, 0)
-);
- list.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0)
-);
- list.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 8, 4, 0, 12)
-);
- list.push_back(Graphics::PixelFormat(2, 3, 2, 3, 8, 0, 5, 11, 0)
-);
- list.push_back(Graphics::PixelFormat(2, 3, 3, 3, 7, 0, 5, 10, 15)
-);
- list.push_back(Graphics::PixelFormat(2, 3, 3, 3, 8, 0, 5, 10, 0)
-);
- list.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 0, 4, 8, 12)
-);
- list.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 4, 8, 12, 0)
-);
+ if (HWFormat->BitsPerPixel >= 16) {
+ list.push_back(Graphics::PixelFormat(2, 3, 2, 3, 8, 11, 5, 0, 0));
+ list.push_back(Graphics::PixelFormat(2, 3, 3, 3, 7, 10, 5, 0, 15));
+ list.push_back(Graphics::PixelFormat(2, 3, 3, 3, 8, 10, 5, 0, 0));
+ list.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0));
+ list.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 8, 4, 0, 12));
+ list.push_back(Graphics::PixelFormat(2, 3, 2, 3, 8, 0, 5, 11, 0));
+ list.push_back(Graphics::PixelFormat(2, 3, 3, 3, 7, 0, 5, 10, 15));
+ list.push_back(Graphics::PixelFormat(2, 3, 3, 3, 8, 0, 5, 10, 0));
+ list.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 0, 4, 8, 12));
+ list.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 4, 8, 12, 0));
}
- list.push_back(Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0));
+ list.push_back(Graphics::PixelFormat::createFormatCLUT8());
return list;
}
#endif
diff --git a/common/system.h b/common/system.h
index 63825f8401..6bcf746292 100644
--- a/common/system.h
+++ b/common/system.h
@@ -375,7 +375,7 @@ public:
* 3) Graphics::PixelFormat(4, 0, 0, 0, 0, 24, 16, 8, 0)
* 4) Graphics::PixelFormat(2, 3, 3, 3, 8, 10, 5, 0, 0)
- * 5) Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0)
+ * 5) Graphics::PixelFormat::createFormatCLUT8()
*
* @see Graphics::PixelFormat
*
@@ -387,12 +387,12 @@ public:
virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const = 0;
#else
inline Graphics::PixelFormat getScreenFormat() const {
- return Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0);
+ return Graphics::PixelFormat::createFormatCLUT8();
};
inline Common::List<Graphics::PixelFormat> getSupportedFormats() const {
Common::List<Graphics::PixelFormat> list;
- list.push_back(Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0));
+ list.push_back(Graphics::PixelFormat::createFormatCLUT8());
return list;
};
#endif
diff --git a/engines/groovie/groovie.cpp b/engines/groovie/groovie.cpp
index 039efd2c49..6f985ddad5 100644
--- a/engines/groovie/groovie.cpp
+++ b/engines/groovie/groovie.cpp
@@ -78,11 +78,11 @@ Common::Error GroovieEngine::run() {
// Save the enabled mode as it can be both an RGB mode or CLUT8
_pixelFormat = _system->getScreenFormat();
- _mode8bit = (_pixelFormat == Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0));
+ _mode8bit = (_pixelFormat == Graphics::PixelFormat::createFormatCLUT8());
break;
case kGroovieT7G:
initGraphics(640, 480, true);
- _pixelFormat = Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0);
+ _pixelFormat = Graphics::PixelFormat::createFormatCLUT8();
break;
}
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