diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt index bdee00d0c..ef26ab11a 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt @@ -290,11 +290,11 @@ data class TextPage( fun draw(view: ContentTextView, canvas: Canvas, relativeOffset: Float) { if (AppConfig.optimizeRender) { render(view) - canvas.withTranslation(0f, relativeOffset + paddingTop) { + canvas.withTranslation(0f, relativeOffset) { canvasRecorder.draw(this) } } else { - canvas.withTranslation(0f, relativeOffset + paddingTop) { + canvas.withTranslation(0f, relativeOffset) { drawPage(view, this) } } @@ -318,7 +318,7 @@ data class TextPage( private fun drawPage(view: ContentTextView, canvas: Canvas) { for (i in lines.indices) { val line = lines[i] - canvas.withTranslation(0f, line.lineTop - paddingTop) { + canvas.withTranslation(0f, line.lineTop) { line.draw(view, this) } } @@ -326,7 +326,7 @@ data class TextPage( fun render(view: ContentTextView): Boolean { if (!isCompleted) return false - return canvasRecorder.recordIfNeeded(view.width, height.toInt()) { + return canvasRecorder.recordIfNeeded(view.width, view.height) { drawPage(view, this) } }