summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTametomo <irarice@gmail.com>2009-07-24 09:33:14 -0600
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-02-14 22:09:04 +0100
commit0796cdac80def934f3a8504538a41ea118ebc75f (patch)
treee53ee35e16508309a59c55a4f5d740f81d976e6b /src
parent4126672a610952629938a5b1affb220d3336f5ed (diff)
downloadmana-0796cdac80def934f3a8504538a41ea118ebc75f.tar.gz
mana-0796cdac80def934f3a8504538a41ea118ebc75f.tar.bz2
mana-0796cdac80def934f3a8504538a41ea118ebc75f.tar.xz
mana-0796cdac80def934f3a8504538a41ea118ebc75f.zip
Removed a redundant SDL_Surface pointer
Signed-off-by: Tametomo <irarice@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/graphics.cpp31
-rw-r--r--src/graphics.h1
-rw-r--r--src/openglgraphics.cpp14
3 files changed, 22 insertions, 24 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 252facbd..7f05dbc8 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -28,7 +28,6 @@
#include "resources/imageloader.h"
Graphics::Graphics():
- mScreen(0),
mWidth(0),
mHeight(0),
mBpp(0),
@@ -65,9 +64,9 @@ bool Graphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel)
else
displayFlags |= SDL_SWSURFACE;
- mScreen = SDL_SetVideoMode(w, h, bpp, displayFlags);
+ mTarget = SDL_SetVideoMode(w, h, bpp, displayFlags);
- if (!mScreen)
+ if (!mTarget)
return false;
char videoDriverName[64];
@@ -99,7 +98,7 @@ bool Graphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel)
((vi->blit_fill) ? "yes" : "no"));
logger->log("Available video memory: %d", vi->video_mem);
- setTarget(mScreen);
+ setTarget(mTarget);
return true;
}
@@ -137,7 +136,7 @@ bool Graphics::drawRescaledImage(Image *image, int srcX, int srcY,
bool useColor)
{
// Check that preconditions for blitting are met.
- if (!mScreen || !image) return false;
+ if (!mTarget || !image) return false;
if (!image->mSDLSurface) return false;
Image *tmpImage = image->SDLgetScaledImage(desiredWidth, desiredHeight);
@@ -159,7 +158,7 @@ bool Graphics::drawRescaledImage(Image *image, int srcX, int srcY,
srcRect.w = width;
srcRect.h = height;
- returnValue = !(SDL_BlitSurface(tmpImage->mSDLSurface, &srcRect, mScreen, &dstRect) < 0);
+ returnValue = !(SDL_BlitSurface(tmpImage->mSDLSurface, &srcRect, mTarget, &dstRect) < 0);
delete tmpImage;
@@ -170,7 +169,7 @@ bool Graphics::drawImage(Image *image, int srcX, int srcY, int dstX, int dstY,
int width, int height, bool)
{
// Check that preconditions for blitting are met.
- if (!mScreen || !image || !image->mSDLSurface)
+ if (!mTarget || !image || !image->mSDLSurface)
return false;
dstX += mClipStack.top().xOffset;
@@ -186,7 +185,7 @@ bool Graphics::drawImage(Image *image, int srcX, int srcY, int dstX, int dstY,
srcRect.w = width;
srcRect.h = height;
- return !(SDL_BlitSurface(image->mSDLSurface, &srcRect, mScreen, &dstRect) < 0);
+ return !(SDL_BlitSurface(image->mSDLSurface, &srcRect, mTarget, &dstRect) < 0);
}
void Graphics::drawImage(gcn::Image const *image, int srcX, int srcY,
@@ -201,7 +200,7 @@ void Graphics::drawImage(gcn::Image const *image, int srcX, int srcY,
void Graphics::drawImagePattern(Image *image, int x, int y, int w, int h)
{
// Check that preconditions for blitting are met.
- if (!mScreen || !image) return;
+ if (!mTarget || !image) return;
if (!image->mSDLSurface) return;
const int iw = image->getWidth();
@@ -227,7 +226,7 @@ void Graphics::drawImagePattern(Image *image, int x, int y, int w, int h)
srcRect.x = srcX; srcRect.y = srcY;
srcRect.w = dw; srcRect.h = dh;
- SDL_BlitSurface(image->mSDLSurface, &srcRect, mScreen, &dstRect);
+ SDL_BlitSurface(image->mSDLSurface, &srcRect, mTarget, &dstRect);
}
}
}
@@ -236,7 +235,7 @@ void Graphics::drawRescaledImagePattern(Image *image, int x, int y,
int w, int h, int scaledWidth, int scaledHeight)
{
// Check that preconditions for blitting are met.
- if (!mScreen || !image) return;
+ if (!mTarget || !image) return;
if (!image->mSDLSurface) return;
if (scaledHeight == 0 || scaledWidth == 0) return;
@@ -267,7 +266,7 @@ void Graphics::drawRescaledImagePattern(Image *image, int x, int y,
srcRect.x = srcX; srcRect.y = srcY;
srcRect.w = dw; srcRect.h = dh;
- SDL_BlitSurface(tmpImage->mSDLSurface, &srcRect, mScreen, &dstRect);
+ SDL_BlitSurface(tmpImage->mSDLSurface, &srcRect, mTarget, &dstRect);
}
}
@@ -328,7 +327,7 @@ void Graphics::drawImageRect(int x, int y, int w, int h,
void Graphics::updateScreen()
{
- SDL_Flip(mScreen);
+ SDL_Flip(mTarget);
}
SDL_Surface *Graphics::getScreenshot()
@@ -344,10 +343,10 @@ SDL_Surface *Graphics::getScreenshot()
#endif
int amask = 0x00000000;
- SDL_Surface *screenshot = SDL_CreateRGBSurface(SDL_SWSURFACE, mScreen->w,
- mScreen->h, 24, rmask, gmask, bmask, amask);
+ SDL_Surface *screenshot = SDL_CreateRGBSurface(SDL_SWSURFACE, mTarget->w,
+ mTarget->h, 24, rmask, gmask, bmask, amask);
- SDL_BlitSurface(mScreen, NULL, screenshot, NULL);
+ SDL_BlitSurface(mTarget, NULL, screenshot, NULL);
return screenshot;
}
diff --git a/src/graphics.h b/src/graphics.h
index 2b38608f..48f24ca8 100644
--- a/src/graphics.h
+++ b/src/graphics.h
@@ -206,7 +206,6 @@ class Graphics : public gcn::SDLGraphics
gcn::Font *getFont() const { return mFont; }
protected:
- SDL_Surface *mScreen;
int mWidth;
int mHeight;
int mBpp;
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index 59cc62d0..5b9c118d 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -70,7 +70,7 @@ bool OpenGLGraphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel)
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- if (!(mScreen = SDL_SetVideoMode(w, h, bpp, displayFlags)))
+ if (!(mTarget = SDL_SetVideoMode(w, h, bpp, displayFlags)))
return false;
#ifdef __APPLE__
@@ -375,7 +375,7 @@ void OpenGLGraphics::_beginDraw()
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glOrtho(0.0, (double)mScreen->w, (double)mScreen->h, 0.0, -1.0, 1.0);
+ glOrtho(0.0, (double)mTarget->w, (double)mTarget->h, 0.0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
@@ -384,7 +384,7 @@ void OpenGLGraphics::_beginDraw()
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- pushClipArea(gcn::Rectangle(0, 0, mScreen->w, mScreen->h));
+ pushClipArea(gcn::Rectangle(0, 0, mTarget->w, mTarget->h));
}
void OpenGLGraphics::_endDraw()
@@ -393,8 +393,8 @@ void OpenGLGraphics::_endDraw()
SDL_Surface* OpenGLGraphics::getScreenshot()
{
- int h = mScreen->h;
- int w = mScreen->w;
+ int h = mTarget->h;
+ int w = mTarget->w;
SDL_Surface *screenshot = SDL_CreateRGBSurface(
SDL_SWSURFACE,
@@ -449,7 +449,7 @@ bool OpenGLGraphics::pushClipArea(gcn::Rectangle area)
glPushMatrix();
glTranslatef(transX, transY, 0);
glScissor(mClipStack.top().x,
- mScreen->h - mClipStack.top().y - mClipStack.top().height,
+ mTarget->h - mClipStack.top().y - mClipStack.top().height,
mClipStack.top().width,
mClipStack.top().height);
@@ -465,7 +465,7 @@ void OpenGLGraphics::popClipArea()
glPopMatrix();
glScissor(mClipStack.top().x,
- mScreen->h - mClipStack.top().y - mClipStack.top().height,
+ mTarget->h - mClipStack.top().y - mClipStack.top().height,
mClipStack.top().width,
mClipStack.top().height);
}