From 58a348fd18727aab57c0f4f8ab4cc5ad893ee795 Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Wed, 10 Jun 2009 05:35:54 +0000 Subject: Scumm engine now dynamically requests 16-bit color based on game features, (using ad-hoc request format) svn-id: r41417 --- engines/engine.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'engines/engine.cpp') diff --git a/engines/engine.cpp b/engines/engine.cpp index 269bb0bc28..4be4fe90be 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -124,11 +124,23 @@ void initCommonGFX(bool defaultTo1XScaler) { if (gameDomain && gameDomain->contains("fullscreen")) g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen")); } - void initGraphics(int width, int height, bool defaultTo1xScaler) { +#ifdef ENABLE_16BIT + Common::List formatList; + formatList.push_back(Graphics::kFormat8Bit); + initGraphics(width,height,defaultTo1xScaler, formatList); +} +void initGraphics(int width, int height, bool defaultTo1xScaler, Common::List formatList) { +#endif + g_system->beginGFXTransaction(); initCommonGFX(defaultTo1xScaler); +#ifdef ENABLE_16BIT + Graphics::ColorFormat format = g_system->findCompatibleFormat(formatList); + debug("%X",format); //TODO: set up the pixelFormat here + g_system->initFormat(format); +#endif g_system->initSize(width, height); OSystem::TransactionError gfxError = g_system->endGFXTransaction(); -- cgit v1.2.3 From 6adbd0c41e79b5a21f0430e060347d4978e9ce78 Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Thu, 11 Jun 2009 05:56:00 +0000 Subject: Renamed Graphics::ColorFormat to Graphics::ColorMode, streamlined enum by removing order section and temporarily removing kFormatARGB1555 Converted cursor code to make use of _screenFormat, instead of a parameter passed directly to it by the engine. Adjusted scumm engine to account for these changes. This should probably have been two separate commits, but the changes concern the same files... svn-id: r41443 --- engines/engine.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'engines/engine.cpp') diff --git a/engines/engine.cpp b/engines/engine.cpp index 4be4fe90be..31ead2df1a 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -126,18 +126,18 @@ void initCommonGFX(bool defaultTo1XScaler) { } void initGraphics(int width, int height, bool defaultTo1xScaler) { #ifdef ENABLE_16BIT - Common::List formatList; - formatList.push_back(Graphics::kFormat8Bit); + Common::List formatList; + formatList.push_back(Graphics::kFormatCLUT8); initGraphics(width,height,defaultTo1xScaler, formatList); } -void initGraphics(int width, int height, bool defaultTo1xScaler, Common::List formatList) { +void initGraphics(int width, int height, bool defaultTo1xScaler, Common::List formatList) { #endif g_system->beginGFXTransaction(); initCommonGFX(defaultTo1xScaler); #ifdef ENABLE_16BIT - Graphics::ColorFormat format = g_system->findCompatibleFormat(formatList); + Graphics::ColorMode format = g_system->findCompatibleFormat(formatList); debug("%X",format); //TODO: set up the pixelFormat here g_system->initFormat(format); #endif @@ -161,6 +161,15 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, Common::ListfindCompatibleFormat(formatList); debug("%X",format); //TODO: set up the pixelFormat here - g_system->initFormat(format); + g_system->initFormat(g_system->getPixelFormat(format)); #endif g_system->initSize(width, height); -- cgit v1.2.3 From 8d306ebccfa7e88b2e4f4635bff3987e550f98d3 Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Mon, 15 Jun 2009 09:45:19 +0000 Subject: Added kUnsupportedColorMode error code brought Scumm engine and SDL backend into compliance with API outlined in http://scummvmupthorn09.wordpress.com/2009/06/14/how-this-is-going-to-work/ Provided convenient Graphics::PixelFormat constructors for ColorMode enums, and bitformat integers. Removed last vestiges (I think) of initial cursor hack. svn-id: r41539 --- engines/engine.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'engines/engine.cpp') diff --git a/engines/engine.cpp b/engines/engine.cpp index 7ddc286b0f..213f69e7b1 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -126,20 +126,17 @@ void initCommonGFX(bool defaultTo1XScaler) { } void initGraphics(int width, int height, bool defaultTo1xScaler) { #ifdef ENABLE_16BIT - Common::List formatList; - formatList.push_back(Graphics::kFormatCLUT8); - initGraphics(width,height,defaultTo1xScaler, formatList); + Graphics::PixelFormat format = Graphics::kFormatCLUT8; + initGraphics(width,height,defaultTo1xScaler, format); } -void initGraphics(int width, int height, bool defaultTo1xScaler, Common::List formatList) { +void initGraphics(int width, int height, bool defaultTo1xScaler, Graphics::PixelFormat format) { #endif g_system->beginGFXTransaction(); initCommonGFX(defaultTo1xScaler); #ifdef ENABLE_16BIT - Graphics::ColorMode format = g_system->findCompatibleFormat(formatList); - debug("%X",format); //TODO: set up the pixelFormat here - g_system->initFormat(g_system->getPixelFormat(format)); + g_system->initFormat(format); #endif g_system->initSize(width, height); @@ -161,16 +158,16 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, Common::ListsetFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen")); } void initGraphics(int width, int height, bool defaultTo1xScaler) { -#ifdef ENABLE_16BIT +#ifdef ENABLE_RGB_COLOR initGraphics(width,height,defaultTo1xScaler, Graphics::PixelFormat::createFormatCLUT8()); } void initGraphics(int width, int height, bool defaultTo1xScaler, Graphics::PixelFormat format) { @@ -134,7 +134,7 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, Graphics::Pixel g_system->beginGFXTransaction(); initCommonGFX(defaultTo1xScaler); -#ifdef ENABLE_16BIT +#ifdef ENABLE_RGB_COLOR g_system->initFormat(format); #endif g_system->initSize(width, height); @@ -158,7 +158,7 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, Graphics::Pixel } // Just show warnings then these occur: -#ifdef ENABLE_16BIT +#ifdef ENABLE_RGB_COLOR if (gfxError & OSystem::kTransactionPixelFormatNotSupported) { Common::String message = "Could not initialize color format."; -- cgit v1.2.3 From 7c622423157e29b7206ba0c39a7756443ed1e70d Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Tue, 23 Jun 2009 02:02:51 +0000 Subject: Merged format initialization into InitSize to allow for backends not supporting gfx transactions. svn-id: r41801 --- engines/engine.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'engines/engine.cpp') diff --git a/engines/engine.cpp b/engines/engine.cpp index 15c6820f22..7a76de36dc 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -135,9 +135,10 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, Graphics::Pixel initCommonGFX(defaultTo1xScaler); #ifdef ENABLE_RGB_COLOR - g_system->initFormat(format); -#endif + g_system->initSize(width, height, format); +#else g_system->initSize(width, height); +#endif OSystem::TransactionError gfxError = g_system->endGFXTransaction(); -- cgit v1.2.3 From 853aec05ba4485f0bfc90e7515322dfd56a8d4af Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Sat, 27 Jun 2009 05:58:44 +0000 Subject: changed initGraphics, and OSystem::initSize to take Graphics::PixelFormat * parameters instead of Graphics::PixelFormat parameters, to save unnecessary pixelformat initialization if ENABLE_RGB_COLOR is not set. svn-id: r41909 --- engines/engine.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'engines/engine.cpp') diff --git a/engines/engine.cpp b/engines/engine.cpp index 7a76de36dc..198bfceaed 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -124,12 +124,7 @@ void initCommonGFX(bool defaultTo1XScaler) { if (gameDomain && gameDomain->contains("fullscreen")) g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen")); } -void initGraphics(int width, int height, bool defaultTo1xScaler) { -#ifdef ENABLE_RGB_COLOR - initGraphics(width,height,defaultTo1xScaler, Graphics::PixelFormat::createFormatCLUT8()); -} -void initGraphics(int width, int height, bool defaultTo1xScaler, Graphics::PixelFormat format) { -#endif +void initGraphics(int width, int height, bool defaultTo1xScaler, Graphics::PixelFormat *format) { g_system->beginGFXTransaction(); -- cgit v1.2.3 From 9e1916bcad3cc33a870bdbff5bd01b39e523492d Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Tue, 30 Jun 2009 07:30:57 +0000 Subject: renamed kTransactionPixelFormatNotSupported to kTransactionFormatNotSupported, retyped all Graphics::PixelFormat * parameters to const Graphics::PixelFormat *, (hopefully) repaired all memory leaks on screen and cursor format changes, provided OSystem::getScreenFormat and OSystem::getSupportedFormats methods for when ENABLE_RGB_COLOR is not set, completely forgot the "commit early, commit often" mantra. svn-id: r41972 --- engines/engine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/engine.cpp') diff --git a/engines/engine.cpp b/engines/engine.cpp index 198bfceaed..8769219c2b 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -124,7 +124,7 @@ void initCommonGFX(bool defaultTo1XScaler) { if (gameDomain && gameDomain->contains("fullscreen")) g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen")); } -void initGraphics(int width, int height, bool defaultTo1xScaler, Graphics::PixelFormat *format) { +void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics::PixelFormat *format) { g_system->beginGFXTransaction(); @@ -155,7 +155,7 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, Graphics::Pixel // Just show warnings then these occur: #ifdef ENABLE_RGB_COLOR - if (gfxError & OSystem::kTransactionPixelFormatNotSupported) { + if (gfxError & OSystem::kTransactionFormatNotSupported) { Common::String message = "Could not initialize color format."; GUI::MessageDialog dialog(message); -- cgit v1.2.3 From 5e9285e8fa8eb2f0b01abc6caf93dc926f41d795 Mon Sep 17 00:00:00 2001 From: Jordi Vilalta Prat Date: Tue, 30 Jun 2009 08:25:08 +0000 Subject: Fixed a few formatting bits svn-id: r41973 --- engines/engine.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/engine.cpp') diff --git a/engines/engine.cpp b/engines/engine.cpp index 8769219c2b..33eb424b76 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -124,6 +124,7 @@ void initCommonGFX(bool defaultTo1XScaler) { if (gameDomain && gameDomain->contains("fullscreen")) g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen")); } + void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics::PixelFormat *format) { g_system->beginGFXTransaction(); -- cgit v1.2.3 From 2f370ef8ab65db8443c496c47de98740b31c4220 Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Fri, 10 Jul 2009 10:43:48 +0000 Subject: Overloaded initGraphics to provide for simpler procedures for engines supporting more than one format. svn-id: r42330 --- engines/engine.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'engines/engine.cpp') diff --git a/engines/engine.cpp b/engines/engine.cpp index 1fd77eb310..399f188962 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -131,7 +131,13 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics: initCommonGFX(defaultTo1xScaler); #ifdef ENABLE_RGB_COLOR - g_system->initSize(width, height, format); + if (format) + g_system->initSize(width, height, format); + else { + Graphics::PixelFormat Format = g_system->getSupportedFormats().front(); + debug("%d,%X,%X,%X",Format.bytesPerPixel << 3, Format.rBits(), Format.gBits(), Format.bBits()); + g_system->initSize(width, height, &Format); + } #else g_system->initSize(width, height); #endif @@ -183,6 +189,14 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics: dialog.runModal(); } } +void initGraphics(int width, int height, bool defaultTo1xScaler, const Common::List &formatList) { + Graphics::PixelFormat format = Graphics::findCompatibleFormat(g_system->getSupportedFormats(),formatList); + initGraphics(width,height,defaultTo1xScaler,&format); +} +void initGraphics(int width, int height, bool defaultTo1xScaler) { + Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8(); + initGraphics(width,height,defaultTo1xScaler,&format); +} void GUIErrorMessage(const Common::String msg) { g_system->setWindowCaption("Error"); -- cgit v1.2.3 From 79e03a92a5782797dd5beacef3a63ed3dbdee68d Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Mon, 13 Jul 2009 19:24:41 +0000 Subject: Removed an unneeded debug console output from initGraphics svn-id: r42450 --- engines/engine.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'engines/engine.cpp') diff --git a/engines/engine.cpp b/engines/engine.cpp index 399f188962..eb46add82f 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -135,7 +135,6 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics: g_system->initSize(width, height, format); else { Graphics::PixelFormat Format = g_system->getSupportedFormats().front(); - debug("%d,%X,%X,%X",Format.bytesPerPixel << 3, Format.rBits(), Format.gBits(), Format.bBits()); g_system->initSize(width, height, &Format); } #else -- cgit v1.2.3