diff options
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r-- | src/graphics.cpp | 24 |
1 files changed, 22 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() |