From 8fc3d8e09d7788a96559d31dc502e99fce4f1378 Mon Sep 17 00:00:00 2001 From: Stan Iliev Date: Fri, 28 Sep 2018 18:44:26 -0400 Subject: [PATCH] Disable blending for opaque TextureView Opaque TextureView (set by TextureView.setOpaque(true), should draw with SRC blending, which in practice disables GL blending. Test: Ran Naver app, which is using opaque TextureView Bug: 113845024 Change-Id: I5daa455a72b0ded50d6f9578f3b8a8701532f9d4 --- libs/hwui/Layer.cpp | 8 ++++++++ libs/hwui/Layer.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp index cc95051fc9522..32aaa54e696c5 100644 --- a/libs/hwui/Layer.cpp +++ b/libs/hwui/Layer.cpp @@ -77,5 +77,13 @@ void Layer::postDecStrong() { mRenderState.postDecStrong(this); } +SkBlendMode Layer::getMode() const { + if (mBlend || mode != SkBlendMode::kSrcOver) { + return mode; + } else { + return SkBlendMode::kSrc; + } +} + }; // namespace uirenderer }; // namespace android diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h index 6f07a43ceb585..e4f96e914c36b 100644 --- a/libs/hwui/Layer.h +++ b/libs/hwui/Layer.h @@ -67,7 +67,7 @@ public: inline int getAlpha() const { return alpha; } - inline SkBlendMode getMode() const { return mode; } + SkBlendMode getMode() const; inline SkColorFilter* getColorFilter() const { return mColorFilter.get(); }