From 9e4cdcd7027c90b10e15fa77bc30bc1f744fcd79 Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 1 Nov 2019 15:47:07 +0800 Subject: [PATCH] up --- .../app/ui/widget/page/curl/CurlRenderer.kt | 41 ++----------------- .../app/ui/widget/page/curl/CurlView.kt | 8 ---- .../page/delegate/SimulationPageDelegate.kt | 1 - 3 files changed, 4 insertions(+), 46 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/page/curl/CurlRenderer.kt b/app/src/main/java/io/legado/app/ui/widget/page/curl/CurlRenderer.kt index c240856be..d2125b1f3 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/curl/CurlRenderer.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/curl/CurlRenderer.kt @@ -67,10 +67,6 @@ class CurlRenderer(private val mObserver: Observer) : GLSurfaceView.Renderer { gl.glClear(GL10.GL_COLOR_BUFFER_BIT) gl.glLoadIdentity() - if (USE_PERSPECTIVE_PROJECTION) { - gl.glTranslatef(0f, 0f, -6f) - } - for (i in mCurlMeshes.indices) { mCurlMeshes[i].onDrawFrame(gl) } @@ -90,14 +86,10 @@ class CurlRenderer(private val mObserver: Observer) : GLSurfaceView.Renderer { gl.glMatrixMode(GL10.GL_PROJECTION) gl.glLoadIdentity() - if (USE_PERSPECTIVE_PROJECTION) { - GLU.gluPerspective(gl, 20f, width.toFloat() / height, .1f, 100f) - } else { - GLU.gluOrtho2D( - gl, mViewRect.left, mViewRect.right, - mViewRect.bottom, mViewRect.top - ) - } + GLU.gluOrtho2D( + gl, mViewRect.left, mViewRect.right, + mViewRect.bottom, mViewRect.top + ) gl.glMatrixMode(GL10.GL_MODELVIEW) gl.glLoadIdentity() @@ -124,29 +116,6 @@ class CurlRenderer(private val mObserver: Observer) : GLSurfaceView.Renderer { mCurlMeshes.remove(mesh) } - /** - * Change background/clear color. - */ - fun setBackgroundColor(color: Int) { - mBackgroundColor = color - } - - /** - * Set margins or padding. Note: margins are proportional. Meaning a value - * of .1f will produce a 10% margin. - */ - @Synchronized - fun setMargins( - left: Float, top: Float, right: Float, - bottom: Float - ) { - mMargins.left = left - mMargins.top = top - mMargins.right = right - mMargins.bottom = bottom - updatePageRects() - } - /** * Sets visible page count to one or two. Should be either SHOW_ONE_PAGE or * SHOW_TWO_PAGES. @@ -242,7 +211,5 @@ class CurlRenderer(private val mObserver: Observer) : GLSurfaceView.Renderer { // Constants for changing view mode. const val SHOW_ONE_PAGE = 1 const val SHOW_TWO_PAGES = 2 - // Set to true for checking quickly how perspective projection looks. - private const val USE_PERSPECTIVE_PROJECTION = false } } diff --git a/app/src/main/java/io/legado/app/ui/widget/page/curl/CurlView.kt b/app/src/main/java/io/legado/app/ui/widget/page/curl/CurlView.kt index a6089c4bc..2b62974ef 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/curl/CurlView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/curl/CurlView.kt @@ -410,14 +410,6 @@ class CurlView : GLSurfaceView, View.OnTouchListener, CurlRenderer.Observer { mEnableTouchPressure = enableTouchPressure } - /** - * Set margins (or padding). Note: margins are proportional. Meaning a value - * of .1f will produce a 10% margin. - */ - fun setMargins(left: Float, top: Float, right: Float, bottom: Float) { - mRenderer.setMargins(left, top, right, bottom) - } - /** * Setter for whether left side page is rendered. This is useful mostly for * situations where right (main) page is aligned to left side of screen and diff --git a/app/src/main/java/io/legado/app/ui/widget/page/delegate/SimulationPageDelegate.kt b/app/src/main/java/io/legado/app/ui/widget/page/delegate/SimulationPageDelegate.kt index d7ee69211..e28b63509 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/delegate/SimulationPageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/delegate/SimulationPageDelegate.kt @@ -56,7 +56,6 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi private inner class SizeChangedObserver : CurlView.SizeChangedObserver { override fun onSizeChanged(width: Int, height: Int) { pageView.curlView?.setViewMode(CurlView.SHOW_ONE_PAGE) - pageView.curlView?.setMargins(0f, 0f, 0f, 0f) } } } \ No newline at end of file