mirror of
https://github.com/gedoor/legado.git
synced 2024-07-06 23:47:49 +08:00
优化
This commit is contained in:
parent
73a27d27d4
commit
dc8e7a00ca
@ -647,6 +647,9 @@ class ReadView(context: Context, attrs: AttributeSet) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun invalidateTextPage() {
|
fun invalidateTextPage() {
|
||||||
|
if (!AppConfig.optimizeRender) {
|
||||||
|
return
|
||||||
|
}
|
||||||
pageFactory.run {
|
pageFactory.run {
|
||||||
prevPage.invalidateAll()
|
prevPage.invalidateAll()
|
||||||
curPage.invalidateAll()
|
curPage.invalidateAll()
|
||||||
@ -670,9 +673,10 @@ class ReadView(context: Context, attrs: AttributeSet) :
|
|||||||
|
|
||||||
fun submitRenderTask() {
|
fun submitRenderTask() {
|
||||||
if (!AppConfig.optimizeRender) {
|
if (!AppConfig.optimizeRender) {
|
||||||
return
|
curPage.invalidateContentView()
|
||||||
|
} else {
|
||||||
|
curPage.submitRenderTask()
|
||||||
}
|
}
|
||||||
curPage.submitRenderTask()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isLongScreenShot(): Boolean {
|
fun isLongScreenShot(): Boolean {
|
||||||
|
@ -178,6 +178,9 @@ data class TextLine(
|
|||||||
} else {
|
} else {
|
||||||
ReadBookConfig.textColor
|
ReadBookConfig.textColor
|
||||||
}
|
}
|
||||||
|
if (textPaint.color != textColor) {
|
||||||
|
textPaint.color = textColor
|
||||||
|
}
|
||||||
val paint = PaintPool.obtain()
|
val paint = PaintPool.obtain()
|
||||||
paint.set(textPaint)
|
paint.set(textPaint)
|
||||||
if (extraLetterSpacing != 0f) {
|
if (extraLetterSpacing != 0f) {
|
||||||
@ -186,9 +189,6 @@ data class TextLine(
|
|||||||
if (wordSpacing != 0f) {
|
if (wordSpacing != 0f) {
|
||||||
paint.wordSpacing = wordSpacing
|
paint.wordSpacing = wordSpacing
|
||||||
}
|
}
|
||||||
if (paint.color != textColor) {
|
|
||||||
paint.color = textColor
|
|
||||||
}
|
|
||||||
if (extraLetterSpacingOffsetX != 0f) {
|
if (extraLetterSpacingOffsetX != 0f) {
|
||||||
canvas.withTranslation(extraLetterSpacingOffsetX) {
|
canvas.withTranslation(extraLetterSpacingOffsetX) {
|
||||||
canvas.drawText(text, indentSize, text.length, startX, lineBase - lineTop, paint)
|
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 android.graphics.Canvas
|
||||||
import androidx.annotation.Keep
|
import androidx.annotation.Keep
|
||||||
import io.legado.app.help.PaintPool
|
|
||||||
import io.legado.app.help.config.ReadBookConfig
|
import io.legado.app.help.config.ReadBookConfig
|
||||||
import io.legado.app.lib.theme.ThemeStore
|
import io.legado.app.lib.theme.ThemeStore
|
||||||
import io.legado.app.ui.book.read.page.ContentTextView
|
import io.legado.app.ui.book.read.page.ContentTextView
|
||||||
@ -53,13 +52,10 @@ data class TextColumn(
|
|||||||
} else {
|
} else {
|
||||||
ReadBookConfig.textColor
|
ReadBookConfig.textColor
|
||||||
}
|
}
|
||||||
val paint = PaintPool.obtain()
|
if (textPaint.color != textColor) {
|
||||||
paint.set(textPaint)
|
textPaint.color = textColor
|
||||||
if (paint.color != textColor) {
|
|
||||||
paint.color = textColor
|
|
||||||
}
|
}
|
||||||
canvas.drawText(charData, start, textLine.lineBase - textLine.lineTop, paint)
|
canvas.drawText(charData, start, textLine.lineBase - textLine.lineTop, textPaint)
|
||||||
PaintPool.recycle(paint)
|
|
||||||
if (selected) {
|
if (selected) {
|
||||||
canvas.drawRect(start, 0f, end, textLine.height, view.selectedPaint)
|
canvas.drawRect(start, 0f, end, textLine.height, view.selectedPaint)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user