summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libs/hwui/RenderNode.cpp7
-rw-r--r--libs/hwui/RenderProperties.h14
-rw-r--r--libs/hwui/utils/TraceUtils.h2
3 files changed, 15 insertions, 8 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index 8f95e0d..9146b68 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -392,6 +392,13 @@ void RenderNode::setViewProperties(OpenGLRenderer& renderer, T& handler) {
}
LOG_ALWAYS_FATAL_IF(!isLayer && properties().getHasOverlappingRendering());
renderer.scaleAlpha(properties().getAlpha());
+
+ if (CC_UNLIKELY(ATRACE_ENABLED() && properties().promotedToLayer())) {
+ // pretend to cause savelayer to warn about performance problem affecting old versions
+ ATRACE_FORMAT("%s alpha caused saveLayer %dx%d", getName(),
+ static_cast<int>(getWidth()),
+ static_cast<int>(getHeight()));
+ }
}
if (clipFlags) {
Rect clipRect;
diff --git a/libs/hwui/RenderProperties.h b/libs/hwui/RenderProperties.h
index a43566d..98029a8 100644
--- a/libs/hwui/RenderProperties.h
+++ b/libs/hwui/RenderProperties.h
@@ -576,15 +576,15 @@ public:
&& getOutline().getAlpha() != 0.0f;
}
- LayerType effectiveLayerType() const {
- LayerType type = mLayerProperties.mType;
- if (type == LayerType::None
+ bool promotedToLayer() const {
+ return mLayerProperties.mType == LayerType::None
&& !MathUtils::isZero(mPrimitiveFields.mAlpha)
&& mPrimitiveFields.mAlpha < 1
- && mPrimitiveFields.mHasOverlappingRendering) {
- return LayerType::RenderLayer;
- }
- return type;
+ && mPrimitiveFields.mHasOverlappingRendering;
+ }
+
+ LayerType effectiveLayerType() const {
+ return promotedToLayer() ? LayerType::RenderLayer : mLayerProperties.mType;
}
private:
diff --git a/libs/hwui/utils/TraceUtils.h b/libs/hwui/utils/TraceUtils.h
index ff8ccb8..ddc272c 100644
--- a/libs/hwui/utils/TraceUtils.h
+++ b/libs/hwui/utils/TraceUtils.h
@@ -35,7 +35,7 @@ public:
};
static void atraceFormatBegin(const char* fmt, ...) {
- if (CC_UNLIKELY(!ATRACE_ENABLED())) return;
+ if (CC_LIKELY(!ATRACE_ENABLED())) return;
const int BUFFER_SIZE = 256;
va_list ap;