Skip to content

Commit

Permalink
TEENAGENT: Take advantage of Surface::getPixels.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Schickel committed Aug 3, 2013
1 parent 1550e98 commit 4ddace8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion engines/teenagent/font.cpp
Expand Up @@ -65,7 +65,7 @@ uint Font::render(Graphics::Surface *surface, int x, int y, char c, byte color)
byte *glyph = _data + READ_LE_UINT16(_data + idx * 2);

int h = glyph[0], w = glyph[1];
if (surface == NULL || surface->getBasePtr(0, 0) == NULL || y + h <= 0 || y >= kScreenHeight || x + w <= 0 || x >= kScreenWidth)
if (surface == NULL || surface->getPixels() == NULL || y + h <= 0 || y >= kScreenHeight || x + w <= 0 || x >= kScreenWidth)
return w - _widthPack;

int i0 = 0, j0 = 0;
Expand Down
2 changes: 1 addition & 1 deletion engines/teenagent/resources.cpp
Expand Up @@ -160,7 +160,7 @@ void Resources::loadOff(Graphics::Surface &surface, byte *palette, int id) {
off.read(id, buf, bufferSize);

byte *src = buf;
byte *dst = (byte *)surface.getBasePtr(0, 0);
byte *dst = (byte *)surface.getPixels();
memcpy(dst, src, 64000);
memcpy(palette, buf + 64000, 768);

Expand Down
8 changes: 4 additions & 4 deletions engines/teenagent/scene.cpp
Expand Up @@ -370,7 +370,7 @@ void Scene::init(int id, const Common::Point &pos) {
for (byte i = 0; i < 4; ++i)
customAnimation[i].free();

if (background.getBasePtr(0, 0) == NULL)
if (background.getPixels() == NULL)
background.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8());

warp(pos);
Expand Down Expand Up @@ -414,7 +414,7 @@ void Scene::init(int id, const Common::Point &pos) {
if (nowPlaying != _vm->res->dseg.get_byte(dsAddr_currentMusic))
_vm->music->load(_vm->res->dseg.get_byte(dsAddr_currentMusic));

_vm->_system->copyRectToScreen(background.getBasePtr(0, 0), background.pitch, 0, 0, background.w, background.h);
_vm->_system->copyRectToScreen(background.getPixels(), background.pitch, 0, 0, background.w, background.h);
setPalette(0);
}

Expand Down Expand Up @@ -640,8 +640,8 @@ bool Scene::render(bool tickGame, bool tickMark, uint32 messageDelta) {
return true;
}

if (background.getBasePtr(0, 0) && debugFeatures.feature[DebugFeatures::kShowBack]) {
_vm->_system->copyRectToScreen(background.getBasePtr(0, 0), background.pitch, 0, 0, background.w, background.h);
if (background.getPixels() && debugFeatures.feature[DebugFeatures::kShowBack]) {
_vm->_system->copyRectToScreen(background.getPixels(), background.pitch, 0, 0, background.w, background.h);
} else
_vm->_system->fillScreen(0);

Expand Down
2 changes: 1 addition & 1 deletion engines/teenagent/teenagent.cpp
Expand Up @@ -399,7 +399,7 @@ bool TeenAgentEngine::showLogo() {
return true;
}

_system->copyRectToScreen(s.getBasePtr(0, 0), s.w, s.x, s.y, s.w, s.h);
_system->copyRectToScreen(s.getPixels(), s.w, s.x, s.y, s.w, s.h);
_system->updateScreen();

_system->delayMillis(100);
Expand Down

0 comments on commit 4ddace8

Please sign in to comment.