summaryrefslogtreecommitdiff
path: root/src/graphics.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-09-12 18:29:12 +0300
committerAndrei Karas <akaras@inbox.ru>2011-09-13 04:41:55 +0300
commit6bd4fff31e0b44b8b71876250c626fe8c15b4105 (patch)
treecdd7f984a0850864316ae23c33120b6d282b70ba /src/graphics.cpp
parentf457675ecfd704c99e84fe14f0a1dd49a69a9c76 (diff)
downloadplus-6bd4fff31e0b44b8b71876250c626fe8c15b4105.tar.gz
plus-6bd4fff31e0b44b8b71876250c626fe8c15b4105.tar.bz2
plus-6bd4fff31e0b44b8b71876250c626fe8c15b4105.tar.xz
plus-6bd4fff31e0b44b8b71876250c626fe8c15b4105.zip
Add missing checks to some files and style fixes.
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r--src/graphics.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 37fd72c08..efa1058a6 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -97,13 +97,14 @@ bool Graphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel)
logger->log1("Using video driver: unknown");
mDoubleBuffer = ((mTarget->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF);
- logger->log("Double buffer mode: %s",
- mDoubleBuffer ? "yes" : "no");
+ logger->log("Double buffer mode: %s", mDoubleBuffer ? "yes" : "no");
if (mTarget->format)
logger->log("Bits per pixel: %d", mTarget->format->BytesPerPixel);
const SDL_VideoInfo *vi = SDL_GetVideoInfo();
+ if (!vi)
+ return false;
logger->log("Possible to create hardware surfaces: %s",
((vi->hw_available) ? "yes" : "no"));
@@ -259,7 +260,8 @@ void Graphics::drawImagePattern(Image *image, int x, int y, int w, int h)
const int iw = image->mBounds.w;
const int ih = image->mBounds.h;
- if (iw == 0 || ih == 0) return;
+ if (iw == 0 || ih == 0)
+ return;
for (int py = 0; py < h; py += ih) // Y position on pattern plane
{
@@ -346,8 +348,6 @@ void Graphics::drawImageRect(int x, int y, int w, int h,
Image *bottom, Image *left,
Image *center)
{
-// pushClipArea(gcn::Rectangle(x, y, w, h));
-
const bool drawMain = center && topLeft && topRight
&& bottomLeft && bottomRight;
@@ -390,8 +390,6 @@ void Graphics::drawImageRect(int x, int y, int w, int h,
x + w - bottomRight->getWidth(),
y + h - bottomRight->getHeight());
}
-
-// popClipArea();
}
void Graphics::drawImageRect(int x, int y, int w, int h,
@@ -601,6 +599,7 @@ void Graphics::calcTile(ImageVertexes *vert, int x, int y)
void Graphics::drawTile(ImageVertexes *vert)
{
+ // vert and img must be != 0
Image *img = vert->image;
DoubleRects *rects = &vert->sdl;
DoubleRects::const_iterator it = rects->begin();