summaryrefslogtreecommitdiff
path: root/src/resources/image.cpp
diff options
context:
space:
mode:
authorBertram <bertram@cegetel.net>2009-08-14 20:11:04 +0200
committerBertram <bertram@cegetel.net>2009-08-14 20:11:04 +0200
commitafc879b5ca185cfd93e604942aac45e76dc3c322 (patch)
tree99f1820afd5302c51484c07a6ae43c6983dda23d /src/resources/image.cpp
parent75ba2b04b8af02ba2e005f701f1433e739ef7c5a (diff)
downloadMana-afc879b5ca185cfd93e604942aac45e76dc3c322.tar.gz
Mana-afc879b5ca185cfd93e604942aac45e76dc3c322.tar.bz2
Mana-afc879b5ca185cfd93e604942aac45e76dc3c322.tar.xz
Mana-afc879b5ca185cfd93e604942aac45e76dc3c322.zip
Fixed the compilation without OpenGL Support, and remove a too young function.
Diffstat (limited to 'src/resources/image.cpp')
-rw-r--r--src/resources/image.cpp41
1 files changed, 5 insertions, 36 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index b08478b5..a9005509 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -36,12 +36,12 @@ int Image::mTextureSize = 0;
Image::Image(SDL_Surface *image):
mAlpha(1.0f),
- mAlphaChannel(0),
- mSDLSurface(image),
+ mSDLSurface(image)
+{
#ifdef USE_OPENGL
- mGLImage(0)
+ mGLImage = 0;
#endif
-{
+
mBounds.x = 0;
mBounds.y = 0;
@@ -64,7 +64,6 @@ Image::Image(SDL_Surface *image):
Image::Image(GLuint glimage, int width, int height, int texWidth, int texHeight):
mAlpha(1.0),
mHasAlphaChannel(true),
- mAlphaChannel(0),
mSDLSurface(0),
mGLImage(glimage),
mTexWidth(texWidth),
@@ -193,7 +192,7 @@ bool Image::isAnOpenGLOne() const
bool Image::hasAlphaChannel()
{
if (mLoaded)
- return mAlphaChannel;
+ return mHasAlphaChannel;
#ifdef USE_OPENGL
if (mUseOpenGL)
@@ -390,36 +389,6 @@ Image *Image::_SDLload(SDL_Surface *tmpImage)
return new Image(image);
}
-Uint8 *Image::_SDLgetAlphaChannel()
-{
- if (!mSDLSurface)
- return NULL;
-
- // If an old channel was stored, we free it.
- free(mAlphaChannel);
- mAlphaChannel = NULL;
-
- // We allocate the place to put our data
- Uint8* mAlphaChannel = (Uint8*)malloc(mSDLSurface->w * mSDLSurface->h * sizeof(Uint8));
-
- if (mSDLSurface->format->BitsPerPixel == 32)
- {
- // Figure out whether the image uses its alpha layer
- for (int i = 0; i < mSDLSurface->w * mSDLSurface->h; ++i)
- {
- Uint8 r, g, b, a;
- SDL_GetRGBA(
- ((Uint32*) mSDLSurface->pixels)[i],
- mSDLSurface->format,
- &r, &g, &b, &a);
-
- mAlphaChannel[i] = a;
- }
- }
-
- return mAlphaChannel;
-}
-
#ifdef USE_OPENGL
Image *Image::_GLload(SDL_Surface *tmpImage)
{