Skip to content

Commit

Permalink
ADL: Add byte-access functions to Display class
Browse files Browse the repository at this point in the history
  • Loading branch information
waltervn committed Mar 5, 2017
1 parent 33c8073 commit 494682d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions engines/adl/display.cpp
Expand Up @@ -241,6 +241,12 @@ void Display::putPixel(const Common::Point &p, byte color) {
writeFrameBuffer(p, color, mask);
}

void Display::setPixelByte(const Common::Point &p, byte color) {
assert(p.x >= 0 && p.x < DISPLAY_WIDTH && p.y >= 0 && p.y < DISPLAY_HEIGHT);

_frameBuf[p.y * DISPLAY_PITCH + p.x / 7] = color;
}

void Display::setPixelBit(const Common::Point &p, byte color) {
writeFrameBuffer(p, color, 1 << (p.x % 7));
}
Expand All @@ -249,6 +255,12 @@ void Display::setPixelPalette(const Common::Point &p, byte color) {
writeFrameBuffer(p, color, 0x80);
}

byte Display::getPixelByte(const Common::Point &p) const {
assert(p.x >= 0 && p.x < DISPLAY_WIDTH && p.y >= 0 && p.y < DISPLAY_HEIGHT);

return _frameBuf[p.y * DISPLAY_PITCH + p.x / 7];
}

bool Display::getPixelBit(const Common::Point &p) const {
assert(p.x >= 0 && p.x < DISPLAY_WIDTH && p.y >= 0 && p.y < DISPLAY_HEIGHT);

Expand Down
2 changes: 2 additions & 0 deletions engines/adl/display.h
Expand Up @@ -67,8 +67,10 @@ class Display {
static void loadFrameBuffer(Common::ReadStream &stream, byte *dst);
void loadFrameBuffer(Common::ReadStream &stream);
void putPixel(const Common::Point &p, byte color);
void setPixelByte(const Common::Point &p, byte color);
void setPixelBit(const Common::Point &p, byte color);
void setPixelPalette(const Common::Point &p, byte color);
byte getPixelByte(const Common::Point &p) const;
bool getPixelBit(const Common::Point &p) const;
void clear(byte color);

Expand Down

0 comments on commit 494682d

Please sign in to comment.