mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-30 09:43:45 +01:00
Android: Fix bug where the surface size could be wrong after task switching and automatic recreation
This commit is contained in:
1 parent
7b4cf8516b
commit
2de5e2b5c0
2 files changed
+14
-17
No files matched your search
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in new issue
Block a user