Merge "Fix ES2 composition on some devices" into klp-dev
diff --git a/services/surfaceflinger/RenderEngine/ProgramCache.cpp b/services/surfaceflinger/RenderEngine/ProgramCache.cpp
index db64a16..4911609 100644
--- a/services/surfaceflinger/RenderEngine/ProgramCache.cpp
+++ b/services/surfaceflinger/RenderEngine/ProgramCache.cpp
@@ -144,28 +144,16 @@
     } else {
         fs << "gl_FragColor = color;";
     }
+    if (needs.isOpaque()) {
+        fs << "gl_FragColor.a = 1.0;";
+    }
     if (needs.hasPlaneAlpha()) {
         // modulate the alpha value with planeAlpha
         if (needs.isPremultiplied()) {
             // ... and the color too if we're premultiplied
-            if (needs.isOpaque()) {
-                // ... we're opaque, only premultiply the color component
-                fs << "gl_FragColor.rgb *= alphaPlane;"
-                   << "gl_FragColor.a = alphaPlane;";
-            } else {
-                fs << "gl_FragColor *= alphaPlane;";
-            }
+            fs << "gl_FragColor *= alphaPlane;";
         } else {
-            // not premultiplied
-            if (needs.isOpaque()) {
-                fs << "gl_FragColor.a = alphaPlane;";
-            } else {
-                fs << "gl_FragColor.a *= alphaPlane;";
-            }
-        }
-    } else {
-        if (needs.isOpaque()) {
-            fs << "gl_FragColor.a = 1.0;";
+            fs << "gl_FragColor.a *= alphaPlane;";
         }
     }
     fs << dedent << "}";