Permalink
Browse files

front: Fixed additional resolution issue in portrait mode.

Also, made the ratio for 16:9 to 4:3 be a dynamic value instead of
hardcoded.
  • Loading branch information...
fzurita committed Dec 17, 2015
1 parent ce821fa commit 5a5b0920bf142d6c9a22207d068f2efbf53d7424
@@ -14,6 +14,7 @@
import paulscode.android.mupen64plusae.util.Plugin;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.text.TextUtils;
public class GamePrefs
@@ -175,7 +176,7 @@
public int videoRenderWidth;
/** The height of the OpenGL rendering context, in pixels. */
public final int videoRenderHeight;
public int videoRenderHeight;
/** The zoom value applied to the viewing surface, in percent. */
public final int videoSurfaceZoom;
@@ -331,8 +332,20 @@ public GamePrefs( Context context, String romMd5, String crc, String headerName,
if(globalPrefs.mStretch)
{
float newWidth = videoRenderWidth * 1.333333f;
videoRenderWidth = Math.round(newWidth);
//If we are in stretch mode we have to increase the approppriate dimension by the corresponding
//ratio to make it full screen
if(globalPrefs.displayOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT ||
globalPrefs.displayOrientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT)
{
float newWidth = videoRenderHeight * globalPrefs.heightRatio;
videoRenderHeight = Math.round(newWidth);
}
else
{
float newWidth = videoRenderWidth * globalPrefs.widthRatio;
videoRenderWidth = Math.round(newWidth);
}
}
videoSurfaceZoom = getSafeInt( mPreferences, "displayZoom", 100 );
@@ -181,6 +181,12 @@
/** The height of the viewing surface, in pixels with the correct aspect ratio. */
public final int videoSurfaceHeightOriginal;
/** Screen width ratio from 16:9 to 4:3*/
public final float widthRatio;
/** Screen width ratio from 16:9 to 4:3*/
public final float heightRatio;
/** The action bar transparency value. */
public final int displayActionBarTransparency;
@@ -462,13 +468,15 @@ else if( AppData.IS_KITKAT && isImmersiveModeEnabled )
stretchWidth = dimensions.x;
stretchHeight = dimensions.y;
}
float aspect = 0.75f; // TODO: Handle PAL
boolean isLetterboxed = ( (float) stretchHeight / (float) stretchWidth ) > aspect;
int originalWidth = isLetterboxed ? stretchWidth : Math.round( (float) stretchHeight / aspect );
int originalHeight = isLetterboxed ? Math.round( (float) stretchWidth * aspect ) : stretchHeight;
String scaling = mPreferences.getString( "displayScaling", "original" );
widthRatio = (float)stretchWidth/(float)originalWidth;
heightRatio = (float)stretchHeight/(float)originalHeight;
videoSurfaceWidthOriginal = originalWidth;
videoSurfaceHeightOriginal = originalHeight;

0 comments on commit 5a5b092

Please sign in to comment.