diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-03-02 21:19:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-03-02 21:19:28 +0300 |
commit | a3b2076ba0b398523c3e0428c2400184e83c4f62 (patch) | |
tree | ae13ed62556e9b7343b9330089fa3dad2a8b67d2 /src/graphics.cpp | |
parent | 6f23241ba9d7d908534dade0e03041486a970ddc (diff) | |
download | plus-a3b2076ba0b398523c3e0428c2400184e83c4f62.tar.gz plus-a3b2076ba0b398523c3e0428c2400184e83c4f62.tar.bz2 plus-a3b2076ba0b398523c3e0428c2400184e83c4f62.tar.xz plus-a3b2076ba0b398523c3e0428c2400184e83c4f62.zip |
Last fixes after Coverity checks.
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r-- | src/graphics.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp index 0e3f19544..e220775a7 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -659,10 +659,15 @@ bool Graphics::calcImageRect(ImageVertexes *const vert, } calcTile(vert, topLeft, x, y); - calcTile(vert, topRight, x + w - topRight->getWidth(), y); - calcTile(vert, bottomLeft, x, y + h - bottomLeft->getHeight()); - calcTile(vert, bottomRight, x + w - bottomRight->getWidth(), - y + h - bottomRight->getHeight()); + if (topRight) + calcTile(vert, topRight, x + w - topRight->getWidth(), y); + if (bottomLeft) + calcTile(vert, bottomLeft, x, y + h - bottomLeft->getHeight()); + if (bottomRight) + { + calcTile(vert, bottomRight, x + w - bottomRight->getWidth(), + y + h - bottomRight->getHeight()); + } // popClipArea(); BLOCK_END("Graphics::calcImageRect") @@ -711,6 +716,10 @@ void Graphics::calcImagePattern(ImageVertexes* const vert, { vert->sdl.push_back(r); } + else + { + delete r; + } } } } @@ -989,11 +998,14 @@ int Graphics::SDL_FakeUpperBlit(const SDL_Surface *const src, if (w > 0 && h > 0) { - srcrect->x = static_cast<int16_t>(srcx); - srcrect->y = static_cast<int16_t>(srcy); - srcrect->w = static_cast<int16_t>(w); + if (srcrect) + { + srcrect->x = static_cast<int16_t>(srcx); + srcrect->y = static_cast<int16_t>(srcy); + srcrect->w = static_cast<int16_t>(w); + srcrect->h = static_cast<int16_t>(h); + } dstrect->w = static_cast<int16_t>(w); - srcrect->h = static_cast<int16_t>(h); dstrect->h = static_cast<int16_t>(h); return 1; |