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/ps2 | |
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/ps2')
-rw-r--r-- | backends/platform/ps2/Gs2dScreen.cpp | 24 | ||||
-rw-r--r-- | backends/platform/ps2/Gs2dScreen.h | 6 | ||||
-rw-r--r-- | backends/platform/ps2/systemps2.cpp | 11 | ||||
-rw-r--r-- | backends/platform/ps2/systemps2.h | 3 |
4 files changed, 26 insertions, 18 deletions
diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index 4829027f15..1de3c5e8c8 100644 --- a/backends/platform/ps2/Gs2dScreen.cpp +++ b/backends/platform/ps2/Gs2dScreen.cpp @@ -364,13 +364,6 @@ void Gs2dScreen::copyScreenRect(const uint8 *buf, int pitch, int x, int y, int w } } -void Gs2dScreen::clearScreen(void) { - WaitSema(g_DmacSema); - memset(_screenBuf, 0, _width * _height); - _screenChanged = true; - SignalSema(g_DmacSema); -} - void Gs2dScreen::setPalette(const uint32 *pal, uint8 start, uint16 num) { assert(start + num <= 256); @@ -393,11 +386,20 @@ void Gs2dScreen::grabPalette(uint32 *pal, uint8 start, uint16 num) { } } -void Gs2dScreen::grabScreen(Graphics::Surface *surf) { - assert(surf); +Graphics::Surface *Gs2dScreen::lockScreen() { WaitSema(g_DmacSema); - surf->create(_width, _height, 1); - memcpy(surf->pixels, _screenBuf, _width * _height); + + _framebuffer.pixels = _screen->pixels; + _framebuffer.w = _screen->w; + _framebuffer.h = _screen->h; + _framebuffer.pitch = _screen->pitch; + _framebuffer.bytesPerPixel = 1; + + return &_framebuffer; +} + +void Gs2dScreen::unlockScreen() { + _screenChanged = true; SignalSema(g_DmacSema); } diff --git a/backends/platform/ps2/Gs2dScreen.h b/backends/platform/ps2/Gs2dScreen.h index 353e577980..471ec87789 100644 --- a/backends/platform/ps2/Gs2dScreen.h +++ b/backends/platform/ps2/Gs2dScreen.h @@ -56,13 +56,13 @@ public: void copyPrintfOverlay(const uint8* buf); void clearPrintfOverlay(void); - void clearScreen(void); void copyScreenRect(const uint8 *buf, int pitch, int x, int y, int w, int h); void setPalette(const uint32 *pal, uint8 start, uint16 num); void updateScreen(void); void grabPalette(uint32 *pal, uint8 start, uint16 num); - void grabScreen(Graphics::Surface *surf); + Graphics::Surface *lockScreen(); + void unlockScreen(); //- overlay routines void copyOverlayRect(const uint16 *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h); void grabOverlay(uint16 *buf, uint16 pitch); @@ -99,6 +99,8 @@ private: uint32 _mouseScaleX, _mouseScaleY; uint8 _mTraCol; + Graphics::Surface _framebuffer; + int _shakePos; bool _showMouse, _showOverlay, _screenChanged, _overlayChanged, _clutChanged; diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index 80d5ab9c83..32290bddea 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -326,7 +326,7 @@ OSystem_PS2::OSystem_PS2(const char *elfPath) { } _screen->wantAnim(false); - _screen->clearScreen(); + clearScreen(); } OSystem_PS2::~OSystem_PS2(void) { @@ -510,9 +510,12 @@ void OSystem_PS2::copyRectToScreen(const byte *buf, int pitch, int x, int y, int _screen->copyScreenRect((const uint8*)buf, pitch, x, y, w, h); } -bool OSystem_PS2::grabRawScreen(Graphics::Surface *surf) { - _screen->grabScreen(surf); - return true; +Graphics::Surface *OSystem_PS2::lockScreen() { + return _screen->lockScreen(); +} + +void OSystem_PS2::unlockScreen() { + _screen->unlockScreen(); } void OSystem_PS2::updateScreen(void) { diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h index 4a3764666e..b5c84d3b95 100644 --- a/backends/platform/ps2/systemps2.h +++ b/backends/platform/ps2/systemps2.h @@ -56,7 +56,8 @@ public: virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); virtual void setShakePos(int shakeOffset); virtual void grabPalette(byte *colors, uint start, uint num); - virtual bool grabRawScreen(Graphics::Surface *surf); + virtual Graphics::Surface *lockScreen(); + virtual void unlockScreen(); virtual void updateScreen(); virtual void showOverlay(); |