mirror of
https://github.com/gedoor/legado.git
synced 2024-07-04 23:36:56 +08:00
优化
This commit is contained in:
parent
73a27d27d4
commit
dc8e7a00ca
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user