Skip to content

Commit d5262b3

Browse files
ErikUggeldahlErikUggeldahl
andcommitted
perf(Android): Do not do bitmap operations needlessly (#12924) a2371b9239
We currently pull bitmaps in the Rive composable regardless of whether the user asks for the callback. This optimizes it so it's only performed when necessary. Co-authored-by: Erik <erik@rive.app>
1 parent efe05da commit d5262b3

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

.rive_head

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
61822bb24793050f151e291788b912a2fea1cffb
1+
a2371b923992a98c7f5b117eed1d6cafee890c30

kotlin/src/main/kotlin/app/rive/Rive.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ fun Rive(
533533

534534
override fun onSurfaceTextureUpdated(surfaceTexture: SurfaceTexture) {
535535
// Only dispatch once per surface, and only when a real frame is available
536-
if (!bitmapCallbackSent) {
536+
if (!bitmapCallbackSent && currentOnBitmapAvailable != null) {
537537
val bmp = bitmap
538538
if (bmp != null) {
539539
bitmapCallbackSent = true

0 commit comments

Comments
 (0)