diff options
Diffstat (limited to 'libs/hwui/RenderNode.cpp')
-rw-r--r-- | libs/hwui/RenderNode.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index d28bb499c907..3e131bc44d39 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -40,6 +40,7 @@ #ifdef __ANDROID__ #include "include/gpu/ganesh/SkImageGanesh.h" #endif +#include "utils/ForceDark.h" #include "utils/MathUtils.h" #include "utils/StringUtils.h" @@ -403,16 +404,21 @@ void RenderNode::syncDisplayList(TreeObserver& observer, TreeInfo* info) { deleteDisplayList(observer, info); mDisplayList = std::move(mStagingDisplayList); if (mDisplayList) { - WebViewSyncData syncData { - .applyForceDark = info && !info->disableForceDark - }; + WebViewSyncData syncData{.applyForceDark = shouldEnableForceDark(info)}; mDisplayList.syncContents(syncData); handleForceDark(info); } } +inline bool RenderNode::shouldEnableForceDark(TreeInfo* info) { + return CC_UNLIKELY( + info && + (!info->disableForceDark || + info->forceDarkType == android::uirenderer::ForceDarkType::FORCE_INVERT_COLOR_DARK)); +} + void RenderNode::handleForceDark(android::uirenderer::TreeInfo *info) { - if (CC_LIKELY(!info || info->disableForceDark)) { + if (!shouldEnableForceDark(info)) { return; } auto usage = usageHint(); |