From 6d86a66493a7f9b74eeb14a5ff4bd750805d00ee Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 6 Aug 2013 03:33:56 +0200 Subject: NDS: Do not access Surface::pixels directly. --- backends/platform/ds/arm9/source/osystem_ds.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'backends/platform/ds/arm9/source') diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 2f6358d8ee..f109983fbc 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -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(); @@ -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); } @@ -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(); @@ -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 { @@ -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()); } @@ -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]; } }*/ -- cgit v1.2.3