diff options
author | Eugene Sandulenko | 2013-09-04 22:13:44 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2013-09-06 14:51:25 +0300 |
commit | d0484467688e896937f232766e9104bbd3377144 (patch) | |
tree | 5f90488f581bef778d028862bcbf2ca4150cf3f3 | |
parent | ff9cd54fd15c07db4c31f81bff318db26a47297f (diff) | |
download | scummvm-rg350-d0484467688e896937f232766e9104bbd3377144.tar.gz scummvm-rg350-d0484467688e896937f232766e9104bbd3377144.tar.bz2 scummvm-rg350-d0484467688e896937f232766e9104bbd3377144.zip |
FULLPIPE: Implement Bitmap::isPixelHitAtPos()
-rw-r--r-- | engines/fullpipe/gfx.cpp | 44 | ||||
-rw-r--r-- | engines/fullpipe/gfx.h | 2 |
2 files changed, 45 insertions, 1 deletions
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 131396c7f7..629e8e5b0e 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -53,6 +53,11 @@ Bitmap::Bitmap(Bitmap *src) { _pixels = src->_pixels; } +Bitmap::~Bitmap() { + if (_pixels) + free(_pixels); +} + void Bitmap::load(Common::ReadStream *s) { debug(5, "Bitmap::load()"); @@ -635,7 +640,44 @@ int Picture::getPixelAtPosEx(int x, int y) { } bool Bitmap::isPixelHitAtPos(int x, int y) { - debug(0, "STUB: Bitmap::isPixelHitAtPos(%d, %d)", x, y); + if (x < _x || x >= _width + _x || y < _y || y >= _y + _height) + return false; + + int off; + + if (_type == 'CB\x05e') + off = 2 * ((_width + 1) / 2); + else + off = 4 * ((_width + 3) / 4); + + off = x + off * (_y + _height - y - 1) - _x; + + if (_flags & 0x1000000) { + switch (_type) { + case 'CB\0\0': + if (_pixels[off] == _flags & 0xff) + return false; + break; + case 'CB\x05e': + if (!*(int16 *)&_pixels[2 * off]) + return false; + break; + case 'RB\0\0': + { + Bitmap bmp; + + if (decompressRle2(&bmp)) + return bmp._pixels[off] != bmp._flags; + + return false; + } + } + } + return true; +} + +bool Bitmap::decompressRle2(Bitmap *res) { + warning("STUB: Bitmap::decompressRle2()"); return false; } diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h index 6818fe6b2d..ccfc72f96f 100644 --- a/engines/fullpipe/gfx.h +++ b/engines/fullpipe/gfx.h @@ -41,6 +41,7 @@ struct Bitmap { Bitmap(); Bitmap(Bitmap *src); + ~Bitmap(); void load(Common::ReadStream *s); void putDib(int x, int y, int32 *palette); @@ -62,6 +63,7 @@ struct Bitmap { void drawRotated(int x, int y, int angle, byte *palette); bool isPixelHitAtPos(int x, int y); + bool decompressRle2(Bitmap *res); }; class Picture : public MemoryObject { |