summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tyler Freeman <fuego@google.com> 2024-09-20 19:01:21 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-09-20 19:01:21 +0000
commit367335a28c1e0751672ffef88f66f75ba545c1c4 (patch)
treea07aeb09b233f2a03b321cc501fa4acbe1ed0d4a
parent4817c141ba3289c3ebe2dbc5ff5cb5440ac829cc (diff)
parent3455a2182c68b40a3e18f74f94711f81e4bb34e9 (diff)
Merge "fix(force invert): hide Container type treatment behind feature flag" into main
-rw-r--r--libs/hwui/RenderNode.cpp12
-rw-r--r--libs/hwui/RenderNode.h1
2 files changed, 10 insertions, 3 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index 589abb4d87f4..2c23864317a4 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -404,13 +404,19 @@ void RenderNode::syncDisplayList(TreeObserver& observer, TreeInfo* info) {
}
}
+inline bool RenderNode::isForceInvertDark(TreeInfo& info) {
+ return CC_UNLIKELY(
+ info.forceDarkType == android::uirenderer::ForceDarkType::FORCE_INVERT_COLOR_DARK);
+}
+
inline bool RenderNode::shouldEnableForceDark(TreeInfo* info) {
return CC_UNLIKELY(
info &&
- (!info->disableForceDark ||
- info->forceDarkType == android::uirenderer::ForceDarkType::FORCE_INVERT_COLOR_DARK));
+ (!info->disableForceDark || isForceInvertDark(*info)));
}
+
+
void RenderNode::handleForceDark(android::uirenderer::TreeInfo *info) {
if (!shouldEnableForceDark(info)) {
return;
@@ -421,7 +427,7 @@ void RenderNode::handleForceDark(android::uirenderer::TreeInfo *info) {
children.push_back(node);
});
if (mDisplayList.hasText()) {
- if (mDisplayList.hasFill()) {
+ if (isForceInvertDark(*info) && mDisplayList.hasFill()) {
// Handle a special case for custom views that draw both text and background in the
// same RenderNode, which would otherwise be altered to white-on-white text.
usage = UsageHint::Container;
diff --git a/libs/hwui/RenderNode.h b/libs/hwui/RenderNode.h
index c9045427bd42..afbbce7e27ee 100644
--- a/libs/hwui/RenderNode.h
+++ b/libs/hwui/RenderNode.h
@@ -234,6 +234,7 @@ private:
void syncDisplayList(TreeObserver& observer, TreeInfo* info);
void handleForceDark(TreeInfo* info);
bool shouldEnableForceDark(TreeInfo* info);
+ bool isForceInvertDark(TreeInfo& info);
void prepareTreeImpl(TreeObserver& observer, TreeInfo& info, bool functorsNeedLayer);
void pushStagingPropertiesChanges(TreeInfo& info);