diff options
author | Mathias Agopian <mathias@google.com> | 2013-08-14 16:33:27 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2013-08-15 15:11:01 -0700 |
commit | 2eaefe198a0cae1ee0b6366797a6b074c76df9ef (patch) | |
tree | 5cae5b8aeda6fe703063afaa1c1e43930eca2331 /services/surfaceflinger/RenderEngine | |
parent | 6db4ff621898573b41abf570271a04a13bd36a69 (diff) | |
download | frameworks_native-2eaefe198a0cae1ee0b6366797a6b074c76df9ef.zip frameworks_native-2eaefe198a0cae1ee0b6366797a6b074c76df9ef.tar.gz frameworks_native-2eaefe198a0cae1ee0b6366797a6b074c76df9ef.tar.bz2 |
Simplify handling of opaque layers in shader generation
just ensure the alpha value is 1.0 in the opaque case
when reading the color from the texture or the
global color.
Bug: 8679321
Change-Id: Ia38b30e97c3bce5a2d534a40c0d66e0bfc3ea40d
Diffstat (limited to 'services/surfaceflinger/RenderEngine')
-rw-r--r-- | services/surfaceflinger/RenderEngine/ProgramCache.cpp | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/services/surfaceflinger/RenderEngine/ProgramCache.cpp b/services/surfaceflinger/RenderEngine/ProgramCache.cpp index f378713..1f2eb9d 100644 --- a/services/surfaceflinger/RenderEngine/ProgramCache.cpp +++ b/services/surfaceflinger/RenderEngine/ProgramCache.cpp @@ -140,28 +140,16 @@ String8 ProgramCache::generateFragmentShader(const Key& needs) { } 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 << "}"; |