22#ifndef TWINE_SCENE_GRAPH_H
23#define TWINE_SCENE_GRAPH_H
25#include "graphics/screen.h"
26#include "twine/shared.h"
31inline bool drawGraph(int32 posX, int32 posY,
const uint8 *pGraph,
bool isSprite,
Graphics::Screen &frontVideoBuffer,
const Common::Rect &clip) {
32 if (!clip.isValidRect()) {
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++) {
82 if (x >= clip.left && x < clip.right) {
91 const uint8 pixel = *pGraph++;
92 uint8 *out = (uint8 *)frontVideoBuffer.
getBasePtr(x, y);
93 for (uint8 i = 0; i < iterations; i++) {
94 if (x >= clip.left && x < clip.right) {
const void * getBasePtr(int x, int y) const
Definition: managed_surface.h:252
void addDirtyRect(const Common::Rect &r) override
T MIN(T a, T b)
Definition: util.h:63