From 4e1269bd1077cb14bc4b5329cb86a166e5cbab6f Mon Sep 17 00:00:00 2001 From: huzongyao Date: Sat, 16 Nov 2019 14:18:45 +0800 Subject: [PATCH] fix some permission code --- .../main/java/nostalgia/framework/base/EmulatorActivity.java | 4 ++-- .../main/java/nostalgia/framework/base/OpenGLTestView.java | 4 ++-- .../src/main/java/nostalgia/framework/base/OpenGLView.java | 4 ++-- .../src/main/java/nostalgia/framework/base/SlotUtils.java | 4 ---- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/framework/src/main/java/nostalgia/framework/base/EmulatorActivity.java b/framework/src/main/java/nostalgia/framework/base/EmulatorActivity.java index 109f59a..faff90f 100644 --- a/framework/src/main/java/nostalgia/framework/base/EmulatorActivity.java +++ b/framework/src/main/java/nostalgia/framework/base/EmulatorActivity.java @@ -1,6 +1,5 @@ package nostalgia.framework.base; -import android.Manifest; import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; @@ -24,6 +23,7 @@ import android.widget.FrameLayout; import android.widget.Toast; +import com.blankj.utilcode.constant.PermissionConstants; import com.blankj.utilcode.util.PermissionUtils; import java.io.File; @@ -710,7 +710,7 @@ private void onGameBackToPast() { } private void saveScreenshotWithPermission() { - PermissionUtils.permission(Manifest.permission.WRITE_EXTERNAL_STORAGE) + PermissionUtils.permission(PermissionConstants.STORAGE) .callback(new PermissionUtils.SimpleCallback() { @Override public void onGranted() { diff --git a/framework/src/main/java/nostalgia/framework/base/OpenGLTestView.java b/framework/src/main/java/nostalgia/framework/base/OpenGLTestView.java index b5572fd..4c31050 100644 --- a/framework/src/main/java/nostalgia/framework/base/OpenGLTestView.java +++ b/framework/src/main/java/nostalgia/framework/base/OpenGLTestView.java @@ -137,8 +137,8 @@ public void onDrawFrame(GL10 gl) { @Override public void onSurfaceChanged(GL10 gl, int width, int height) { - Matrix.orthoM(projMatrix, 0, -width / 2, +width / 2, - -height / 2, +height / 2, -2f, 2f); + Matrix.orthoM(projMatrix, 0, -width / 2f, +width / 2f, + -height / 2f, +height / 2f, -2f, 2f); screenWidth = width; screenHeight = height; GLES20.glViewport(0, 0, width, height); diff --git a/framework/src/main/java/nostalgia/framework/base/OpenGLView.java b/framework/src/main/java/nostalgia/framework/base/OpenGLView.java index e23cd38..0307c05 100644 --- a/framework/src/main/java/nostalgia/framework/base/OpenGLView.java +++ b/framework/src/main/java/nostalgia/framework/base/OpenGLView.java @@ -178,8 +178,8 @@ public void onSurfaceChanged(GL10 unused, int width, int height) { ViewPort vp = ViewUtils.loadOrComputeViewPort(context, emulator, width, height, paddingLeft, paddingTop, false); viewPort = vp; - Matrix.orthoM(projMatrix, 0, -vp.width / 2, +vp.width / 2, -vp.height / 2, - +vp.height / 2, -2f, 2f); + Matrix.orthoM(projMatrix, 0, -vp.width / 2f, +vp.width / 2f, -vp.height / 2f, + +vp.height / 2f, -2f, 2f); int nvpy = (height - vp.y - vp.height); GLES20.glViewport(vp.x, nvpy, vp.width, vp.height); initQuadCoordinates(emulator, vp.width, vp.height); diff --git a/framework/src/main/java/nostalgia/framework/base/SlotUtils.java b/framework/src/main/java/nostalgia/framework/base/SlotUtils.java index d5a4f4e..ba3ce29 100644 --- a/framework/src/main/java/nostalgia/framework/base/SlotUtils.java +++ b/framework/src/main/java/nostalgia/framework/base/SlotUtils.java @@ -78,13 +78,9 @@ public static SlotInfo getSlot(String baseDir, String md5, int idx) { bitmap.getConfig()); Canvas c = new Canvas(newScreenshot); float[] matrix = new float[]{ - 0.299f, 0.587f, 0.114f, 0, 0, - 0.299f, 0.587f, 0.114f, 0, 0, - 0.299f, 0.587f, 0.114f, 0, 0, - 0, 0, 0, 0.5f, 0 }; Paint paint = new Paint();