diff engine/core/video/sdl/renderbackendsdl.cpp @ 634:5f381fa34769

* Added the clearBackBuffer() function to the renderbackends. * Renamed setClearScreen() to setClearBackBuffer() * The SDL render backend now honors what was set with setClearBackBuffer() * Documented testRenderedViewPort() * The OpenGL backend no longer clears the screen every frame by default. testRenderedViewPort() takes care of clearing the screen for now. Note: if the user overrides the default and enables clearing of the backbuffer that it may be cleared twice in one frame (OpenGL only)!
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Wed, 06 Oct 2010 15:49:53 +0000
parents 46b95d06c8c2
children 855ad500f991
line wrap: on
line diff
--- a/engine/core/video/sdl/renderbackendsdl.cpp	Wed Oct 06 14:09:24 2010 +0000
+++ b/engine/core/video/sdl/renderbackendsdl.cpp	Wed Oct 06 15:49:53 2010 +0000
@@ -60,6 +60,16 @@
 		SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); // temporary hack
 	}
 
+	void RenderBackendSDL::clearBackBuffer() {
+		SDL_Rect rect;
+		rect.x = 0;
+		rect.y = 0;
+		rect.w = getWidth();
+		rect.h = getHeight();
+		SDL_SetClipRect(m_screen->getSurface(), &rect);
+		SDL_FillRect(m_screen->getSurface(), 0, 0x00);
+	}
+
 	Image* RenderBackendSDL::createMainScreen(unsigned int width, unsigned int height, unsigned char bitsPerPixel, bool fs, const std::string& title, const std::string& icon) {
 		Uint32 flags = 0;
 		if (fs) {
@@ -120,13 +130,9 @@
 	}
 
 	void RenderBackendSDL::startFrame() {
-		SDL_Rect rect;
-		rect.x = 0;
-		rect.y = 0;
-		rect.w = getWidth();
-		rect.h = getHeight();
-		SDL_SetClipRect(m_screen->getSurface(), &rect);
-		SDL_FillRect(m_screen->getSurface(), 0, 0x00);
+		if (m_clear) {
+			clearBackBuffer();
+		}
 	}
 
 	void RenderBackendSDL::endFrame() {