summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/graphics.cpp24
-rw-r--r--src/graphics.h2
2 files changed, 24 insertions, 2 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 4914d22ce..d07d45bb3 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -46,8 +46,13 @@ Graphics::Graphics():
mFullscreen(false),
mHWAccel(false),
mBlitMode(BLIT_NORMAL),
- mRedraw(false)
+ mRedraw(false),
+ mDoubleBuffer(false)
{
+ mRect.x = 0;
+ mRect.y = 0;
+ mRect.w = 0;
+ mRect.h = 0;
}
Graphics::~Graphics()
@@ -83,6 +88,9 @@ bool Graphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel)
if (!mTarget)
return false;
+ mRect.w = mTarget->w;
+ mRect.h = mTarget->h;
+
char videoDriverName[65];
if (SDL_VideoDriverName(videoDriverName, 64))
@@ -90,6 +98,10 @@ bool Graphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel)
else
logger->log1("Using video driver: unknown");
+ mDoubleBuffer = ((mTarget->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF);
+ logger->log("Double buffer mode: %s",
+ mDoubleBuffer ? "yes" : "no");
+
const SDL_VideoInfo *vi = SDL_GetVideoInfo();
logger->log("Possible to create hardware surfaces: %s",
@@ -558,7 +570,15 @@ void Graphics::calcImagePattern(GraphicsVertexes* vert,
void Graphics::updateScreen()
{
- SDL_Flip(mTarget);
+ if (mDoubleBuffer)
+ {
+ SDL_Flip(mTarget);
+ }
+ else
+ {
+ SDL_UpdateRects(mTarget, 1, &mRect);
+// SDL_UpdateRect(mTarget, 0, 0, 0, 0);
+ }
}
SDL_Surface *Graphics::getScreenshot()
diff --git a/src/graphics.h b/src/graphics.h
index ca5de63a9..40db25c5d 100644
--- a/src/graphics.h
+++ b/src/graphics.h
@@ -275,6 +275,8 @@ class Graphics : public gcn::SDLGraphics
bool mHWAccel;
BlitMode mBlitMode;
bool mRedraw;
+ bool mDoubleBuffer;
+ SDL_Rect mRect;
};
extern Graphics *graphics;