From 655d790a6ee145038bd2f38ac3624d5b5abc09ca Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 18 Feb 2020 22:42:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../read/page/delegate/SimulationPageDelegate.kt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/SimulationPageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/SimulationPageDelegate.kt index c8ee8b55c..6e9050b07 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/SimulationPageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/SimulationPageDelegate.kt @@ -237,9 +237,9 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi bitmap: Bitmap? ) { bitmap ?: return - val i = (mBezierStart1.x + mBezierControl1.x).toInt() / 2 + val i = ((mBezierStart1.x + mBezierControl1.x) / 2).toInt() val f1 = abs(i - mBezierControl1.x) - val i1 = (mBezierStart2.y + mBezierControl2.y).toInt() / 2 + val i1 = ((mBezierStart2.y + mBezierControl2.y) / 2).toInt() val f2 = abs(i1 - mBezierControl2.y) val f3 = min(f1, f2) mPath1.reset() @@ -253,7 +253,7 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi val left: Int val right: Int if (mIsRtOrLb) { - left = (mBezierStart1.x - 1).toInt() + left = mBezierStart1.x.toInt() - 1 right = (mBezierStart1.x + f3 + 1).toInt() mFolderShadowDrawable = mFolderShadowDrawableLR!! } else { @@ -262,14 +262,13 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi mFolderShadowDrawable = mFolderShadowDrawableRL!! } canvas.save() - try { + kotlin.runCatching { canvas.clipPath(mPath0) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { canvas.clipPath(mPath1) } else { canvas.clipPath(mPath1, Region.Op.INTERSECT) } - } catch (ignored: Exception) { } mPaint.colorFilter = mColorMatrixFilter val dis = hypot( @@ -290,8 +289,8 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi mPaint.colorFilter = null canvas.rotate(mDegrees, mBezierStart1.x, mBezierStart1.y) mFolderShadowDrawable.setBounds( - left, mBezierStart1.y.toInt(), right, - (mBezierStart1.y + mMaxLength).toInt() + left, mBezierStart1.y.toInt(), + right, (mBezierStart1.y + mMaxLength).toInt() ) mFolderShadowDrawable.draw(canvas) canvas.restore()