changeset 633:46b95d06c8c2

* Renamed RenderBackend::isClearNeeded() to RenderBackend::setClearScreen(). It is no longer pure virtual. Also documented it's functionality.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Wed, 06 Oct 2010 14:09:24 +0000
parents a7909cdcdc85
children 5f381fa34769
files engine/core/video/opengl/renderbackendopengl.cpp engine/core/video/opengl/renderbackendopengl.h engine/core/video/renderbackend.h engine/core/video/sdl/renderbackendsdl.cpp engine/core/video/sdl/renderbackendsdl.h engine/core/video/video.i engine/core/view/camera.cpp
diffstat 7 files changed, 9 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/engine/core/video/opengl/renderbackendopengl.cpp	Tue Oct 05 19:42:54 2010 +0000
+++ b/engine/core/video/opengl/renderbackendopengl.cpp	Wed Oct 06 14:09:24 2010 +0000
@@ -178,10 +178,6 @@
 		return new GLImage(data, width, height);
 	}
 
-	void RenderBackendOpenGL::isClearNeeded(bool clear) {
-		m_clear = clear;
-	}
-
 	bool RenderBackendOpenGL::putPixel(int x, int y, int r, int g, int b, int a) {
 		if ((x < 0) || (x >= (int)getWidth()) || (y < 0) || (y >= (int)getHeight())) {
 			return false;
--- a/engine/core/video/opengl/renderbackendopengl.h	Tue Oct 05 19:42:54 2010 +0000
+++ b/engine/core/video/opengl/renderbackendopengl.h	Wed Oct 06 14:09:24 2010 +0000
@@ -56,11 +56,8 @@
 		void drawQuad(const Point& p1, const Point& p2, const Point& p3, const Point& p4,  int r, int g, int b, int a = 255);
 		void drawVertex(const Point& p, const uint8_t size, int r, int g, int b, int a = 255);
 
-		void isClearNeeded(bool clear);
-
 	private:
 		SDL_PixelFormat m_rgba_format;
-		bool m_clear;
 	};
 
 }
--- a/engine/core/video/renderbackend.h	Tue Oct 05 19:42:54 2010 +0000
+++ b/engine/core/video/renderbackend.h	Wed Oct 06 14:09:24 2010 +0000
@@ -103,7 +103,10 @@
 		 */
 		virtual Image* createImage(SDL_Surface* surface) = 0;
 
-		virtual void isClearNeeded(bool clear) = 0;
+		/** Sets if the screen (backbuffer) should be cleared before rendering the next frame
+		 * @param clear true = clear screen before next frame, false = do not clear screen
+		 */
+		void setClearScreen(bool clear) { m_clear = clear; };
 
 		/** Returns a pointer to the main screen Image
 		 * @return A pointer to the main screen Image, or 0 if no mainscreen exists.
@@ -146,6 +149,7 @@
 
 	protected:
 		Image* m_screen;
+		bool m_clear;
 		bool m_isalphaoptimized;
 		unsigned int m_chunkingsize;
 		bool m_iscolorkeyenabled;
--- a/engine/core/video/sdl/renderbackendsdl.cpp	Tue Oct 05 19:42:54 2010 +0000
+++ b/engine/core/video/sdl/renderbackendsdl.cpp	Wed Oct 06 14:09:24 2010 +0000
@@ -141,10 +141,6 @@
 		return new SDLImage(data, width, height);
 	}
 
-	void RenderBackendSDL::isClearNeeded(bool clear) {
-		m_clear = clear;
-	}
-
 	bool RenderBackendSDL::putPixel(int x, int y, int r, int g, int b, int a) {
 		return static_cast<SDLImage*>(m_screen)->putPixel(x, y, r, g, b, a);
 	}
--- a/engine/core/video/sdl/renderbackendsdl.h	Tue Oct 05 19:42:54 2010 +0000
+++ b/engine/core/video/sdl/renderbackendsdl.h	Wed Oct 06 14:09:24 2010 +0000
@@ -57,11 +57,6 @@
 		void fillRectangle(const Point& p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
 		void drawQuad(const Point& p1, const Point& p2, const Point& p3, const Point& p4,  int r, int g, int b, int a = 255);
 		void drawVertex(const Point& p, const uint8_t size, int r, int g, int b, int a = 255);
-
-		void isClearNeeded(bool clear);
-
-	private:
-		bool m_clear;
 	};
 
 }
--- a/engine/core/video/video.i	Tue Oct 05 19:42:54 2010 +0000
+++ b/engine/core/video/video.i	Wed Oct 06 14:09:24 2010 +0000
@@ -172,7 +172,7 @@
 		bool isColorKeyEnabled() const;
 		void setColorKey(const SDL_Color& colorkey);
 		const SDL_Color& getColorKey() const;
-		void isClearNeeded(bool clear);
+		void setClearScreen(bool clear);
 	};
 	
 	enum MouseCursorType {
--- a/engine/core/view/camera.cpp	Tue Oct 05 19:42:54 2010 +0000
+++ b/engine/core/view/camera.cpp	Wed Oct 06 14:09:24 2010 +0000
@@ -129,7 +129,7 @@
 			delete r_it->second;
 		}
 		m_renderers.clear();
-		m_renderbackend->isClearNeeded(true);
+		m_renderbackend->setClearScreen(true);
 		delete m_map_observer;
 	}
 
@@ -448,10 +448,10 @@
 		}
 
 		if(trec1 && trec2 && trec3 && trec4) {
-			m_renderbackend->isClearNeeded(false);
+			m_renderbackend->setClearScreen(false);
 			return false;
 		}
-		m_renderbackend->isClearNeeded(true);
+		m_renderbackend->setClearScreen(true);
 		return true;
 	}