diff options
author | Sven Hesse | 2011-01-27 20:50:18 +0000 |
---|---|---|
committer | Sven Hesse | 2011-01-27 20:50:18 +0000 |
commit | 6513748c460424bef3b2f95dba1648a6be39f72e (patch) | |
tree | b893ba1c2f04189378a2f1fe6d236b18503c63b8 /engines | |
parent | b25a5d18628ef4febe48da00b4036a420b708eb5 (diff) | |
download | scummvm-rg350-6513748c460424bef3b2f95dba1648a6be39f72e.tar.gz scummvm-rg350-6513748c460424bef3b2f95dba1648a6be39f72e.tar.bz2 scummvm-rg350-6513748c460424bef3b2f95dba1648a6be39f72e.zip |
GOB: Add Pixel::isValid() and ConstPixel::isValid()
svn-id: r55573
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gob/surface.cpp | 8 | ||||
-rw-r--r-- | engines/gob/surface.h | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/engines/gob/surface.cpp b/engines/gob/surface.cpp index d621ce5a97..58482a6424 100644 --- a/engines/gob/surface.cpp +++ b/engines/gob/surface.cpp @@ -103,6 +103,10 @@ void Pixel::set(uint32 p) { *((uint16 *) _vidMem) = (uint16) p; } +bool Pixel::isValid() const { + return (_vidMem >= _min) && (_vidMem < _max); +} + ConstPixel::ConstPixel(const byte *vidMem, uint8 bpp, const byte *min, const byte *max) : _vidMem(vidMem), _bpp(bpp), _min(min), _max(max) { @@ -157,6 +161,10 @@ uint32 ConstPixel::get() const { return 0; } +bool ConstPixel::isValid() const { + return (_vidMem >= _min) && (_vidMem < _max); +} + Surface::Surface(uint16 width, uint16 height, uint8 bpp, byte *vidMem) : _width(width), _height(height), _bpp(bpp), _vidMem(vidMem) { diff --git a/engines/gob/surface.h b/engines/gob/surface.h index b8426989f3..a8d52c7b36 100644 --- a/engines/gob/surface.h +++ b/engines/gob/surface.h @@ -49,6 +49,8 @@ public: uint32 get() const; void set(uint32 p); + bool isValid() const; + private: byte *_vidMem; byte *_min, *_max; @@ -71,6 +73,8 @@ public: uint32 get() const; + bool isValid() const; + private: const byte *_vidMem; const byte *_min, *_max; |