summaryrefslogtreecommitdiff
path: root/src/resources/image.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-19 15:49:45 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-19 15:49:45 +0300
commitb30a5d2289a0b68410dee5343e148aba88ea4839 (patch)
tree9d756785b9166ced76675ad3ebe398c09b494a3c /src/resources/image.cpp
parent9a3a196dbf633a699c26d0227802a42f025c8bfd (diff)
parent164e4ed5a153ce06badb52f3a5a4dff16c58d7e6 (diff)
downloadplus-b30a5d2289a0b68410dee5343e148aba88ea4839.tar.gz
plus-b30a5d2289a0b68410dee5343e148aba88ea4839.tar.bz2
plus-b30a5d2289a0b68410dee5343e148aba88ea4839.tar.xz
plus-b30a5d2289a0b68410dee5343e148aba88ea4839.zip
Merge branch 'master' into stripped
Diffstat (limited to 'src/resources/image.cpp')
-rw-r--r--src/resources/image.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 6f9042029..1e2bd6b51 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -250,14 +250,14 @@ Image *Image::createTextSurface(SDL_Surface *tmpImage, float alpha)
// We also delete the alpha channel since
// it's not used.
- delete[] alphaChannel;
+ delete [] alphaChannel;
alphaChannel = nullptr;
}
if (!image)
{
logger->log1("Error: Image convert failed.");
- delete[] alphaChannel;
+ delete [] alphaChannel;
return nullptr;
}
@@ -295,7 +295,7 @@ void Image::unload()
SDL_FreeSurface(mSDLSurface);
mSDLSurface = nullptr;
- delete[] mAlphaChannel;
+ delete [] mAlphaChannel;
mAlphaChannel = nullptr;
}
@@ -689,14 +689,14 @@ Image *Image::_SDLload(SDL_Surface *tmpImage)
// We also delete the alpha channel since
// it's not used.
- delete[] alphaChannel;
+ delete [] alphaChannel;
alphaChannel = nullptr;
}
if (!image)
{
logger->log1("Error: Image convert failed.");
- delete[] alphaChannel;
+ delete [] alphaChannel;
return nullptr;
}
@@ -885,10 +885,20 @@ SubImage::SubImage(Image *parent, SDL_Surface *image,
mBounds.y = static_cast<short>(y);
mBounds.w = static_cast<Uint16>(width);
mBounds.h = static_cast<Uint16>(height);
- mInternalBounds.x = mParent->mBounds.x;
- mInternalBounds.y = mParent->mBounds.y;
- mInternalBounds.w = mParent->mBounds.w;
- mInternalBounds.h = mParent->mBounds.h;
+ if (mParent)
+ {
+ mInternalBounds.x = mParent->mBounds.x;
+ mInternalBounds.y = mParent->mBounds.y;
+ mInternalBounds.w = mParent->mBounds.w;
+ mInternalBounds.h = mParent->mBounds.h;
+ }
+ else
+ {
+ mInternalBounds.x = 0;
+ mInternalBounds.y = 0;
+ mInternalBounds.w = 1;
+ mInternalBounds.h = 1;
+ }
mUseAlphaCache = false;
}