mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
优化
This commit is contained in:
parent
0a90151ddd
commit
902ab32ceb
@ -24,6 +24,12 @@ class CanvasRecorderApi29Impl : BaseCanvasRecorder() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun flushRenderNode() {
|
||||||
|
val rc = renderNode!!.beginRecording()
|
||||||
|
rc.drawPicture(picture!!)
|
||||||
|
renderNode!!.endRecording()
|
||||||
|
}
|
||||||
|
|
||||||
override fun beginRecording(width: Int, height: Int): Canvas {
|
override fun beginRecording(width: Int, height: Int): Canvas {
|
||||||
init()
|
init()
|
||||||
renderNode!!.setPosition(0, 0, width, height)
|
renderNode!!.setPosition(0, 0, width, height)
|
||||||
@ -32,9 +38,7 @@ class CanvasRecorderApi29Impl : BaseCanvasRecorder() {
|
|||||||
|
|
||||||
override fun endRecording() {
|
override fun endRecording() {
|
||||||
picture!!.endRecording()
|
picture!!.endRecording()
|
||||||
val rc = renderNode!!.beginRecording()
|
flushRenderNode()
|
||||||
rc.drawPicture(picture!!)
|
|
||||||
renderNode!!.endRecording()
|
|
||||||
super.endRecording()
|
super.endRecording()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,9 +46,7 @@ class CanvasRecorderApi29Impl : BaseCanvasRecorder() {
|
|||||||
if (renderNode == null || picture == null) return
|
if (renderNode == null || picture == null) return
|
||||||
if (canvas.isHardwareAccelerated) {
|
if (canvas.isHardwareAccelerated) {
|
||||||
if (!renderNode!!.hasDisplayList()) {
|
if (!renderNode!!.hasDisplayList()) {
|
||||||
val rc = renderNode!!.beginRecording()
|
flushRenderNode()
|
||||||
rc.drawPicture(picture!!)
|
|
||||||
renderNode!!.endRecording()
|
|
||||||
}
|
}
|
||||||
canvas.drawRenderNode(renderNode!!)
|
canvas.drawRenderNode(renderNode!!)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user