[Scummvm-cvs-logs] SF.net SVN: scummvm:[41854] scummvm/branches/gsoc2009-16bit
upthorn at users.sourceforge.net
upthorn at users.sourceforge.net
Thu Jun 25 10:55:16 CEST 2009
Revision: 41854
http://scummvm.svn.sourceforge.net/scummvm/?rev=41854&view=rev
Author: upthorn
Date: 2009-06-25 08:55:16 +0000 (Thu, 25 Jun 2009)
Log Message:
-----------
API modification -- replaced "Graphics::PixelFormat getBestFormat()" with "Common::List<Graphics::PixelFormat> getSupportedFormats()"
Modified Paths:
--------------
scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h
scummvm/branches/gsoc2009-16bit/common/system.h
scummvm/branches/gsoc2009-16bit/engines/groovie/groovie.cpp
Modified: scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h 2009-06-25 02:41:39 UTC (rev 41853)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h 2009-06-25 08:55:16 UTC (rev 41854)
@@ -86,21 +86,38 @@
virtual Graphics::PixelFormat getScreenFormat() const { return _screenFormat; }
// Highest supported
- virtual Graphics::PixelFormat getBestFormat() const {
- //TODO scale down 16/32 bit based on hardware support
+ virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const {
+ //TODO determine hardware color component order
+ Common::List<Graphics::PixelFormat> list;
+ SDL_PixelFormat *HWFormat = SDL_GetVideoInfo()->vfmt;
+#ifdef ENABLE_32BIT
+ if (HWFormat->BitsPerPixel >= 32)
{
- SDL_PixelFormat *HWFormat = SDL_GetVideoInfo()->vfmt;
-#ifdef ENABLE_32BIT
- if (HWFormat->BitsPerPixel >= 32)
- return Graphics::PixelFormat::createFormatRGBA8888();
- if (HWFormat->BitsPerPixel >= 24)
- return Graphics::
- FormatRGB888();
+ list.push_back(Graphics::PixelFormat::createFormatRGBA8888());
+ list.push_back(Graphics::PixelFormat::createFormatARGB8888());
+ list.push_back(Graphics::PixelFormat::createFormatABGR8888());
+ list.push_back(Graphics::PixelFormat::createFormatBGRA8888()); }
+ if (HWFormat->BitsPerPixel >= 24)
+ {
+ list.push_back(Graphics::PixelFormat::createFormatRGB888());
+ list.push_back(Graphics::PixelFormat::createFormatBGR888());
+ }
#endif //ENABLE_32BIT
- if (HWFormat->BitsPerPixel >= 16)
- return Graphics::PixelFormat::createFormatRGB565();
+ if (HWFormat->BitsPerPixel >= 16)
+ {
+ list.push_back(Graphics::PixelFormat::createFormatRGB565());
+ list.push_back(Graphics::PixelFormat::createFormatXRGB1555());
+ list.push_back(Graphics::PixelFormat::createFormatRGB555());
+ list.push_back(Graphics::PixelFormat::createFormatRGBA4444());
+ list.push_back(Graphics::PixelFormat::createFormatARGB4444());
+ list.push_back(Graphics::PixelFormat::createFormatBGR565());
+ list.push_back(Graphics::PixelFormat::createFormatXBGR1555());
+ list.push_back(Graphics::PixelFormat::createFormatBGR555());
+ list.push_back(Graphics::PixelFormat::createFormatABGR4444());
+ list.push_back(Graphics::PixelFormat::createFormatBGRA4444());
}
- return Graphics::PixelFormat::createFormatCLUT8();
+ list.push_back(Graphics::PixelFormat::createFormatCLUT8());
+ return list;
}
#endif
Modified: scummvm/branches/gsoc2009-16bit/common/system.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/common/system.h 2009-06-25 02:41:39 UTC (rev 41853)
+++ scummvm/branches/gsoc2009-16bit/common/system.h 2009-06-25 08:55:16 UTC (rev 41854)
@@ -345,16 +345,34 @@
#ifdef ENABLE_RGB_COLOR
/**
- * Returns the pixel format of the screen.
+ * Determine the pixel format currently in use for screen rendering.
+ * @return the active screen pixel format.
* @see Graphics::PixelFormat
*/
virtual Graphics::PixelFormat getScreenFormat() const = 0;
/**
- * Returns the highest color pixel format supported by the backend
+ * Returns a list of all pixel formats supported by the backend.
+ * The first item in the list must be directly supported by hardware,
+ * and provide the largest color space of those formats with direct
+ * hardware support. It is also strongly recommended that remaining
+ * formats should be placed in order of descending preference for the
+ * backend to use.
+ *
+ * EG: a backend that supports 32-bit ABGR and 16-bit 555 BGR in hardware
+ * and provides conversion from equivalent RGB(A) modes should order its list
+ * 1) Graphics::PixelFormat::createFormatABGR8888()
+ * 2) Graphics::PixelFormat::createFormatBGR555()
+ * 3) Graphics::PixelFormat::createFormatRGBA8888()
+ * 4) Graphics::PixelFormat::createFormatRGB555()
+ * 5) Graphics::PixelFormat::createFormatCLUT8()
+ *
* @see Graphics::PixelFormat
+ *
+ * @note All backends supporting RGB color must be able to accept game data
+ * in RGB color order, even if hardware uses BGR or some other color order.
*/
- virtual Graphics::PixelFormat getBestFormat() const = 0;
+ virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const = 0;
#endif
/**
Modified: scummvm/branches/gsoc2009-16bit/engines/groovie/groovie.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/groovie/groovie.cpp 2009-06-25 02:41:39 UTC (rev 41853)
+++ scummvm/branches/gsoc2009-16bit/engines/groovie/groovie.cpp 2009-06-25 08:55:16 UTC (rev 41854)
@@ -73,7 +73,7 @@
switch (_gameDescription->version) {
case kGroovieV2:
#ifdef ENABLE_RGB_COLOR
- _pixelFormat = _system->getBestFormat();
+ _pixelFormat = _system->getSupportedFormats().front();
initGraphics(640, 480, true, _pixelFormat);
break;
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list