scummvm/engines/toltecs/microtiles.h
Benjamin Haisch 7b97e8cd93 TOLTECS: A lot of changes in the graphics code:
- Optimized drawing code; now only items (sprites, text, screen masks) which have changed from the previous frame are redrawn, this speeds up things a lot
- Implemented dirty rectangles using a microtile array
- The previously committed Microtile Array implementation from SEL seemed buggy so I wrote my own version which works nicely so far (and is less code and GPL), only MicroTileArray::getRectangles uses parts from the old version, this will be changed later
- One known bug related to dirty rectangles remains: Sometimes the background isn't restored correctly and gfx artifacts are visible
2011-11-20 22:43:06 +01:00

39 lines
1.1 KiB
C++

#ifndef TOLTECS_MICROTILES_H
#define TOLTECS_MICROTILES_H
#include "common/scummsys.h"
#include "common/util.h"
#include "common/rect.h"
namespace Toltecs {
typedef uint32 BoundingBox;
const BoundingBox FullBoundingBox = 0x00001F1F;
const BoundingBox EmptyBoundingBox = 0x00000000;
const int TileSize = 32;
class MicroTileArray {
public:
MicroTileArray(int16 width, int16 height);
~MicroTileArray();
void addRect(Common::Rect r);
void clear();
Common::Rect *getRectangles(int *num_rects, int min_x, int min_y, int max_x, int max_y);
protected:
BoundingBox *_tiles;
int16 _tilesW, _tilesH;
byte TileX0(const BoundingBox &boundingBox);
byte TileY0(const BoundingBox &boundingBox);
byte TileX1(const BoundingBox &boundingBox);
byte TileY1(const BoundingBox &boundingBox);
bool isBoundingBoxEmpty(const BoundingBox &boundingBox);
bool isBoundingBoxFull(const BoundingBox &boundingBox);
void setBoundingBox(BoundingBox &boundingBox, byte x0, byte y0, byte x1, byte y1);
void updateBoundingBox(BoundingBox &boundingBox, byte x0, byte y0, byte x1, byte y1);
};
} // namespace Toltecs
#endif // TOLTECS_MICROTILES_H