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/gp2x | |
| 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/gp2x')
| -rw-r--r-- | backends/platform/gp2x/gp2x-common.h | 7 | ||||
| -rw-r--r-- | backends/platform/gp2x/graphics.cpp | 34 |
2 files changed, 13 insertions, 28 deletions
diff --git a/backends/platform/gp2x/gp2x-common.h b/backends/platform/gp2x/gp2x-common.h index 4c91a00247..68f2fb997e 100644 --- a/backends/platform/gp2x/gp2x-common.h +++ b/backends/platform/gp2x/gp2x-common.h @@ -90,11 +90,8 @@ public: // The screen will not be updated to reflect the new bitmap void copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h); - // Copies the screen to a buffer - bool grabRawScreen(Graphics::Surface *surf); - - // Clear the screen - void clearScreen(); + virtual Graphics::Surface *lockScreen(); + virtual void unlockScreen(); // Update the dirty areas of the screen void updateScreen(); diff --git a/backends/platform/gp2x/graphics.cpp b/backends/platform/gp2x/graphics.cpp index a482689e43..c3ed5c627c 100644 --- a/backends/platform/gp2x/graphics.cpp +++ b/backends/platform/gp2x/graphics.cpp @@ -687,22 +687,6 @@ void OSystem_GP2X::setZoomOnMouse() { } } -void OSystem_GP2X::clearScreen() { - assert (_transactionMode == kTransactionNone); - - // Try to lock the screen surface - if (SDL_LockSurface(_screen) == -1) - error("SDL_LockSurface failed: %s", SDL_GetError()); - - byte *dst = (byte *)_screen->pixels; - - // Clear the screen - memset(dst, 0, _screenWidth * _screenHeight); - - // Unlock the screen surface - SDL_UnlockSurface(_screen); -} - void OSystem_GP2X::copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h) { assert (_transactionMode == kTransactionNone); assert(src); @@ -772,15 +756,19 @@ void OSystem_GP2X::copyRectToScreen(const byte *src, int pitch, int x, int y, in SDL_UnlockSurface(_screen); } -// TIDY: DIRTY HACK: Try a REALLY simple version of grabRawScreen to -// debug why it will not work on the GP2X. -bool OSystem_GP2X::grabRawScreen(Graphics::Surface *surf) { - assert(surf); +Graphics::Surface *OSystem_GP2X::lockScreen() { + _framebuffer.pixels = _screen->pixels; + _framebuffer.w = _screen->w; + _framebuffer.h = _screen->h; + _framebuffer.pitch = _screen->pitch; + _framebuffer.bytesPerPixel = 1; - surf->create(_screenWidth, _screenHeight, 1); - memcpy(surf->pixels, _screen->pixels, _screenWidth * _screenHeight); + return &_framebuffer; +} - return true; +void OSystem_GP2X::unlockScreen() { + // Force screen update + _forceFull = true; } void OSystem_GP2X::addDirtyRect(int x, int y, int w, int h, bool realCoordinates) { |
