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
This commit is contained in:
Jerome Gaillard
2020-01-29 15:23:26 +00:00
parent 64fdcebb5f
commit f9a4dc41b5
2 changed files with 7 additions and 1 deletions

View File

@@ -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",

View File

@@ -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) {