From 7ce386a7b87efb72a67f64ffd4548cd815315350 Mon Sep 17 00:00:00 2001 From: tarsin Date: Sat, 24 Dec 2022 09:42:16 +0800 Subject: [PATCH] Cleanup OpenGL usage Our bitmap/hwui may use vulkan ctx --- .../ui/reader/viewer/ReaderPageImageView.kt | 2 - .../eu/kanade/tachiyomi/util/system/GLUtil.kt | 47 ------------------- 2 files changed, 49 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/util/system/GLUtil.kt diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderPageImageView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderPageImageView.kt index bb4274a0b..480eef388 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderPageImageView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderPageImageView.kt @@ -28,7 +28,6 @@ import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.Companion.E import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.Companion.SCALE_TYPE_CENTER_INSIDE import com.github.chrisbanes.photoview.PhotoView import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonSubsamplingImageView -import eu.kanade.tachiyomi.util.system.GLUtil import eu.kanade.tachiyomi.util.system.animatorDurationScale import eu.kanade.tachiyomi.util.view.isVisibleOnScreen import java.io.InputStream @@ -220,7 +219,6 @@ open class ReaderPageImageView @JvmOverloads constructor( } else { SubsamplingScaleImageView(context) }.apply { - setMaxTileSize(GLUtil.maxTextureSize) setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_CENTER) setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_INSIDE) setMinimumTileDpi(180) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/GLUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/GLUtil.kt deleted file mode 100644 index 59876e002..000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/GLUtil.kt +++ /dev/null @@ -1,47 +0,0 @@ -package eu.kanade.tachiyomi.util.system - -import javax.microedition.khronos.egl.EGL10 -import javax.microedition.khronos.egl.EGLConfig -import javax.microedition.khronos.egl.EGLContext -import kotlin.math.max - -object GLUtil { - val maxTextureSize: Int by lazy { - // Get EGL Display - val egl = EGLContext.getEGL() as EGL10 - val display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY) - - // Initialise - val version = IntArray(2) - egl.eglInitialize(display, version) - - // Query total number of configurations - val totalConfigurations = IntArray(1) - egl.eglGetConfigs(display, null, 0, totalConfigurations) - - // Query actual list configurations - val configurationsList = arrayOfNulls(totalConfigurations[0]) - egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations) - - val textureSize = IntArray(1) - var maximumTextureSize = 0 - - // Iterate through all the configurations to located the maximum texture size - for (i in 0 until totalConfigurations[0]) { - // Only need to check for width since opengl textures are always squared - egl.eglGetConfigAttrib(display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize) - - // Keep track of the maximum texture size - if (maximumTextureSize < textureSize[0]) maximumTextureSize = textureSize[0] - } - - // Release - egl.eglTerminate(display) - - // Return largest texture size found, or default - max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION) - } -} - -// Safe minimum default size -private const val IMAGE_MAX_BITMAP_DIMENSION = 2048