Keep the first frame's pictures when the practice catalog loads
The Practices app opens after the first frame. Loading its catalog closed the previous practice packs and always reported assets/practices as changed, so every practice picture already on screen loaded again: the 2048x1024 Wim Hof banner decoded twice in each start, about 760 ms each in a debug build on a Pixel 4a. Closing the packs now reloads pictures only when a closing pack served some, as installing or removing one pack already did; readers still look again either way. Local tests: practice-downloads-test, with a new check that the first catalog leaves pictures alone (it fails on the old code), and desktop-window-test on a private Xvfb. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
57e065fe21
commit
17a0cfd9e6
3 files changed
+12
-4
No files matched your search
@@ -26,8 +26,5 @@ then about 3 s drawing that frame.
|
||||
- [ ] Practice banners are 2048×1024 WebP for a card a few hundred pixels
|
||||
tall: about 760 ms each in the debug build. Decode at the drawn size
|
||||
(Kryon's Pixmap) or ship smaller banners.
|
||||
- [ ] The WHM banner decodes twice. When the Practices app opens after the
|
||||
start, `practice_downloads.zi` reports `assets/practices` as changed, which
|
||||
reloads pictures whose bytes stayed the same.
|
||||
- [ ] Measure a gplay release on the owner's Pixel 3a once these land; debug
|
||||
builds log each picture's load time as `APP PROBE: picture`.
|
||||
@@ -622,12 +622,16 @@ PracticeDownloadsCancel :: () {
|
||||
practice_transfer_index = -1
|
||||
}
|
||||
|
||||
// Pictures load again only when a closing pack served some. The first
|
||||
// catalog closes no pack, so the pictures the first frame drew stay.
|
||||
PracticeDownloadsClose :: () {
|
||||
PracticeDownloadsCancel()
|
||||
images := false
|
||||
for index: cast(s32)0..practice_pack_count - 1 {
|
||||
PracticeContentWorkRetire(practice_load_work[index])
|
||||
practice_load_work[index] = null
|
||||
practice_content_used[index] = 0
|
||||
images = images || PracticePackServesImages(practice_packs[index], practice_packs[index].bundle)
|
||||
CloseBundle(practice_packs[index].bundle)
|
||||
practice_packs[index] = PracticePack.{}
|
||||
}
|
||||
@@ -639,7 +643,7 @@ PracticeDownloadsClose :: () {
|
||||
practice_narration_selected = false
|
||||
practice_guide_narration_selected = false
|
||||
practice_catalog_invalid = false
|
||||
AssetNotifyChangedUnder(PRACTICE_ASSET_FOLDER)
|
||||
PracticePackContentChanged(images)
|
||||
}
|
||||
|
||||
PracticeCatalogParse :: (data: string, output: []PracticePack) -> s32 {
|
||||
|
||||
@@ -80,10 +80,17 @@ CheckPracticeDownloads :: () -> s32 {
|
||||
AssetBindProvider(FixtureProvider)
|
||||
practice_grant = FixtureGrant
|
||||
practice_owned = FixtureOwned
|
||||
unused AssetTakeChanges()
|
||||
FixturePracticePump(0, false, false, true)
|
||||
if practice_pack_count != 11 || PracticeContentReady(0) {
|
||||
return 1
|
||||
}
|
||||
// The first catalog closes no pack, so the pictures already on screen
|
||||
// stay: the practice banners decoded once, not again when it loaded.
|
||||
first_catalog := AssetTakeChanges()
|
||||
if first_catalog.all || first_catalog.folders.count != 0 {
|
||||
return 132
|
||||
}
|
||||
PracticeContentRequest(0)
|
||||
FixturePracticePump(0, false, false, true)
|
||||
// Repeated requests while transferring must not enqueue the pack twice.
|
||||
|
||||
Reference in new issue
Block a user