From 7d151c8fc05cd7feaf1e1cee33fd8289208fa18d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 7 Jul 2011 02:12:24 +0300 Subject: Add map reduce feature for software drawing. Now invisible tiles will be removed if this mode enabled. --- src/resources/image.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/resources/image.cpp') diff --git a/src/resources/image.cpp b/src/resources/image.cpp index 2d3676304..fdcf210c3 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -53,7 +53,8 @@ Image::Image(SDL_Surface *image, bool hasAlphaChannel, Uint8 *alphaChannel): mAlpha(1.0f), mHasAlphaChannel(hasAlphaChannel), mSDLSurface(image), - mAlphaChannel(alphaChannel) + mAlphaChannel(alphaChannel), + mIsAlphaVisible(hasAlphaChannel) { #ifdef USE_OPENGL mGLImage = 0; @@ -88,6 +89,7 @@ Image::Image(GLuint glimage, int width, int height, mSDLSurface(0), mAlphaChannel(0), mUseAlphaCache(false), + mIsAlphaVisible(true), mGLImage(glimage), mTexWidth(texWidth), mTexHeight(texHeight) @@ -792,11 +794,13 @@ SubImage::SubImage(Image *parent, SDL_Surface *image, mParent->incRef(); mParent->SDLTerminateAlphaCache(); mHasAlphaChannel = mParent->hasAlphaChannel(); + mIsAlphaVisible = mHasAlphaChannel; mAlphaChannel = mParent->SDLgetAlphaChannel(); } else { mHasAlphaChannel = false; + mIsAlphaVisible = false; mAlphaChannel = 0; } @@ -805,6 +809,10 @@ SubImage::SubImage(Image *parent, SDL_Surface *image, mBounds.y = static_cast(y); mBounds.w = static_cast(width); mBounds.h = static_cast(height); + mInternalBounds.x = mParent->mBounds.x; + mInternalBounds.y = mParent->mBounds.y; + mInternalBounds.w = mParent->mBounds.w; + mInternalBounds.h = mParent->mBounds.h; mUseAlphaCache = false; } @@ -823,6 +831,11 @@ SubImage::SubImage(Image *parent, GLuint image, mBounds.y = static_cast(y); mBounds.w = static_cast(width); mBounds.h = static_cast(height); + mInternalBounds.x = mParent->mBounds.x; + mInternalBounds.y = mParent->mBounds.y; + mInternalBounds.w = mParent->mBounds.w; + mInternalBounds.h = mParent->mBounds.h; + mIsAlphaVisible = mHasAlphaChannel; } #endif -- cgit v1.2.3-70-g09d2