WINTERMUTE: Check for failure when decoding images.

This commit is contained in:
Einar Johan Trøan Sømåen
2012-07-22 22:31:02 +02:00
parent 803c421553
commit 30ada3c13f
2 changed files with 7 additions and 3 deletions
@@ -116,9 +116,11 @@ bool BaseSurfaceOSystem::create(const char *filename, bool defaultCK, byte ckRed
return STATUS_OK;
}
void BaseSurfaceOSystem::finishLoad() {
bool BaseSurfaceOSystem::finishLoad() {
BaseImage *image = new BaseImage(_gameRef);
image->loadFile(_filename);
if (!image->loadFile(_filename)) {
return false;
}
_width = image->getSurface()->w;
_height = image->getSurface()->h;
@@ -188,6 +190,8 @@ void BaseSurfaceOSystem::finishLoad() {
delete image;
_loaded = true;
return true;
}
//////////////////////////////////////////////////////////////////////////
@@ -85,7 +85,7 @@ public:
private:
Graphics::Surface *_surface;
bool _loaded;
void finishLoad();
bool finishLoad();
bool drawSprite(int x, int y, Rect32 *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX = 0, int offsetY = 0);
void genAlphaMask(Graphics::Surface *surface);
uint32 getPixel(Graphics::Surface *surface, int x, int y);