Profiling fix B: Catch Up cards decode their pictures at card size

Cards drew 1280-pixel pictures (about 3.7 MB each) at about 400 pixels; now decoded at 640 (inSampleSize 2).
Measured downstairs (8 November 2026, same key presses): Catch Up drawing thread 24.5/23.3 -> 22.3/21.3 ms median;
whole-frame time about the same (31/28 -> 30/30 ms).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-08 13:13:36 +00:00
co-authored by Claude Opus 5.5
parent a1cfc7c265
commit 869f147cdd
3 changed files with 41 additions and 3 deletions
@@ -0,0 +1,14 @@
package tv.orbit.classic
import org.junit.Assert.assertEquals
import org.junit.Test
/** 8 November 2026 (profiling fix B): a card's picture is decoded smaller, never below the size it's shown. */
class ArtworkSampleSizeTest {
@Test fun halvesOnlyWhileStillWideEnough() {
assertEquals(2, artworkSampleSize(1280, CATCH_UP_CARD_PICTURE_PX)) // 640 px, shown at about 400
assertEquals(1, artworkSampleSize(900, CATCH_UP_CARD_PICTURE_PX)) // 450 would be too small
assertEquals(4, artworkSampleSize(1920, 480))
assertEquals(1, artworkSampleSize(1280, null)); assertEquals(1, artworkSampleSize(0, 480))
}
}