diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index becc982512..d4930f8f39 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -362,10 +362,10 @@ static int deviceType; // Should only be used for display detection during startup (for config defaults etc) // This is the ACTUAL display size, not the hardware scaled display size. -static int display_dpi_x; -static int display_dpi_y; static int display_xres; static int display_yres; +static int display_dpi_x; +static int display_dpi_y; static int backbuffer_format; // Android PixelFormat enum static int desiredBackbufferSizeX; @@ -722,10 +722,10 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_backbufferResize(JNIEnv pixel_in_dps_x = (float)pixel_xres / dp_xres; pixel_in_dps_y = (float)pixel_yres / dp_yres; + ILOG("g_dpi=%f g_dpi_scale_x=%f g_dpi_scale_y=%f", g_dpi, g_dpi_scale_x, g_dpi_scale_y); ILOG("dp_xscale=%f dp_yscale=%f", dp_xscale, dp_yscale); ILOG("dp_xres=%d dp_yres=%d", dp_xres, dp_yres); ILOG("pixel_xres=%d pixel_yres=%d", pixel_xres, pixel_yres); - ILOG("g_dpi=%f g_dpi_scale_x=%f g_dpi_scale_y=%f", g_dpi, g_dpi_scale_x, g_dpi_scale_y); NativeResized(); } diff --git a/android/src/org/ppsspp/ppsspp/NativeActivity.java b/android/src/org/ppsspp/ppsspp/NativeActivity.java index d9c193a5a2..76c83124a5 100644 --- a/android/src/org/ppsspp/ppsspp/NativeActivity.java +++ b/android/src/org/ppsspp/ppsspp/NativeActivity.java @@ -458,13 +458,11 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C } } - // @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { Log.w(TAG, "Surface changed. Resolution: " + width + "x" + height + " Format: " + format); NativeApp.backbufferResize(width, height, format); mSurface = holder.getSurface(); - if (!javaGL) { // If we got a surface, this starts the thread. If not, it doesn't. if (mSurface == null) { @@ -475,6 +473,17 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C } } + @Override + public void surfaceDestroyed(SurfaceHolder holder) { + mSurface = null; + Log.w(TAG, "Surface destroyed."); + if (!javaGL) { + joinRenderLoopThread(); + } + // Autosize the next created surface. + holder.setSizeFromLayout(); + } + // Invariants: After this, mRenderLoopThread will be set, and the thread will be running. protected synchronized void ensureRenderLoop() { if (javaGL) { @@ -515,18 +524,6 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C } } - @Override - public void surfaceDestroyed(SurfaceHolder holder) { - if (javaGL) { - Log.e(TAG, "JavaGL - should not get into surfaceDestroyed."); - return; - } - - mSurface = null; - Log.w(TAG, "Surface destroyed."); - joinRenderLoopThread(); - } - @TargetApi(19) void setupSystemUiCallback() { getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(new OnSystemUiVisibilityChangeListener() {