22 #ifndef TWINE_SCENE_GRAPH_H 23 #define TWINE_SCENE_GRAPH_H 25 #include "graphics/screen.h" 26 #include "twine/shared.h" 31 inline bool drawGraph(int32 posX, int32 posY,
const uint8 *pGraph,
bool isSprite,
Graphics::Screen &frontVideoBuffer,
const Common::Rect &clip) {
36 const int32 left = posX + pGraph[2];
37 if (left >= clip.
right) {
40 const int32 top = posY + pGraph[3];
41 if (top >= clip.bottom) {
44 const int32 right = pGraph[0] + left;
45 if (right < clip.
left) {
48 const int32 bottom = pGraph[1] + top;
49 if (bottom < clip.top) {
52 const int32 maxY =
MIN(bottom, (int32)clip.bottom);
60 for (int32 y = top; y < maxY; ++y) {
61 const uint8 rleAmount = *pGraph++;
62 for (int32 run = 0; run < rleAmount; ++run) {
63 const uint8 rleMask = *pGraph++;
64 const uint8 iterations = bits(rleMask, 0, 6) + 1;
65 const uint8 opCode = bits(rleMask, 6, 2);
70 if (y < clip.top || x >= clip.
right || x + iterations < clip.
left) {
80 uint8 *out = (uint8 *)frontVideoBuffer.
getBasePtr(x, y);
81 for (uint8 i = 0; i < iterations; i++) {
91 const uint8 pixel = *pGraph++;
92 uint8 *out = (uint8 *)frontVideoBuffer.
getBasePtr(x, y);
93 for (uint8 i = 0; i < iterations; i++) {
115 #endif // TWINE_SCENE_GRAPH_H T left
Definition: rect.h:170
const void * getBasePtr(int x, int y) const
Definition: managed_surface.h:249
virtual void addDirtyRect(const Common::Rect &r)
T right
Definition: rect.h:171
Definition: achievements_tables.h:27
T MIN(T a, T b)
Definition: util.h:61
bool isValidRect() const
Definition: rect.h:380