diff options
Diffstat (limited to 'backends/sdl/sdl.cpp')
-rw-r--r-- | backends/sdl/sdl.cpp | 121 |
1 files changed, 0 insertions, 121 deletions
diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp index 1979872459..01bb80a827 100644 --- a/backends/sdl/sdl.cpp +++ b/backends/sdl/sdl.cpp @@ -38,17 +38,6 @@ public: // Set a parameter uint32 property(int param, Property *value); - // Overlay - virtual void show_overlay(); - virtual void hide_overlay(); - virtual void clear_overlay(); - virtual void grab_overlay(int16 *buf, int pitch); - virtual void copy_rect_overlay(const int16 *buf, int pitch, int x, int y, int w, int h); - - // Methods that convert RBG to/from colors suitable for the overlay. - virtual int16 RBGToColor(uint8 r, uint8 g, uint8 b); - virtual void colorToRBG(int16 color, uint8 &r, uint8 &g, uint8 &b); - protected: SDL_Surface *_hwscreen; // hardware screen @@ -355,113 +344,3 @@ uint32 OSystem_SDL::property(int param, Property *value) { return OSystem_SDL_Common::property(param, value); } -int16 OSystem_SDL::RBGToColor(uint8 r, uint8 g, uint8 b) -{ - return SDL_MapRGB(_tmpscreen->format, r, g, b); -} - -void OSystem_SDL::colorToRBG(int16 color, uint8 &r, uint8 &g, uint8 &b) -{ - SDL_GetRGB(color, _tmpscreen->format, &r, &g, &b); -} - -void OSystem_SDL::show_overlay() -{ - // hide the mouse - undraw_mouse(); - - _overlayVisible = true; - clear_overlay(); -} - -void OSystem_SDL::hide_overlay() -{ - // hide the mouse - undraw_mouse(); - - _overlayVisible = false; - _forceFull = true; -} - -void OSystem_SDL::clear_overlay() -{ - if (!_overlayVisible) - return; - - // hide the mouse - undraw_mouse(); - - // Clear the overlay by making the game screen "look through" everywhere. - SDL_Rect src, dst; - src.x = src.y = 0; - dst.x = dst.y = 1; - src.w = dst.w = _screenWidth; - src.h = dst.h = _screenHeight; - if (SDL_BlitSurface(_screen, &src, _tmpscreen, &dst) != 0) - error("SDL_BlitSurface failed: %s", SDL_GetError()); - - _forceFull = true; -} - -void OSystem_SDL::grab_overlay(int16 *buf, int pitch) -{ - if (!_overlayVisible) - return; - - if (_tmpscreen == NULL) - return; - - // hide the mouse - undraw_mouse(); - - if (SDL_LockSurface(_tmpscreen) == -1) - error("SDL_LockSurface failed: %s.\n", SDL_GetError()); - - int16 *src = (int16 *)_tmpscreen->pixels + _tmpScreenWidth + 1; - int h = _screenHeight; - do { - memcpy(buf, src, _screenWidth*2); - src += _tmpScreenWidth; - buf += pitch; - } while (--h); - - SDL_UnlockSurface(_tmpscreen); -} - -void OSystem_SDL::copy_rect_overlay(const int16 *buf, int pitch, int x, int y, int w, int h) -{ - if (!_overlayVisible) - return; - - if (_tmpscreen == NULL) - return; - - // Clip the coordinates - if (x < 0) { w+=x; buf-=x; x = 0; } - if (y < 0) { h+=y; buf-=y*pitch; y = 0; } - if (w > _screenWidth-x) { w = _screenWidth - x; } - if (h > _screenHeight-y) { h = _screenHeight - y; } - if (w <= 0 || h <= 0) - return; - - // Mark the modified region as dirty - cksum_valid = false; - add_dirty_rect(x, y, w, h); - - /* FIXME: undraw mouse only if the draw rect intersects with the mouse rect */ - undraw_mouse(); - - if (SDL_LockSurface(_tmpscreen) == -1) - error("SDL_LockSurface failed: %s.\n", SDL_GetError()); - - int16 *dst = (int16 *)_tmpscreen->pixels + (y+1) * _tmpScreenWidth + (x+1); - do { - memcpy(dst, buf, w*2); - dst += _tmpScreenWidth; - buf += pitch; - } while (--h); - - SDL_UnlockSurface(_tmpscreen); -} - - |