diff options
author | Travis Howell | 2003-06-22 12:30:58 +0000 |
---|---|---|
committer | Travis Howell | 2003-06-22 12:30:58 +0000 |
commit | 2a31d107c90190dfc21d2b0d7f2e727d739bb034 (patch) | |
tree | 962ab672bd2ffc94e36aafcb77e025b7518542ba /backends/sdl | |
parent | e7c3fae1e8ca04dacd8ef4aebd201c275a974d05 (diff) | |
download | scummvm-rg350-2a31d107c90190dfc21d2b0d7f2e727d739bb034.tar.gz scummvm-rg350-2a31d107c90190dfc21d2b0d7f2e727d739bb034.tar.bz2 scummvm-rg350-2a31d107c90190dfc21d2b0d7f2e727d739bb034.zip |
Aspect ratio works with all sclaers in opengl backend
svn-id: r8607
Diffstat (limited to 'backends/sdl')
-rw-r--r-- | backends/sdl/sdl_gl.cpp | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/backends/sdl/sdl_gl.cpp b/backends/sdl/sdl_gl.cpp index 949baf7b1d..b328114bc7 100644 --- a/backends/sdl/sdl_gl.cpp +++ b/backends/sdl/sdl_gl.cpp @@ -199,8 +199,8 @@ normal_mode:; } else { // SDL backend - _hwscreen = SDL_SetVideoMode(_screenWidth * _scaleFactor, _screenHeight * _scaleFactor, 16, - _full_screen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE + _hwscreen = SDL_SetVideoMode(_screenWidth * _scaleFactor, (_adjustAspectRatio ? 240 : _screenHeight) * _scaleFactor, 16, + _full_screen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE ); if (_hwscreen == NULL) error("_hwscreen failed"); @@ -421,7 +421,7 @@ void OSystem_SDL_OpenGL::update_screen() { fb2gl.display(); } else { // SDL backend - if (_scaler_proc == Normal1x) { + if (_scaler_proc == Normal1x && !_adjustAspectRatio) { SDL_Surface *target = _overlayVisible ? _tmpscreen : _screen; for (r = _dirty_rect_list; r != last_rect; ++r) { dst = *r; @@ -454,6 +454,8 @@ void OSystem_SDL_OpenGL::update_screen() { for (r = _dirty_rect_list; r != last_rect; ++r) { register int dst_y = r->y + _currentShakePos; register int dst_h = 0; + register int orig_dst_y = 0; + if (dst_y < _screenHeight) { dst_h = r->h; if (dst_h > _screenHeight - dst_y) @@ -461,6 +463,11 @@ void OSystem_SDL_OpenGL::update_screen() { dst_y *= _scaleFactor; + if (_adjustAspectRatio) { + orig_dst_y = dst_y; + dst_y = real2Aspect(dst_y); + } + _scaler_proc((byte *)_tmpscreen->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch, (byte *)_hwscreen->pixels + r->x * 2 * _scaleFactor + dst_y * dstPitch, dstPitch, r->w, dst_h); } @@ -469,6 +476,9 @@ void OSystem_SDL_OpenGL::update_screen() { r->y = dst_y; r->w *= _scaleFactor; r->h = dst_h * _scaleFactor; + + if (_adjustAspectRatio && orig_dst_y / _scaleFactor < _screenHeight) + r->h = stretch200To240((uint8 *) _hwscreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y); } SDL_UnlockSurface(_tmpscreen); @@ -479,7 +489,7 @@ void OSystem_SDL_OpenGL::update_screen() { // This is necessary if shaking is active. if (_forceFull) { _dirty_rect_list[0].y = 0; - _dirty_rect_list[0].h = _screenHeight * _scaleFactor; + _dirty_rect_list[0].h = (_adjustAspectRatio ? 240 : _screenHeight) * _scaleFactor; } // Finally, blit all our changes to the screen @@ -541,28 +551,31 @@ uint32 OSystem_SDL_OpenGL::property(int param, Property *value) { return 1; } else if (param == PROP_TOGGLE_ASPECT_RATIO) { - if (!_usingOpenGL) { - _usingOpenGL = true; - _mode = GFX_NORMAL; - hotswap_gfx_mode(); - } _adjustAspectRatio ^= true; - if (_adjustAspectRatio) { - // Don't use the whole screen (black borders) - fb2gl.init(0, 0, 0, 15, _glFlags); - _glScreenStart = 20; - SDL_FillRect(tmpSurface, &tmpBlackRect, 0); - fb2gl.blit16(tmpSurface, 1, &tmpBlackRect, 0, 0); + if (_usingOpenGL) { + if (_adjustAspectRatio) { + // Don't use the whole screen (black borders) + fb2gl.init(0, 0, 0, 15, _glFlags); + _glScreenStart = 20; + SDL_FillRect(tmpSurface, &tmpBlackRect, 0); + fb2gl.blit16(tmpSurface, 1, &tmpBlackRect, 0, 0); + } else { + // Use the whole screen + fb2gl.init(0, 0, 0, 70, _glFlags); + _glScreenStart = 0; + } + + SDL_Rect full = {0, 0, _screenWidth, _screenHeight}; + fb2gl.blit16(_tmpscreen, 1, &full, 0, _glScreenStart); + fb2gl.display(); } else { - // Use the whole screen - fb2gl.init(0, 0, 0, 70, _glFlags); - _glScreenStart = 0; + if (_screenHeight == 200) { + assert(_hwscreen != 0); + hotswap_gfx_mode(); + } } - SDL_Rect full = {0, 0, _screenWidth, _screenHeight}; - fb2gl.blit16(_tmpscreen, 1, &full, 0, _glScreenStart); - fb2gl.display(); } else if (param == PROP_SET_GFX_MODE) { if (value->gfx_mode > 10) { // OpenGL modes |