From b51f2f3212ae8a5abbdce4d947ec2d1cad1a0b6f Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 19 Jun 2007 22:39:59 +0000 Subject: 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 --- backends/platform/dc/dc.h | 6 ++++-- backends/platform/dc/display.cpp | 27 ++++++++++++++++----------- 2 files changed, 20 insertions(+), 13 deletions(-) (limited to 'backends/platform/dc') diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index 01e86a561b..fa47ed21f5 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -81,8 +81,8 @@ class OSystem_Dreamcast : public OSystem { // The screen will not be updated to reflect the new bitmap void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); - // Copies the current screen contents to a new surface. - bool grabRawScreen(Graphics::Surface *surf); + virtual Graphics::Surface *lockScreen(); + virtual void unlockScreen(); // Clear the screen to black. void clearScreen(); @@ -213,6 +213,8 @@ class OSystem_Dreamcast : public OSystem { void *ovl_tx[NUM_BUFFERS]; unsigned short palette[256], cursor_palette[256]; + Graphics::Surface _framebuffer; + int temp_sound_buffer[RING_BUFFER_SAMPLES>>SOUND_BUFFER_SHIFT]; void checkSound(); diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp index 73312cafed..da9f6e83ff 100644 --- a/backends/platform/dc/display.cpp +++ b/backends/platform/dc/display.cpp @@ -609,19 +609,24 @@ int OSystem_Dreamcast::getGraphicsMode() const return 0; } -bool OSystem_Dreamcast::grabRawScreen(Graphics::Surface *surf) +Graphics::Surface *OSystem_Dreamcast::lockScreen() { - if(!screen || !surf) - return false; + if (!screen) + return 0; - surf->create(_screen_w, _screen_h, 1); - unsigned char *src = screen, *dst = (unsigned char *)surf->pixels; - for(int h = _screen_h; h>0; --h) { - memcpy(dst, src, _screen_w); - src += SCREEN_W; - dst += _screen_w; - } - return true; + _framebuffer.pixels = screen; + _framebuffer.w = _screen_w; + _framebuffer.h = _screen_h; + _framebuffer.pitch = SCREEN_W; + _framebuffer.bytesPerPixel = 1; + + return &_framebuffer; +} + +void OSystem_Dreamcast::unlockScreen() +{ + // Force screen update + _screen_dirty = true; } void OSystem_Dreamcast::clearScreen() -- cgit v1.2.3