From 3abccb2e339144191553555756e3ff43222c3a36 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Tue, 7 Aug 2012 14:56:06 +0200 Subject: WINTERMUTE: Change PixelFormat to ARGB (same as Sword25) Mainly a workaround for the OpenGL-backend. --- .../wintermute/base/font/base_font_truetype.cpp | 4 +- .../base/gfx/osystem/base_render_osystem.cpp | 2 +- .../wintermute/graphics/transparent_surface.cpp | 59 +++++++++++----------- engines/wintermute/wintermute.cpp | 2 +- 4 files changed, 33 insertions(+), 34 deletions(-) (limited to 'engines') diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp index b80bbdc41d..00b522c826 100644 --- a/engines/wintermute/base/font/base_font_truetype.cpp +++ b/engines/wintermute/base/font/base_font_truetype.cpp @@ -261,7 +261,7 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width, // void drawString(Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlign align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true) const; Graphics::Surface *surface = new Graphics::Surface(); if (_deletableFont) { // We actually have a TTF - surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)); + surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24)); } else { // We are using a fallback, they can't do 32bpp surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0)); } @@ -274,7 +274,7 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width, } BaseSurface *retSurface = _gameRef->_renderer->createSurface(); - Graphics::Surface *convertedSurface = surface->convertTo(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8 , 0)); + Graphics::Surface *convertedSurface = surface->convertTo(Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24)); retSurface->putSurface(*convertedSurface, true); convertedSurface->free(); surface->free(); diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index bc952b0b36..f12478f7b3 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -153,7 +153,7 @@ bool BaseRenderOSystem::initRenderer(int width, int height, bool windowed) { _windowed = !ConfMan.getBool("fullscreen"); - Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0); + Graphics::PixelFormat format(4, 8, 8, 8, 8, 16, 8, 0, 24); g_system->beginGFXTransaction(); g_system->initSize(_width, _height, &format); OSystem::TransactionError gfxError = g_system->endGFXTransaction(); diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 59010d5ed3..49deafa7e6 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -47,25 +47,25 @@ void doBlit(byte *ino, byte* outo, uint32 width, uint32 height, uint32 pitch, in byte *in, *out; #ifdef SCUMM_LITTLE_ENDIAN - const int aIndex = 0; - const int bIndex = 1; - const int gIndex = 2; - const int rIndex = 3; -#else const int aIndex = 3; - const int bIndex = 2; + const int bIndex = 0; const int gIndex = 1; - const int rIndex = 0; + const int rIndex = 2; +#else + const int aIndex = 0; + const int bIndex = 3; + const int gIndex = 2; + const int rIndex = 1; #endif - const int bShift = 8;//img->format.bShift; - const int gShift = 16;//img->format.gShift; - const int rShift = 24;//img->format.rShift; - const int aShift = 0;//img->format.aShift; + const int bShift = 0;//img->format.bShift; + const int gShift = 8;//img->format.gShift; + const int rShift = 16;//img->format.rShift; + const int aShift = 24;//img->format.aShift; - const int bShiftTarget = 8;//target.format.bShift; - const int gShiftTarget = 16;//target.format.gShift; - const int rShiftTarget = 24;//target.format.rShift; + const int bShiftTarget = 0;//target.format.bShift; + const int gShiftTarget = 8;//target.format.gShift; + const int rShiftTarget = 16;//target.format.rShift; for (uint32 i = 0; i < height; i++) { out = outo; @@ -226,25 +226,24 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p byte *in, *out; #ifdef SCUMM_LITTLE_ENDIAN - const int aIndex = 0; - const int bIndex = 1; - const int gIndex = 2; - const int rIndex = 3; -#else const int aIndex = 3; - const int bIndex = 2; + const int bIndex = 0; const int gIndex = 1; - const int rIndex = 0; + const int rIndex = 2; +#else + const int aIndex = 0; + const int bIndex = 3; + const int gIndex = 2; + const int rIndex = 1; #endif - - const int bShift = 8;//img->format.bShift; - const int gShift = 16;//img->format.gShift; - const int rShift = 24;//img->format.rShift; - const int aShift = 0;//img->format.aShift; - - const int bShiftTarget = 8;//target.format.bShift; - const int gShiftTarget = 16;//target.format.gShift; - const int rShiftTarget = 24;//target.format.rShift; + const int bShift = 0;//img->format.bShift; + const int gShift = 8;//img->format.gShift; + const int rShift = 16;//img->format.rShift; + const int aShift = 24;//img->format.aShift; + + const int bShiftTarget = 0;//target.format.bShift; + const int gShiftTarget = 8;//target.format.gShift; + const int rShiftTarget = 16;//target.format.rShift; if (ca == 255 && cb == 255 && cg == 255 && cr == 255) { doBlit(ino, outo, img->w, img->h, target.pitch, inStep, inoStep); diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 842a6f0039..9bb567055a 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -97,7 +97,7 @@ bool WinterMuteEngine::hasFeature(EngineFeature f) const { Common::Error WinterMuteEngine::run() { // Initialize graphics using following: - Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0); + Graphics::PixelFormat format(4, 8, 8, 8, 8, 16, 8, 0, 24); initGraphics(800, 600, true, &format); if (g_system->getScreenFormat() != format) { error("Wintermute currently REQUIRES 32bpp"); -- cgit v1.2.3