summaryrefslogtreecommitdiff
path: root/src/graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r--src/graphics.cpp28
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;