diff options
author | Chris Craik <ccraik@google.com> | 2015-05-13 23:53:47 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-13 23:53:48 +0000 |
commit | 6b4ace298e3c30ed11fbcb168229f492323e19ba (patch) | |
tree | 9857b6577f171e312c19dd7a719c1b70147d6808 | |
parent | 67b7ec28872dcb0ba09ef01bb87f7d558cbd19fc (diff) | |
parent | 1a0808e64c170fa7b620b858fa5875f6f08a2b54 (diff) | |
download | frameworks_base-6b4ace298e3c30ed11fbcb168229f492323e19ba.zip frameworks_base-6b4ace298e3c30ed11fbcb168229f492323e19ba.tar.gz frameworks_base-6b4ace298e3c30ed11fbcb168229f492323e19ba.tar.bz2 |
Merge "Add back alpha atrace log" into mnc-dev
-rw-r--r-- | libs/hwui/RenderNode.cpp | 7 | ||||
-rw-r--r-- | libs/hwui/RenderProperties.h | 14 | ||||
-rw-r--r-- | libs/hwui/utils/TraceUtils.h | 2 |
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; |