aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-06-28 02:35:38 +0200
committerEinar Johan Trøan Sømåen2012-06-28 02:35:38 +0200
commit900bd7a77d7e29be7968ac014325489d4eca6d45 (patch)
treefd3fe14ec9f540bd7203d927ac422c5ca6f8b5f1 /engines/wintermute
parent7d45960039326eed4e02f2fae502c79a5538ea0e (diff)
downloadscummvm-rg350-900bd7a77d7e29be7968ac014325489d4eca6d45.tar.gz
scummvm-rg350-900bd7a77d7e29be7968ac014325489d4eca6d45.tar.bz2
scummvm-rg350-900bd7a77d7e29be7968ac014325489d4eca6d45.zip
WINTERMUTE: Avoid making a new Rect for the fill every screen.
Diffstat (limited to 'engines/wintermute')
-rw-r--r--engines/wintermute/Base/BRenderSDL.cpp12
-rw-r--r--engines/wintermute/Base/BRenderSDL.h1
2 files changed, 5 insertions, 8 deletions
diff --git a/engines/wintermute/Base/BRenderSDL.cpp b/engines/wintermute/Base/BRenderSDL.cpp
index 6ddf200b9e..2920a4d00c 100644
--- a/engines/wintermute/Base/BRenderSDL.cpp
+++ b/engines/wintermute/Base/BRenderSDL.cpp
@@ -73,9 +73,10 @@ HRESULT CBRenderSDL::initRenderer(int width, int height, bool windowed) {
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 1);
#endif
-
_width = width;
_height = height;
+ _renderRect.setWidth(_width);
+ _renderRect.setHeight(_height);
_realWidth = width;
_realHeight = height;
@@ -247,14 +248,9 @@ HRESULT CBRenderSDL::fill(byte r, byte g, byte b, Common::Rect *rect) {
//SDL_RenderClear(_renderer);
uint32 color = _renderSurface->format.ARGBToColor(0xFF, r, g, b);
if (!rect) {
- rect = new Common::Rect();
- rect->setWidth(_renderSurface->w);
- rect->setHeight(_renderSurface->h);
- _renderSurface->fillRect(*rect, color);
- delete rect;
- } else {
- _renderSurface->fillRect(*rect, color);
+ rect = &_renderRect;
}
+ _renderSurface->fillRect(*rect, color);
return S_OK;
}
diff --git a/engines/wintermute/Base/BRenderSDL.h b/engines/wintermute/Base/BRenderSDL.h
index e9ca53610a..ad32e9e1da 100644
--- a/engines/wintermute/Base/BRenderSDL.h
+++ b/engines/wintermute/Base/BRenderSDL.h
@@ -81,6 +81,7 @@ public:
private:
/* SDL_Renderer *_renderer;
SDL_Window *_win;*/
+ Common::Rect _renderRect;
Graphics::Surface *_renderSurface;
AnsiString _name;