diff options
author | Max Horn | 2007-06-19 22:39:59 +0000 |
---|---|---|
committer | Max Horn | 2007-06-19 22:39:59 +0000 |
commit | b51f2f3212ae8a5abbdce4d947ec2d1cad1a0b6f (patch) | |
tree | 45a838924ce55038021cd3c3d8760e80ff630f38 /backends/platform/ds/arm9 | |
parent | ab9b9a1bf362e68f5f6a69462ef2b7c146e6e08f (diff) | |
download | scummvm-rg350-b51f2f3212ae8a5abbdce4d947ec2d1cad1a0b6f.tar.gz scummvm-rg350-b51f2f3212ae8a5abbdce4d947ec2d1cad1a0b6f.tar.bz2 scummvm-rg350-b51f2f3212ae8a5abbdce4d947ec2d1cad1a0b6f.zip |
Implemented the OSystem framebuffer API, as discussed on scummvm-devel. All changes are just fine, and won't cause any compile problems or regressions, despite the fact that I can't test most of the non-SDL backend changes, at an improbability level of two to the power of two hundred and seventy-six thousand to one against - possibly much higher. Anything you still can't cope with is therefore your own problem. Please relax.
svn-id: r27548
Diffstat (limited to 'backends/platform/ds/arm9')
-rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.cpp | 21 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.h | 5 |
2 files changed, 21 insertions, 5 deletions
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index a804369b26..cad6ad6b78 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -474,8 +474,13 @@ Common::SaveFileManager* OSystem_DS::getSavefileManager() } } -bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) { - surf->create(DS::getGameWidth(), DS::getGameHeight(), 1); +Graphics::Surface *OSystem_DS::lockScreen() { + // For now, we create a full temporary screen surface, to which we copy the + // the screen content. Later unlockScreen will copy everything back. + // Not very nice nor efficient, but at least works, and is not worse + // than in the bad old times where we used grabRawScreen + copyRectToScreen. + + _framebuffer.create(DS::getGameWidth(), DS::getGameHeight(), 1); // Ensure we copy using 16 bit quantities due to limitation of VRAM addressing @@ -486,11 +491,19 @@ bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) { DC_FlushRange(image + (y << 8), DS::getGameWidth()); for (int x = 0; x < DS::getGameWidth() >> 1; x++) { - *(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y << 8 + x]; + *(((u16 *) (_framebuffer.pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y << 8 + x]; } } - return true; + return &_framebuffer; +} + +void OSystem_DS::unlockScreen() { + // Copy temp framebuffer back to screen + copyRectToScreen((byte *)_framebuffer.pixels, _framebuffer.pitch, 0, 0, _framebuffer.w, _framebuffer.h); + + // Free memory + _framebuffer.free(); } void OSystem_DS::setFocusRectangle(const Common::Rect& rect) { diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 316f45bb6e..58b940af2c 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -53,6 +53,8 @@ public: DSAudioMixer* _mixer; DSTimerManager* _timer; + Graphics::Surface _framebuffer; + static OSystem_DS* _instance; typedef void (*SoundProc)(void *param, byte *buf, int len); @@ -127,7 +129,8 @@ public: void addEvent(Common::Event& e); bool isEventQueueEmpty() { return queuePos == 0; } - virtual bool grabRawScreen(Graphics::Surface* surf); + virtual Graphics::Surface *lockScreen(); + virtual void unlockScreen(); virtual void setFocusRectangle(const Common::Rect& rect); |