Skip to content

Commit

Permalink
NDS: Do not access Surface::pixels directly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Schickel committed Aug 6, 2013
1 parent 6639958 commit 6d86a66
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions backends/platform/ds/arm9/source/osystem_ds.cpp
Expand Up @@ -296,7 +296,7 @@ void OSystem_DS::copyRectToScreen(const void *buf, int pitch, int x, int y, int
// to save a few pennies/euro cents on the hardware.

if (_frameBufferExists) {
bg = (u16 *)_framebuffer.pixels;
bg = (u16 *)_framebuffer.getPixels();
stride = _framebuffer.pitch;
} else {
bg = (u16 *)DS::get8BitBackBuffer();
Expand Down Expand Up @@ -455,7 +455,7 @@ void OSystem_DS::copyRectToScreen(const void *buf, int pitch, int x, int y, int

dmaCopyHalfWords(3, src, dest1, w);

if ((!_frameBufferExists) || (buf == _framebuffer.pixels)) {
if ((!_frameBufferExists) || (buf == _framebuffer.getPixels())) {
dmaCopyHalfWords(2, src, dest2, w);
}

Expand All @@ -476,7 +476,7 @@ void OSystem_DS::updateScreen() {
_frameBufferExists = false;

// Copy temp framebuffer back to screen
copyRectToScreen((byte *)_framebuffer.pixels, _framebuffer.pitch, 0, 0, _framebuffer.w, _framebuffer.h);
copyRectToScreen((byte *)_framebuffer.getPixels(), _framebuffer.pitch, 0, 0, _framebuffer.w, _framebuffer.h);
}

DS::displayMode16BitFlipBuffer();
Expand Down Expand Up @@ -755,11 +755,8 @@ Graphics::Surface *OSystem_DS::createTempFrameBuffer() {

if (DS::isCpuScalerEnabled()) {

_framebuffer.pixels = DS::getScalerBuffer();
_framebuffer.w = DS::getGameWidth();
_framebuffer.h = DS::getGameHeight();
_framebuffer.pitch = DS::getGameWidth();
_framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
_framebuffer.init(DS::getGameWidth(), DS::getGameHeight(), DS::getGameWidth(),
DS::getScalerBuffer(), Graphics::PixelFormat::createFormatCLUT8());

} else {

Expand All @@ -780,11 +777,7 @@ Graphics::Surface *OSystem_DS::createTempFrameBuffer() {
dmaCopyHalfWords(3, srcLine, destLine, width);
}

_framebuffer.pixels = dest;
_framebuffer.w = width;
_framebuffer.h = height;
_framebuffer.pitch = width;
_framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
_framebuffer.init(width, height, width, dest, Graphics::PixelFormat::createFormatCLUT8());

}

Expand All @@ -798,8 +791,8 @@ Graphics::Surface *OSystem_DS::createTempFrameBuffer() {
for (int y = 0; y < DS::getGameHeight(); y++) {
DC_FlushRange(image + (y * imageStrideInWords), DS::getGameWidth());
for (int x = 0; x < DS::getGameWidth() >> 1; x++) {
*(((u16 *) (_framebuffer.pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[(y * imageStrideInWords) + x];
// *(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y * imageStrideInWords + x];
*(((u16 *) (_framebuffer.getPixels())) + y * (DS::getGameWidth() >> 1) + x) = image[(y * imageStrideInWords) + x];
// *(((u16 *) (surf->getPixels())) + y * (DS::getGameWidth() >> 1) + x) = image[y * imageStrideInWords + x];
}
}*/

Expand Down

0 comments on commit 6d86a66

Please sign in to comment.