Merge "Disable blending for opaque TextureView" into pi-dev
diff --git a/libs/hwui/GlLayer.cpp b/libs/hwui/GlLayer.cpp
index 42ae29d..8357f8e 100644
--- a/libs/hwui/GlLayer.cpp
+++ b/libs/hwui/GlLayer.cpp
@@ -72,5 +72,13 @@
     }
 }
 
+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 28749a0..4cf8f25 100644
--- a/libs/hwui/GlLayer.h
+++ b/libs/hwui/GlLayer.h
@@ -66,6 +66,8 @@
      */
     void onGlContextLost();
 
+    SkBlendMode getMode() const override;
+
 private:
     Caches& caches;
 
diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp
index fb8f033..b86ae12 100644
--- a/libs/hwui/Layer.cpp
+++ b/libs/hwui/Layer.cpp
@@ -27,10 +27,10 @@
              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 acaeab1..d41c970 100644
--- a/libs/hwui/Layer.h
+++ b/libs/hwui/Layer.h
@@ -72,7 +72,7 @@
 
     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 @@
 
     RenderState& mRenderState;
 
+    /**
+     * Blending mode of the layer.
+     */
+    SkBlendMode mode;
+
 private:
     void buildColorSpaceWithFilter();
 
@@ -140,11 +145,6 @@
     int alpha;
 
     /**
-     * Blending mode of the layer.
-     */
-    SkBlendMode mode;
-
-    /**
      * Optional texture coordinates transform.
      */
     mat4 texTransform;