[Scummvm-cvs-logs] SF.net SVN: scummvm:[34938] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Sat Nov 8 03:32:41 CET 2008
Revision: 34938
http://scummvm.svn.sourceforge.net/scummvm/?rev=34938&view=rev
Author: peres001
Date: 2008-11-08 02:32:40 +0000 (Sat, 08 Nov 2008)
Log Message:
-----------
Got rid of the SurfaceToMultiFrames adapter class.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/graphics.h
scummvm/trunk/engines/parallaction/gui_br.cpp
Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h 2008-11-08 01:34:02 UTC (rev 34937)
+++ scummvm/trunk/engines/parallaction/graphics.h 2008-11-08 02:32:40 UTC (rev 34938)
@@ -124,49 +124,8 @@
};
-/*
- 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
Modified: scummvm/trunk/engines/parallaction/gui_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gui_br.cpp 2008-11-08 01:34:02 UTC (rev 34937)
+++ scummvm/trunk/engines/parallaction/gui_br.cpp 2008-11-08 02:32:40 UTC (rev 34938)
@@ -113,8 +113,8 @@
// 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 @@
} 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 {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list