summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Stan Iliev <stani@google.com> 2018-11-07 13:54:42 -0800
committer android-build-merger <android-build-merger@google.com> 2018-11-07 13:54:42 -0800
commit575e267a23c079168a18b78c3a617e22c4e67345 (patch)
treefbdd05a57afa2739f29969598a6f8c774514c08a
parent83048a884145361d49835bbe4b6cfe4d780e2296 (diff)
parent5a3b666ab068ca86f9c2fbb33b895c4ee7368d61 (diff)
Merge "Disable blending for opaque TextureView" into pi-dev
am: 5a3b666ab0 Change-Id: Ifc11ee820172117e3740e82829e37ff38ad8ca29
-rw-r--r--libs/hwui/GlLayer.cpp8
-rw-r--r--libs/hwui/GlLayer.h2
-rw-r--r--libs/hwui/Layer.cpp4
-rw-r--r--libs/hwui/Layer.h12
4 files changed, 18 insertions, 8 deletions
diff --git a/libs/hwui/GlLayer.cpp b/libs/hwui/GlLayer.cpp
index 42ae29d76898..8357f8ebde2e 100644
--- a/libs/hwui/GlLayer.cpp
+++ b/libs/hwui/GlLayer.cpp
@@ -72,5 +72,13 @@ void GlLayer::generateTexture() {
}
}
+SkBlendMode GlLayer::getMode() const {
+ if (texture.blend || mode != SkBlendMode::kSrcOver) {
+ return mode;
+ } else {
+ return SkBlendMode::kSrc;
+ }
+}
+
}; // namespace uirenderer
}; // namespace android
diff --git a/libs/hwui/GlLayer.h b/libs/hwui/GlLayer.h
index 28749a0d125c..4cf8f2522ff9 100644
--- a/libs/hwui/GlLayer.h
+++ b/libs/hwui/GlLayer.h
@@ -66,6 +66,8 @@ public:
*/
void onGlContextLost();
+ SkBlendMode getMode() const override;
+
private:
Caches& caches;
diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp
index fb8f0337c95e..b86ae121af55 100644
--- a/libs/hwui/Layer.cpp
+++ b/libs/hwui/Layer.cpp
@@ -27,10 +27,10 @@ Layer::Layer(RenderState& renderState, Api api, sk_sp<SkColorFilter> colorFilter
SkBlendMode mode)
: GpuMemoryTracker(GpuObjectType::Layer)
, mRenderState(renderState)
+ , mode(mode)
, mApi(api)
, mColorFilter(colorFilter)
- , alpha(alpha)
- , mode(mode) {
+ , alpha(alpha) {
// TODO: This is a violation of Android's typical ref counting, but it
// preserves the old inc/dec ref locations. This should be changed...
incStrong(nullptr);
diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h
index acaeab1b0068..d41c9703e908 100644
--- a/libs/hwui/Layer.h
+++ b/libs/hwui/Layer.h
@@ -72,7 +72,7 @@ public:
inline int getAlpha() const { return alpha; }
- inline SkBlendMode getMode() const { return mode; }
+ virtual SkBlendMode getMode() const { return mode; }
inline SkColorFilter* getColorFilter() const { return mColorFilter.get(); }
@@ -109,6 +109,11 @@ protected:
RenderState& mRenderState;
+ /**
+ * Blending mode of the layer.
+ */
+ SkBlendMode mode;
+
private:
void buildColorSpaceWithFilter();
@@ -140,11 +145,6 @@ private:
int alpha;
/**
- * Blending mode of the layer.
- */
- SkBlendMode mode;
-
- /**
* Optional texture coordinates transform.
*/
mat4 texTransform;