diff --git a/app/src/main/java/eu/faircode/email/DebugHelper.java b/app/src/main/java/eu/faircode/email/DebugHelper.java index b15591bf5e..59926f0700 100644 --- a/app/src/main/java/eu/faircode/email/DebugHelper.java +++ b/app/src/main/java/eu/faircode/email/DebugHelper.java @@ -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(); diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java index 926da8d41b..8ad85e6573 100644 --- a/app/src/main/java/eu/faircode/email/Helper.java +++ b/app/src/main/java/eu/faircode/email/Helper.java @@ -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); }