mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-12 03:21:08 +00:00
fix(hud): skip relayout when size is unchanged and cap graph redraws
This commit is contained in:
1 parent
542bbf89c3
commit
dc309187fd
1 file changed
+11
-2
@@ -274,9 +274,15 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
seenFpsUpdates = updates
|
||||
periodDone.trySend(Unit)
|
||||
}
|
||||
if (graphRect != null) invalidate()
|
||||
if (graphRect == null) return
|
||||
val now = SystemClock.uptimeMillis()
|
||||
if (now - lastGraphDrawMs < GRAPH_REDRAW_MS) return
|
||||
lastGraphDrawMs = now
|
||||
invalidate()
|
||||
}
|
||||
|
||||
private var lastGraphDrawMs = 0L
|
||||
|
||||
private fun cycleSize() {
|
||||
size = size.next()
|
||||
onSizeCycledListener?.accept(size.token)
|
||||
@@ -423,8 +429,10 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
)
|
||||
|
||||
private fun rebuildAndInvalidate() {
|
||||
val wasStrip = stripRect != null
|
||||
val oldW = contentW; val oldH = contentH
|
||||
rebuild()
|
||||
requestLayout()
|
||||
if (oldW != contentW || oldH != contentH || wasStrip != (stripRect != null)) requestLayout()
|
||||
invalidate()
|
||||
}
|
||||
|
||||
@@ -1499,6 +1507,7 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
const val TAB_PAD_X_SP = 7f
|
||||
const val TAB_PAD_Y_SP = 5.5f
|
||||
const val REFRESH_MS = 500L
|
||||
const val GRAPH_REDRAW_MS = 33L
|
||||
private const val HUE_IDLE_MS = 500L
|
||||
const val MIN_SCALE = 0.5f
|
||||
const val MAX_SCALE = 2f
|
||||
|
||||
Reference in new issue
Block a user