Skip to content

Commit

Permalink
update: debug paint layer bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
muedsa committed Jan 19, 2024
1 parent 8ccdebb commit f05f6d5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/kotlin/com/muedsa/snapshot/Const.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package com.muedsa.snapshot

const val precisionErrorTolerance: Float = 1e-10f

const val debugCurrentRepaintColor: Int = 0x66_03_03_03
16 changes: 15 additions & 1 deletion src/main/kotlin/com/muedsa/snapshot/rendering/PaintingContext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.*

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f05f6d5

Please sign in to comment.