diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/graphics.cpp | 16 | ||||
-rw-r--r-- | src/openglgraphics.cpp | 1 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp index 553f33ab..d36d2fa7 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -72,19 +72,21 @@ bool Graphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel) SDL_FreeSurface(mTarget); mTarget = 0; + // Calculate scaling factor + mScale = std::max(w / 640, h / 360); + mScreenSurface = SDL_SetVideoMode(w, h, bpp, displayFlags); const SDL_PixelFormat& fmt = *(mScreenSurface->format); - setTarget(SDL_CreateRGBSurface(SDL_SWSURFACE, 640, 360, fmt.BitsPerPixel, fmt.Rmask, fmt.Gmask, fmt.Bmask, 0)); + setTarget(SDL_CreateRGBSurface(SDL_SWSURFACE, + w / mScale, h / mScale, + fmt.BitsPerPixel, + fmt.Rmask, fmt.Gmask, fmt.Bmask, 0)); if (!mTarget) return false; - mWidth = 640; - mHeight = 360; - - // Calculate scaling factor - mScale = std::min(w / 640, h / 360); - + mWidth = mTarget->w; + mHeight = mTarget->h; mBpp = bpp; mFullscreen = fs; mHWAccel = hwaccel; diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index 14c32a95..65e24e51 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -74,7 +74,6 @@ bool OpenGLGraphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel) const double targetRatio = (double) 640 / 360; // 1.77778 const double requestedRatio = (double) w / h; - mScale = 1; if (requestedRatio < targetRatio) { // Screen is higher / narrower than target aspect ratio: calculate |