This commit is contained in:
Horis 2024-04-15 12:20:50 +08:00
parent 73a27d27d4
commit dc8e7a00ca
3 changed files with 12 additions and 12 deletions

View File

@ -647,6 +647,9 @@ class ReadView(context: Context, attrs: AttributeSet) :
}
fun invalidateTextPage() {
if (!AppConfig.optimizeRender) {
return
}
pageFactory.run {
prevPage.invalidateAll()
curPage.invalidateAll()
@ -670,9 +673,10 @@ class ReadView(context: Context, attrs: AttributeSet) :
fun submitRenderTask() {
if (!AppConfig.optimizeRender) {
return
curPage.invalidateContentView()
} else {
curPage.submitRenderTask()
}
curPage.submitRenderTask()
}
fun isLongScreenShot(): Boolean {

View File

@ -178,6 +178,9 @@ data class TextLine(
} else {
ReadBookConfig.textColor
}
if (textPaint.color != textColor) {
textPaint.color = textColor
}
val paint = PaintPool.obtain()
paint.set(textPaint)
if (extraLetterSpacing != 0f) {
@ -186,9 +189,6 @@ data class TextLine(
if (wordSpacing != 0f) {
paint.wordSpacing = wordSpacing
}
if (paint.color != textColor) {
paint.color = textColor
}
if (extraLetterSpacingOffsetX != 0f) {
canvas.withTranslation(extraLetterSpacingOffsetX) {
canvas.drawText(text, indentSize, text.length, startX, lineBase - lineTop, paint)

View File

@ -2,7 +2,6 @@ package io.legado.app.ui.book.read.page.entities.column
import android.graphics.Canvas
import androidx.annotation.Keep
import io.legado.app.help.PaintPool
import io.legado.app.help.config.ReadBookConfig
import io.legado.app.lib.theme.ThemeStore
import io.legado.app.ui.book.read.page.ContentTextView
@ -53,13 +52,10 @@ data class TextColumn(
} else {
ReadBookConfig.textColor
}
val paint = PaintPool.obtain()
paint.set(textPaint)
if (paint.color != textColor) {
paint.color = textColor
if (textPaint.color != textColor) {
textPaint.color = textColor
}
canvas.drawText(charData, start, textLine.lineBase - textLine.lineTop, paint)
PaintPool.recycle(paint)
canvas.drawText(charData, start, textLine.lineBase - textLine.lineTop, textPaint)
if (selected) {
canvas.drawRect(start, 0f, end, textLine.height, view.selectedPaint)
}