diff options
author | Paul Gilbert | 2016-05-26 21:48:40 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-05-26 21:48:40 -0400 |
commit | 4a88f39cc93a776fb63cf48f27856b06f042eceb (patch) | |
tree | 520e93be2a1586964868e05fe72424ac4fec0e6a /engines | |
parent | 78e52365bd1d8cdd56ddce6ae3d52ae04f9abd4c (diff) | |
download | scummvm-rg350-4a88f39cc93a776fb63cf48f27856b06f042eceb.tar.gz scummvm-rg350-4a88f39cc93a776fb63cf48f27856b06f042eceb.tar.bz2 scummvm-rg350-4a88f39cc93a776fb63cf48f27856b06f042eceb.zip |
SHERLOCK: Refactor Surface and Screen to not use virtual inheritance
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sherlock/fonts.cpp | 2 | ||||
-rw-r--r-- | engines/sherlock/fonts.h | 4 | ||||
-rw-r--r-- | engines/sherlock/screen.cpp | 2 | ||||
-rw-r--r-- | engines/sherlock/screen.h | 3 | ||||
-rw-r--r-- | engines/sherlock/surface.cpp | 14 | ||||
-rw-r--r-- | engines/sherlock/surface.h | 22 |
6 files changed, 29 insertions, 18 deletions
diff --git a/engines/sherlock/fonts.cpp b/engines/sherlock/fonts.cpp index 5a14881f1c..dc7ecd521e 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 3594d466c2..6c805447b3 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 d96310abb3..a79f5f428b 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 f05a4f0a90..fb44c6dde2 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 47b7d4a780..92ebdb6fea 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 7f946b467f..7e02d4cddc 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 |