diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-06-06 22:53:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-06-06 22:53:16 +0300 |
commit | 5f434dba57bd80ab370dba5a9a425e86acbe800f (patch) | |
tree | 154a41f52d9af7dd2ddde999aa606e65686b1e0f /src | |
parent | 7b155f111daf5d7ae477b16d0f0789b1113bea74 (diff) | |
download | manaverse-5f434dba57bd80ab370dba5a9a425e86acbe800f.tar.gz manaverse-5f434dba57bd80ab370dba5a9a425e86acbe800f.tar.bz2 manaverse-5f434dba57bd80ab370dba5a9a425e86acbe800f.tar.xz manaverse-5f434dba57bd80ab370dba5a9a425e86acbe800f.zip |
Dump surface format at start.
Diffstat (limited to 'src')
-rw-r--r-- | src/graphics.cpp | 6 | ||||
-rw-r--r-- | src/resources/image.cpp | 23 | ||||
-rw-r--r-- | src/resources/image.h | 2 |
3 files changed, 24 insertions, 7 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp index d94963f06..1d557d897 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -282,11 +282,7 @@ bool Graphics::videoInfo() mDoubleBuffer = ((mTarget->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF); logger->log("Double buffer mode: %s", mDoubleBuffer ? "yes" : "no"); - if (mTarget->format) - { - logger->log("Bits per pixel: %d", mTarget->format->BytesPerPixel); -// bpp = mTarget->format->BytesPerPixel; - } + Image::dumpSurfaceFormat(mTarget); const SDL_VideoInfo *vi = SDL_GetVideoInfo(); if (!vi) diff --git a/src/resources/image.cpp b/src/resources/image.cpp index 4e7a9ceef..596a477c6 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -764,8 +764,11 @@ Image *Image::_GLload(SDL_Surface *tmpImage) #endif SDL_Surface *oldImage = nullptr; - if (tmpImage->format->BitsPerPixel != 32 || realWidth != width - || realHeight != height || rmask != tmpImage->format->Rmask) + if (tmpImage->format->BitsPerPixel != 32 + || realWidth != width || realHeight != height + || rmask != tmpImage->format->Rmask + || gmask != tmpImage->format->Gmask + || amask != tmpImage->format->Amask) { oldImage = tmpImage; tmpImage = SDL_CreateRGBSurface(SDL_SWSURFACE, realWidth, realHeight, @@ -901,6 +904,22 @@ void Image::SDLTerminateAlphaCache() mUseAlphaCache = false; } +void Image::dumpSurfaceFormat(SDL_Surface *image) +{ + if (image->format) + { + const SDL_PixelFormat *format = image->format; + logger->log("Bytes per pixel: %d", format->BytesPerPixel); + logger->log("Alpha: %d", format->alpha); + logger->log("Loss: %02x, %02x, %02x, %02x", (int)format->Rloss, + (int)format->Gloss, (int)format->Bloss, (int)format->Aloss); + logger->log("Shift: %02x, %02x, %02x, %02x", (int)format->Rshift, + (int)format->Gshift, (int)format->Bshift, (int)format->Ashift); + logger->log("Mask: %08x, %08x, %08x, %08x", format->Rmask, + format->Gmask, format->Bmask, format->Amask); + } +} + //============================================================================ // SubImage Class //============================================================================ diff --git a/src/resources/image.h b/src/resources/image.h index d4cfaa9ef..96bf0f95c 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -228,6 +228,8 @@ class Image : public Resource static int mInternalTextureType; + static void dumpSurfaceFormat(SDL_Surface *image); + #endif bool isHasAlphaChannel() const |