From f05f6d568a6095e61be42de8c2937e9b45fd772f Mon Sep 17 00:00:00 2001 From: MUEDSA <7676275+muedsa@users.noreply.github.com> Date: Fri, 19 Jan 2024 14:52:51 +0800 Subject: [PATCH] update: debug paint layer bounds --- src/main/kotlin/com/muedsa/snapshot/Const.kt | 2 ++ .../muedsa/snapshot/rendering/PaintingContext.kt | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/muedsa/snapshot/Const.kt b/src/main/kotlin/com/muedsa/snapshot/Const.kt index 9a5bd56..cedbe69 100644 --- a/src/main/kotlin/com/muedsa/snapshot/Const.kt +++ b/src/main/kotlin/com/muedsa/snapshot/Const.kt @@ -1,3 +1,5 @@ package com.muedsa.snapshot const val precisionErrorTolerance: Float = 1e-10f + +const val debugCurrentRepaintColor: Int = 0x66_03_03_03 \ No newline at end of file diff --git a/src/main/kotlin/com/muedsa/snapshot/rendering/PaintingContext.kt b/src/main/kotlin/com/muedsa/snapshot/rendering/PaintingContext.kt index a6a70de..e030d58 100644 --- a/src/main/kotlin/com/muedsa/snapshot/rendering/PaintingContext.kt +++ b/src/main/kotlin/com/muedsa/snapshot/rendering/PaintingContext.kt @@ -3,6 +3,7 @@ package com.muedsa.snapshot.rendering import com.muedsa.geometry.Matrix44CMO import com.muedsa.geometry.Offset import com.muedsa.geometry.shift +import com.muedsa.snapshot.debugCurrentRepaintColor import com.muedsa.snapshot.rendering.box.RenderBox import org.jetbrains.skia.* @@ -67,7 +68,20 @@ class PaintingContext private constructor( return } - // todo debug paint + // debug paint + if (debug) { + canvas.drawRect(estimatedBounds.inflate(-3f), Paint().also { + it.mode = PaintMode.STROKE + it.strokeWidth = 6f + it.color = debugCurrentRepaintColor + }) + + canvas.drawRect(estimatedBounds, Paint().also { + it.mode = PaintMode.STROKE + it.strokeWidth = 1f + it.color = 0xFF_FF_98_00.toInt() + }) + } currentLayer!!.picture = recorder!!.finishRecordingAsPicture() currentLayer = null