[Scummvm-cvs-logs] scummvm master -> 4a88f39cc93a776fb63cf48f27856b06f042eceb

dreammaster dreammaster at scummvm.org
Fri May 27 03:48:50 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4a88f39cc9 SHERLOCK: Refactor Surface and Screen to not use virtual inheritance


Commit: 4a88f39cc93a776fb63cf48f27856b06f042eceb
    https://github.com/scummvm/scummvm/commit/4a88f39cc93a776fb63cf48f27856b06f042eceb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-05-26T21:48:40-04:00

Commit Message:
SHERLOCK: Refactor Surface and Screen to not use virtual inheritance

Changed paths:
    engines/sherlock/fonts.cpp
    engines/sherlock/fonts.h
    engines/sherlock/screen.cpp
    engines/sherlock/screen.h
    engines/sherlock/surface.cpp
    engines/sherlock/surface.h



diff --git a/engines/sherlock/fonts.cpp b/engines/sherlock/fonts.cpp
index 5a14881..dc7ecd5 100644
--- a/engines/sherlock/fonts.cpp
+++ b/engines/sherlock/fonts.cpp
@@ -195,7 +195,7 @@ inline byte Fonts::translateChar(byte c) {
 	}
 }
 
-void Fonts::writeString(Surface *surface, const Common::String &str,
+void Fonts::writeString(BaseSurface *surface, const Common::String &str,
 		const Common::Point &pt, int overrideColor) {
 	Common::Point charPos = pt;
 
diff --git a/engines/sherlock/fonts.h b/engines/sherlock/fonts.h
index 3594d46..6c80544 100644
--- a/engines/sherlock/fonts.h
+++ b/engines/sherlock/fonts.h
@@ -31,7 +31,7 @@ namespace Sherlock {
 
 class SherlockEngine;
 class ImageFile;
-class Surface;
+class BaseSurface;
 
 class Fonts {
 private:
@@ -44,7 +44,7 @@ protected:
 	static int _widestChar;
 	static uint16 _charCount;
 
-	static void writeString(Surface *surface, const Common::String &str, 
+	static void writeString(BaseSurface *surface, const Common::String &str, 
 		const Common::Point &pt, int overrideColor = 0);
 
 	static inline byte translateChar(byte c);
diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp
index d96310a..a79f5f4 100644
--- a/engines/sherlock/screen.cpp
+++ b/engines/sherlock/screen.cpp
@@ -40,7 +40,7 @@ Screen *Screen::init(SherlockEngine *vm) {
 		return new Scalpel::ScalpelScreen(vm);
 }
 
-Screen::Screen(SherlockEngine *vm) : Graphics::Screen(), _vm(vm) {
+Screen::Screen(SherlockEngine *vm) : BaseSurface(), _vm(vm) {
 	_transitionSeed = 1;
 	_fadeStyle = false;
 	Common::fill(&_cMap[0], &_cMap[PALETTE_SIZE], 0);
diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h
index f05a4f0..fb44c6d 100644
--- a/engines/sherlock/screen.h
+++ b/engines/sherlock/screen.h
@@ -25,7 +25,6 @@
 
 #include "common/list.h"
 #include "common/rect.h"
-#include "graphics/screen.h"
 #include "sherlock/image_file.h"
 #include "sherlock/surface.h"
 #include "sherlock/resources.h"
@@ -39,7 +38,7 @@ namespace Sherlock {
 
 class SherlockEngine;
 
-class Screen : virtual public Graphics::Screen, virtual public Surface {
+class Screen : public BaseSurface {
 private:
 	uint32 _transitionSeed;
 
diff --git a/engines/sherlock/surface.cpp b/engines/sherlock/surface.cpp
index 47b7d4a..92ebdb6 100644
--- a/engines/sherlock/surface.cpp
+++ b/engines/sherlock/surface.cpp
@@ -25,19 +25,19 @@
 
 namespace Sherlock {
 
-Surface::Surface() : Graphics::ManagedSurface(), Fonts() {
+BaseSurface::BaseSurface() : Graphics::Screen(), Fonts() {
 }
 
-Surface::Surface(int width, int height) : Graphics::ManagedSurface(width, height),
+BaseSurface::BaseSurface(int width, int height) : Graphics::Screen(width, height),
 		Fonts() {
 	create(width, height);
 }
 
-void Surface::writeString(const Common::String &str, const Common::Point &pt, uint overrideColor) {
+void BaseSurface::writeString(const Common::String &str, const Common::Point &pt, uint overrideColor) {
 	Fonts::writeString(this, str, pt, overrideColor);
 }
 
-void Surface::writeFancyString(const Common::String &str, const Common::Point &pt, uint overrideColor1, uint overrideColor2) {
+void BaseSurface::writeFancyString(const Common::String &str, const Common::Point &pt, uint overrideColor1, uint overrideColor2) {
 	writeString(str, Common::Point(pt.x, pt.y), overrideColor1);
 	writeString(str, Common::Point(pt.x + 1, pt.y), overrideColor1);
 	writeString(str, Common::Point(pt.x + 2, pt.y), overrideColor1);
@@ -49,19 +49,19 @@ void Surface::writeFancyString(const Common::String &str, const Common::Point &p
 	writeString(str, Common::Point(pt.x + 1, pt.y + 1), overrideColor2);
 }
 
-void Surface::SHtransBlitFrom(const ImageFrame &src, const Common::Point &pt,
+void BaseSurface::SHtransBlitFrom(const ImageFrame &src, const Common::Point &pt,
 		bool flipped, int overrideColor, int scaleVal) {
 	Common::Point drawPt(pt.x + src.sDrawXOffset(scaleVal), pt.y + src.sDrawYOffset(scaleVal));
 	SHtransBlitFrom(src._frame, drawPt, flipped, overrideColor, scaleVal);
 }
 
-void Surface::SHtransBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
+void BaseSurface::SHtransBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
 		bool flipped, int overrideColor, int scaleVal) {
 	Common::Rect srcRect(0, 0, src.w, src.h);
 	Common::Rect destRect(pt.x, pt.y, pt.x + src.w * SCALE_THRESHOLD / scaleVal,
 		pt.y + src.h * SCALE_THRESHOLD / scaleVal);
 	
-	Graphics::ManagedSurface::transBlitFrom(src, srcRect, destRect, TRANSPARENCY,
+	Graphics::Screen::transBlitFrom(src, srcRect, destRect, TRANSPARENCY,
 		flipped, overrideColor);
 }
 
diff --git a/engines/sherlock/surface.h b/engines/sherlock/surface.h
index 7f946b4..7e02d4c 100644
--- a/engines/sherlock/surface.h
+++ b/engines/sherlock/surface.h
@@ -25,7 +25,7 @@
 
 #include "common/rect.h"
 #include "common/platform.h"
-#include "graphics/managed_surface.h"
+#include "graphics/screen.h"
 #include "sherlock/fonts.h"
 #include "sherlock/image_file.h"
 
@@ -35,21 +35,21 @@ namespace Sherlock {
 #define TRANSPARENCY 255
 
 /**
- * Implements a descendent surface that combines both a managed surface and the font
+ * Implements a base surface that combines both a managed surface and the font
  * drawing code. It also introduces a series of drawing method stubs that the 3DO
  * Serrated Scalpel screen overrides to implement sprite doubling
  */
-class Surface: virtual public Graphics::ManagedSurface, public Fonts {
+class BaseSurface: public Graphics::Screen, public Fonts {
 public:
 	/**
 	 * Constructor
 	 */
-	Surface();
+	BaseSurface();
 	
 	/**
 	 * Constructor
 	 */
-	Surface(int width, int height);
+	BaseSurface(int width, int height);
 
 	/**
 	 * Draws a surface on this surface
@@ -112,6 +112,18 @@ public:
 	void writeFancyString(const Common::String &str, const Common::Point &pt, uint overrideColor1, uint overrideColor2);
 };
 
+class Surface : public BaseSurface {
+protected:
+	/**
+	* Override the addDirtyRect from Graphics::Screen, since for standard
+	* surfaces we don't need dirty rects to be tracked
+	*/
+	virtual void addDirtyRect(const Common::Rect &r) {}
+public:
+	Surface() : BaseSurface() {}
+	Surface(int width, int height) : BaseSurface(width, height) {}
+};
+
 } // End of namespace Sherlock
 
 #endif






More information about the Scummvm-git-logs mailing list