Skip to content

Commit f1b5383

Browse files
jbeta51Skia Commit-Bot
authored andcommitted
handle updateAnimationSurface in SkottieView through GL thread
Change-Id: I546a095e340821b11310cec521e476c7ace28e3c Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326536 Reviewed-by: Stan Iliev <[email protected]> Commit-Queue: Jorge Betancourt <[email protected]>
1 parent 7767a26 commit f1b5383

File tree

1 file changed

+10
-3
lines changed
  • platform_tools/android/apps/skottie/skottielib/src/main/java/org/skia/skottie

1 file changed

+10
-3
lines changed

platform_tools/android/apps/skottie/skottielib/src/main/java/org/skia/skottie/SkottieRunner.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,16 @@ public SkottieAnimation createAnimation(SurfaceView view, InputStream is, int ba
9797
*/
9898
public void updateAnimationSurface(Animatable animation, SurfaceTexture surfaceTexture,
9999
int width, int height) {
100-
// TODO: when testing, make sure thread management handles crashes
101-
((SkottieAnimationImpl) animation).setSurfaceTexture(surfaceTexture);
102-
((SkottieAnimationImpl) animation).updateSurface(width, height);
100+
try {
101+
runOnGLThread(() -> {
102+
((SkottieAnimationImpl) animation).setSurfaceTexture(surfaceTexture);
103+
((SkottieAnimationImpl) animation).updateSurface(width, height);
104+
});
105+
}
106+
catch (Throwable t) {
107+
Log.e(LOG_TAG, "update failed", t);
108+
throw new RuntimeException(t);
109+
}
103110
}
104111

105112
private SkottieRunner()

0 commit comments

Comments
 (0)