From f9a4dc41b51484420fac84bcbb09f3caa469e004 Mon Sep 17 00:00:00 2001 From: Jerome Gaillard Date: Wed, 29 Jan 2020 15:23:26 +0000 Subject: [PATCH 1/2] Make HWUI build for macOs Only use AnimatedImageThread on Android, it is not currently supported on host. Bug: 148525019 Test: on macOs: lunch sdk & m libhwui Change-Id: I644bc82887fb7e36b2a5e4117ee328a3df99a0d4 --- libs/hwui/Android.bp | 2 +- libs/hwui/hwui/AnimatedImageDrawable.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp index 51270f5bcebdd..2ec7ceb20f4aa 100644 --- a/libs/hwui/Android.bp +++ b/libs/hwui/Android.bp @@ -168,7 +168,6 @@ cc_defaults { "renderthread/RenderTask.cpp", "renderthread/TimeLord.cpp", "hwui/AnimatedImageDrawable.cpp", - "hwui/AnimatedImageThread.cpp", "hwui/Bitmap.cpp", "hwui/Canvas.cpp", "hwui/ImageDecoder.cpp", @@ -210,6 +209,7 @@ cc_defaults { android: { srcs: [ + "hwui/AnimatedImageThread.cpp", "pipeline/skia/ATraceMemoryDump.cpp", "pipeline/skia/GLFunctorDrawable.cpp", "pipeline/skia/LayerDrawable.cpp", diff --git a/libs/hwui/hwui/AnimatedImageDrawable.cpp b/libs/hwui/hwui/AnimatedImageDrawable.cpp index 4544beae5df83..638de850a6c54 100644 --- a/libs/hwui/hwui/AnimatedImageDrawable.cpp +++ b/libs/hwui/hwui/AnimatedImageDrawable.cpp @@ -15,7 +15,9 @@ */ #include "AnimatedImageDrawable.h" +#ifdef __ANDROID__ // Layoutlib does not support AnimatedImageThread #include "AnimatedImageThread.h" +#endif #include "utils/TraceUtils.h" @@ -160,8 +162,10 @@ void AnimatedImageDrawable::onDraw(SkCanvas* canvas) { } else if (starting) { // The image has animated, and now is being reset. Queue up the first // frame, but keep showing the current frame until the first is ready. +#ifdef __ANDROID__ // Layoutlib does not support AnimatedImageThread auto& thread = uirenderer::AnimatedImageThread::getInstance(); mNextSnapshot = thread.reset(sk_ref_sp(this)); +#endif } bool finalFrame = false; @@ -187,8 +191,10 @@ void AnimatedImageDrawable::onDraw(SkCanvas* canvas) { } if (mRunning && !mNextSnapshot.valid()) { +#ifdef __ANDROID__ // Layoutlib does not support AnimatedImageThread auto& thread = uirenderer::AnimatedImageThread::getInstance(); mNextSnapshot = thread.decodeNextFrame(sk_ref_sp(this)); +#endif } if (!drawDirectly) { From 4c27c0ceab8e0a1f5a4ca3e9a6cc8793ff10fd9a Mon Sep 17 00:00:00 2001 From: Jerome Gaillard Date: Thu, 6 Feb 2020 18:23:05 +0000 Subject: [PATCH 2/2] Make libandroid_runtime build on mac Move AnimatedImageDrawable to Android only build as it does not compile on mac. Bug: 148525019 Test: on mac: lunch sdk && m libandroid_runtime Change-Id: Ia42a37c0ae02d1b520935f2b41b57cf7ab6ef74d --- core/jni/Android.bp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/jni/Android.bp b/core/jni/Android.bp index cec68df3c949e..6ffac5dddbfad 100644 --- a/core/jni/Android.bp +++ b/core/jni/Android.bp @@ -360,7 +360,6 @@ cc_library_static { "android_view_RenderNode.cpp", "android_util_PathParser.cpp", - "android/graphics/AnimatedImageDrawable.cpp", "android/graphics/Bitmap.cpp", "android/graphics/BitmapFactory.cpp", "android/graphics/ByteBufferStreamAdaptor.cpp", @@ -436,6 +435,7 @@ cc_library_static { "android_view_TextureLayer.cpp", "android_view_ThreadedRenderer.cpp", + "android/graphics/AnimatedImageDrawable.cpp", "android/graphics/BitmapRegionDecoder.cpp", "android/graphics/GIFMovie.cpp", "android/graphics/Movie.cpp",