diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-07-11 02:02:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-07-11 02:02:10 +0300 |
commit | 7f6bcbba639bfbfcacd08113148a98be1693e00c (patch) | |
tree | 19af07469e8dff8d3c7178fadc4fab0dfc0dc5c8 /src | |
parent | b3ba55c192e08e094063ea9d2a70f2aece9c85d7 (diff) | |
download | plus-7f6bcbba639bfbfcacd08113148a98be1693e00c.tar.gz plus-7f6bcbba639bfbfcacd08113148a98be1693e00c.tar.bz2 plus-7f6bcbba639bfbfcacd08113148a98be1693e00c.tar.xz plus-7f6bcbba639bfbfcacd08113148a98be1693e00c.zip |
Bit improve draw speed with double buffer disabled in software mode.
Diffstat (limited to 'src')
-rw-r--r-- | src/graphics.cpp | 24 | ||||
-rw-r--r-- | src/graphics.h | 2 |
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; |