diff options
author | Nicola Mettifogo | 2008-11-08 02:32:40 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2008-11-08 02:32:40 +0000 |
commit | 767485840f8259c8441b2879eec5cb327c79e049 (patch) | |
tree | 7339915678ba9a1e68421985522ec754d4b84aca | |
parent | 7cbd04dc23db94c19bca8cec8350206b894b1958 (diff) | |
download | scummvm-rg350-767485840f8259c8441b2879eec5cb327c79e049.tar.gz scummvm-rg350-767485840f8259c8441b2879eec5cb327c79e049.tar.bz2 scummvm-rg350-767485840f8259c8441b2879eec5cb327c79e049.zip |
Got rid of the SurfaceToMultiFrames adapter class.
svn-id: r34938
-rw-r--r-- | engines/parallaction/graphics.h | 41 | ||||
-rw-r--r-- | engines/parallaction/gui_br.cpp | 19 |
2 files changed, 11 insertions, 49 deletions
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index ac9f096d7e..90cc5f55b7 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -124,48 +124,7 @@ public: }; -/* - this adapter can handle Surfaces containing multiple frames, - provided all these frames are the same width and height -*/ -struct SurfaceToMultiFrames : public Frames { - - uint _num; - uint _width, _height; - Graphics::Surface *_surf; - - SurfaceToMultiFrames(uint num, uint w, uint h, Graphics::Surface *surf) : _num(num), _width(w), _height(h), _surf(surf) { - - } - - ~SurfaceToMultiFrames() { - delete _surf; - } - uint16 getNum() { - return _num; - } - byte* getData(uint16 index) { - assert(index < _num); - return (byte*)_surf->getBasePtr(0, _height * index); - } - void getRect(uint16 index, Common::Rect &r) { - assert(index < _num); - r.left = 0; - r.top = 0; - r.setWidth(_width); - r.setHeight(_height); - } - uint getRawSize(uint16 index) { - assert(index < _num); - return getSize(index); - } - uint getSize(uint16 index) { - assert(index < _num); - return _width * _height; - } - -}; struct MaskBuffer { // handles a 2-bit depth buffer used for z-buffering diff --git a/engines/parallaction/gui_br.cpp b/engines/parallaction/gui_br.cpp index c687a15026..3b6cde8fbf 100644 --- a/engines/parallaction/gui_br.cpp +++ b/engines/parallaction/gui_br.cpp @@ -113,8 +113,8 @@ class MainMenuInputState_BR : public MenuInputState { // one is in normal color, the other is inverted. // the two 'frames' are used to display selected/unselected menu items - Graphics::Surface *surf = new Graphics::Surface; - surf->create(MENUITEM_WIDTH, MENUITEM_HEIGHT*2, 1); + byte *data = new byte[MENUITEM_WIDTH * MENUITEM_HEIGHT * 2]; + memset(data, 0, MENUITEM_WIDTH * MENUITEM_HEIGHT * 2); // build first frame to be displayed when item is not selected if (_vm->getPlatform() == Common::kPlatformPC) { @@ -122,17 +122,20 @@ class MainMenuInputState_BR : public MenuInputState { } else { _vm->_menuFont->setColor(7); } - _vm->_menuFont->drawString((byte*)surf->getBasePtr(5, 2), MENUITEM_WIDTH, text); + byte *dst = data + 5 + 2 * MENUITEM_WIDTH; + _vm->_menuFont->drawString(dst, MENUITEM_WIDTH, text); // build second frame to be displayed when item is selected - _vm->_menuFont->drawString((byte*)surf->getBasePtr(5, 2 + MENUITEM_HEIGHT), MENUITEM_WIDTH, text); - byte *s = (byte*)surf->getBasePtr(0, MENUITEM_HEIGHT); - for (int i = 0; i < surf->w * MENUITEM_HEIGHT; i++) { - *s++ ^= 0xD; + dst = dst + MENUITEM_WIDTH * MENUITEM_HEIGHT; + _vm->_menuFont->drawString(dst, MENUITEM_WIDTH, text); + + dst = data + MENUITEM_WIDTH * MENUITEM_HEIGHT; + for (int i = 0; i < MENUITEM_WIDTH * MENUITEM_HEIGHT; i++) { + *dst++ ^= 0xD; } // wrap the surface into the suitable Frames adapter - return new SurfaceToMultiFrames(2, MENUITEM_WIDTH, MENUITEM_HEIGHT, surf); + return new Cnv(2, MENUITEM_WIDTH, MENUITEM_HEIGHT, data, true); } enum MenuOptions { |