This commit is contained in:
Horis
2024-08-08 15:38:21 +08:00
parent fcfbcb387d
commit 3ac31ec7e4
@@ -290,11 +290,11 @@ data class TextPage(
fun draw(view: ContentTextView, canvas: Canvas, relativeOffset: Float) { fun draw(view: ContentTextView, canvas: Canvas, relativeOffset: Float) {
if (AppConfig.optimizeRender) { if (AppConfig.optimizeRender) {
render(view) render(view)
canvas.withTranslation(0f, relativeOffset + paddingTop) { canvas.withTranslation(0f, relativeOffset) {
canvasRecorder.draw(this) canvasRecorder.draw(this)
} }
} else { } else {
canvas.withTranslation(0f, relativeOffset + paddingTop) { canvas.withTranslation(0f, relativeOffset) {
drawPage(view, this) drawPage(view, this)
} }
} }
@@ -318,7 +318,7 @@ data class TextPage(
private fun drawPage(view: ContentTextView, canvas: Canvas) { private fun drawPage(view: ContentTextView, canvas: Canvas) {
for (i in lines.indices) { for (i in lines.indices) {
val line = lines[i] val line = lines[i]
canvas.withTranslation(0f, line.lineTop - paddingTop) { canvas.withTranslation(0f, line.lineTop) {
line.draw(view, this) line.draw(view, this)
} }
} }
@@ -326,7 +326,7 @@ data class TextPage(
fun render(view: ContentTextView): Boolean { fun render(view: ContentTextView): Boolean {
if (!isCompleted) return false if (!isCompleted) return false
return canvasRecorder.recordIfNeeded(view.width, height.toInt()) { return canvasRecorder.recordIfNeeded(view.width, view.height) {
drawPage(view, this) drawPage(view, this)
} }
} }