Permalink
Browse files

Fix blackscreen when resolution is set to auto. Fixes #10081

  • Loading branch information...
hrydgard committed Nov 10, 2017
1 parent 9519b89 commit 08041d8775b3cb3613b0adb66424a355f46d55a8
Showing with 5 additions and 3 deletions.
  1. +5 −3 android/src/org/ppsspp/ppsspp/NativeActivity.java
@@ -518,7 +518,7 @@ public void onCreate(Bundle savedInstanceState) {
}
}
Point desiredSize = new Point();
private Point desiredSize = new Point();
@Override
public void surfaceCreated(SurfaceHolder holder) {
@@ -527,6 +527,8 @@ public void surfaceCreated(SurfaceHolder holder) {
Log.d(TAG, "Surface created. pixelWidth=" + pixelWidth + ", pixelHeight=" + pixelHeight);
NativeApp.setDisplayParameters(pixelWidth, pixelHeight, (int)densityDpi, refreshRate);
getDesiredBackbufferSize(desiredSize);
// Note that desiredSize might be 0,0 here - but that's fine when calling setFixedSize! It means auto.
Log.d(TAG, "Setting fixed size " + desiredSize.x + " x " + desiredSize.y);
if (mGLSurfaceView != null) {
mGLSurfaceView.getHolder().setFixedSize(desiredSize.x, desiredSize.y);
@@ -537,8 +539,8 @@ public void surfaceCreated(SurfaceHolder holder) {
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
if (width != desiredSize.x || height != desiredSize.y) {
Log.w(TAG, "Surface changed but not to desired size. Ignoring.");
if (desiredSize.x > 0 && desiredSize.y > 0 && (width != desiredSize.x || height != desiredSize.y)) {
Log.w(TAG, "Surface changed but not to desired size. Ignoring. width=" + width + " height=" + height + " desWidth=" + desiredSize.x + " desHeight=" + desiredSize.y);
return;
}
Log.w(TAG, "Surface changed. Resolution: " + width + "x" + height + " Format: " + format);

0 comments on commit 08041d8

Please sign in to comment.