WINTERMUTE: Change PixelFormat to ARGB (same as Sword25)

Mainly a workaround for the OpenGL-backend.
This commit is contained in:
Einar Johan Trøan Sømåen 2012-08-07 14:56:06 +02:00
parent 52aeaf4ece
commit 3abccb2e33
4 changed files with 32 additions and 33 deletions

View File

@ -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; // 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(); Graphics::Surface *surface = new Graphics::Surface();
if (_deletableFont) { // We actually have a TTF 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 } 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)); 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(); 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); retSurface->putSurface(*convertedSurface, true);
convertedSurface->free(); convertedSurface->free();
surface->free(); surface->free();

View File

@ -153,7 +153,7 @@ bool BaseRenderOSystem::initRenderer(int width, int height, bool windowed) {
_windowed = !ConfMan.getBool("fullscreen"); _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->beginGFXTransaction();
g_system->initSize(_width, _height, &format); g_system->initSize(_width, _height, &format);
OSystem::TransactionError gfxError = g_system->endGFXTransaction(); OSystem::TransactionError gfxError = g_system->endGFXTransaction();

View File

@ -47,25 +47,25 @@ void doBlit(byte *ino, byte* outo, uint32 width, uint32 height, uint32 pitch, in
byte *in, *out; byte *in, *out;
#ifdef SCUMM_LITTLE_ENDIAN #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 aIndex = 3;
const int bIndex = 2; const int bIndex = 0;
const int gIndex = 1; 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 #endif
const int bShift = 8;//img->format.bShift; const int bShift = 0;//img->format.bShift;
const int gShift = 16;//img->format.gShift; const int gShift = 8;//img->format.gShift;
const int rShift = 24;//img->format.rShift; const int rShift = 16;//img->format.rShift;
const int aShift = 0;//img->format.aShift; const int aShift = 24;//img->format.aShift;
const int bShiftTarget = 8;//target.format.bShift; const int bShiftTarget = 0;//target.format.bShift;
const int gShiftTarget = 16;//target.format.gShift; const int gShiftTarget = 8;//target.format.gShift;
const int rShiftTarget = 24;//target.format.rShift; const int rShiftTarget = 16;//target.format.rShift;
for (uint32 i = 0; i < height; i++) { for (uint32 i = 0; i < height; i++) {
out = outo; out = outo;
@ -226,25 +226,24 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p
byte *in, *out; byte *in, *out;
#ifdef SCUMM_LITTLE_ENDIAN #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 aIndex = 3;
const int bIndex = 2; const int bIndex = 0;
const int gIndex = 1; 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 #endif
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 bShift = 8;//img->format.bShift; const int bShiftTarget = 0;//target.format.bShift;
const int gShift = 16;//img->format.gShift; const int gShiftTarget = 8;//target.format.gShift;
const int rShift = 24;//img->format.rShift; const int rShiftTarget = 16;//target.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;
if (ca == 255 && cb == 255 && cg == 255 && cr == 255) { if (ca == 255 && cb == 255 && cg == 255 && cr == 255) {
doBlit(ino, outo, img->w, img->h, target.pitch, inStep, inoStep); doBlit(ino, outo, img->w, img->h, target.pitch, inStep, inoStep);

View File

@ -97,7 +97,7 @@ bool WinterMuteEngine::hasFeature(EngineFeature f) const {
Common::Error WinterMuteEngine::run() { Common::Error WinterMuteEngine::run() {
// Initialize graphics using following: // 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); initGraphics(800, 600, true, &format);
if (g_system->getScreenFormat() != format) { if (g_system->getScreenFormat() != format) {
error("Wintermute currently REQUIRES 32bpp"); error("Wintermute currently REQUIRES 32bpp");