mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-12 03:54:28 +02:00
Debug: max. texture size
This commit is contained in:
@@ -470,6 +470,7 @@ public class DebugHelper {
|
||||
float density = context.getResources().getDisplayMetrics().density;
|
||||
sb.append(String.format("Density 1dp=%f\r\n", density));
|
||||
sb.append(String.format("Resolution: %.2f x %.2f dp\r\n", dim.x / density, dim.y / density));
|
||||
sb.append(String.format("Max. texture=%d\r\n", Helper.getMaxTextureSize()));
|
||||
|
||||
Configuration config = context.getResources().getConfiguration();
|
||||
|
||||
|
||||
@@ -186,6 +186,10 @@ import java.util.regex.Pattern;
|
||||
|
||||
import javax.mail.internet.ContentType;
|
||||
import javax.mail.internet.ParseException;
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.egl.EGLContext;
|
||||
import javax.microedition.khronos.egl.EGLDisplay;
|
||||
|
||||
public class Helper {
|
||||
private static Integer targetSdk = null;
|
||||
@@ -920,6 +924,35 @@ public class Helper {
|
||||
|
||||
// View
|
||||
|
||||
static int getMaxTextureSize() {
|
||||
int max = -1;
|
||||
try {
|
||||
EGL10 egl = (EGL10) EGLContext.getEGL();
|
||||
EGLDisplay d = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
|
||||
|
||||
int[] version = new int[2];
|
||||
egl.eglInitialize(d, version);
|
||||
|
||||
int[] count = new int[1];
|
||||
egl.eglGetConfigs(d, null, 0, count);
|
||||
|
||||
EGLConfig[] configs = new EGLConfig[count[0]];
|
||||
egl.eglGetConfigs(d, configs, count[0], count);
|
||||
|
||||
int[] textureSizeWidth = new int[1];
|
||||
|
||||
for (int i = 0; i < count[0]; i++) {
|
||||
egl.eglGetConfigAttrib(d, configs[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSizeWidth);
|
||||
if (textureSizeWidth[0] > max)
|
||||
max = textureSizeWidth[0];
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
|
||||
static int getActionBarHeight(Context context) {
|
||||
return Helper.dp2pixels(context, 56);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user