Retain GLUtil.maxTextureSize

This commit is contained in:
arkon 2021-09-05 14:34:54 -04:00
parent ec4e631760
commit ee20787c5e

View file

@ -5,13 +5,8 @@ import javax.microedition.khronos.egl.EGLConfig
import javax.microedition.khronos.egl.EGLContext import javax.microedition.khronos.egl.EGLContext
import kotlin.math.max import kotlin.math.max
class GLUtil private constructor() { object GLUtil {
companion object { val maxTextureSize: Int by lazy {
// Safe minimum default size
private const val IMAGE_MAX_BITMAP_DIMENSION = 2048
val maxTextureSize: Int
get() {
// Get EGL Display // Get EGL Display
val egl = EGLContext.getEGL() as EGL10 val egl = EGLContext.getEGL() as EGL10
val display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY) val display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY)
@ -44,11 +39,9 @@ class GLUtil private constructor() {
egl.eglTerminate(display) egl.eglTerminate(display)
// Return largest texture size found, or default // Return largest texture size found, or default
return max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION) max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION)
} }
} }
init { // Safe minimum default size
throw InstantiationException("This class is not for instantiation") private const val IMAGE_MAX_BITMAP_DIMENSION = 2048
}
}