aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics
diff options
context:
space:
mode:
authorrsn88872019-08-13 00:50:59 -0500
committerrsn88872019-08-13 20:54:59 -0500
commitafd360703e612daa21624e57154cee920265dcda (patch)
tree18472921385fbe317e64ca87b3363c8aabae90ef /backends/graphics
parente33c80eaba869d189b0efab86bc8ac2b692d2023 (diff)
downloadscummvm-rg350-afd360703e612daa21624e57154cee920265dcda.tar.gz
scummvm-rg350-afd360703e612daa21624e57154cee920265dcda.tar.bz2
scummvm-rg350-afd360703e612daa21624e57154cee920265dcda.zip
VITA: Use activeArea rectangle also on Vita
Diffstat (limited to 'backends/graphics')
-rw-r--r--backends/graphics/psp2sdl/psp2sdl-graphics.cpp78
-rw-r--r--backends/graphics/psp2sdl/psp2sdl-graphics.h2
2 files changed, 8 insertions, 72 deletions
diff --git a/backends/graphics/psp2sdl/psp2sdl-graphics.cpp b/backends/graphics/psp2sdl/psp2sdl-graphics.cpp
index 5e6afc2a57..f6333e2124 100644
--- a/backends/graphics/psp2sdl/psp2sdl-graphics.cpp
+++ b/backends/graphics/psp2sdl/psp2sdl-graphics.cpp
@@ -79,14 +79,6 @@ PSP2SdlGraphicsManager::PSP2SdlGraphicsManager(SdlEventSource *sdlEventSource, S
_vitatex_hwscreen(nullptr),
_sdlpixels_hwscreen(nullptr) {
- // do aspect ratio correction in hardware on the Vita
- if (_videoMode.aspectRatioCorrection == true) {
- _hardwareAspectRatioCorrection = true;
- } else {
- _hardwareAspectRatioCorrection = false;
- }
- _videoMode.aspectRatioCorrection = false;
-
// shader number 0 is the entry NONE (no shader)
const OSystem::GraphicsMode *p = s_supportedShadersPSP2;
_numShaders = 0;
@@ -100,6 +92,9 @@ PSP2SdlGraphicsManager::PSP2SdlGraphicsManager(SdlEventSource *sdlEventSource, S
}
_shaders[0] = NULL;
+
+ /* Vita display size is always 960x544 (that's just the hardware) */
+ handleResize(960, 544);
}
PSP2SdlGraphicsManager::~PSP2SdlGraphicsManager() {
@@ -214,27 +209,6 @@ void PSP2SdlGraphicsManager::updateShader() {
}
}
-void PSP2SdlGraphicsManager::setAspectRatioCorrection(bool enable) {
- Common::StackLock lock(_graphicsMutex);
-
- if (_oldVideoMode.setup && _hardwareAspectRatioCorrection == enable)
- return;
-
- if (_transactionMode == kTransactionActive) {
- _videoMode.aspectRatioCorrection = false;
- _hardwareAspectRatioCorrection = enable;
- // erase the screen for both buffers
- if (_vitatex_hwscreen) {
- for (int i = 0; i <= 10; i++) {
- vita2d_start_drawing();
- vita2d_clear_screen();
- vita2d_end_drawing();
- vita2d_swap_buffers();
- }
- }
- }
-}
-
SDL_Surface *PSP2SdlGraphicsManager::SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) {
SDL_Surface *screen = SurfaceSdlGraphicsManager::SDL_SetVideoMode(width, height, bpp, flags);
@@ -254,49 +228,13 @@ void PSP2SdlGraphicsManager::SDL_UpdateRects(SDL_Surface *screen, int numrects,
int screenH = screen->h;
int screenW = screen->w;
- bool fullscreen = _videoMode.fullscreen;
- bool aspectRatioCorrection = _hardwareAspectRatioCorrection;
-
- const int dispW = 960;
- const int dispH = 544;
-
- int x, y, w, h;
- float sx, sy;
- float ratio = (float)screenW / (float)screenH;
-
- if (aspectRatioCorrection && (screenH == 200 || screenH == 400)) {
- ratio = 4.0 / 3.0;
- }
-
- if (fullscreen || screenH >= dispH) {
- h = dispH;
- w = h * ratio;
- } else {
- if (screenH <= dispH / 2 && screenW <= dispW / 2) {
- // Use Vita hardware 2x scaling if the picture is really small
- // this uses the current shader and filtering mode
- h = screenH * 2;
- w = screenW * 2;
- } else {
- h = screenH;
- w = screenW;
- }
- if (aspectRatioCorrection && (screenH == 200 || screenH == 400)) {
- // stretch the height only if it fits, otherwise make the width smaller
- if (((float)w * (1.0 / ratio)) <= (float)dispH) {
- h = w * (1.0 / ratio);
- } else {
- w = h * ratio;
- }
- }
- }
-
- x = (dispW - w) / 2;
- y = (dispH - h) / 2;
- sx = (float)w / (float)screenW;
- sy = (float)h / (float)screenH;
+ int x = _activeArea.drawRect.left;
+ int y = _activeArea.drawRect.top;
+ float sx = _activeArea.drawRect.width() / (float)screenW;
+ float sy = _activeArea.drawRect.height() / (float)screenH;
if (_vitatex_hwscreen) {
vita2d_start_drawing();
+ vita2d_clear_screen();
vita2d_draw_texture_scale(_vitatex_hwscreen, x, y, sx, sy);
vita2d_end_drawing();
vita2d_swap_buffers();
diff --git a/backends/graphics/psp2sdl/psp2sdl-graphics.h b/backends/graphics/psp2sdl/psp2sdl-graphics.h
index 3264323d1e..715099620a 100644
--- a/backends/graphics/psp2sdl/psp2sdl-graphics.h
+++ b/backends/graphics/psp2sdl/psp2sdl-graphics.h
@@ -40,12 +40,10 @@ protected:
virtual bool hotswapGFXMode() override;
virtual void updateShader() override;
- virtual void setAspectRatioCorrection(bool enable) override;
virtual SDL_Surface *SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) override;
virtual void SDL_UpdateRects(SDL_Surface *screen, int numrects, SDL_Rect *rects) override;
void PSP2_UpdateFiltering();
- bool _hardwareAspectRatioCorrection;
vita2d_texture *_vitatex_hwscreen;
void *_sdlpixels_hwscreen;
vita2d_shader *_shaders[6];