mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-01 20:15:04 -05:00
Retain GLUtil.maxTextureSize
This commit is contained in:
parent
ec4e631760
commit
ee20787c5e
1 changed files with 30 additions and 37 deletions
|
@ -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
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue