Fixed alpha blending for native text.
authorYoann Lopes <yoann.lopes@digia.com>
Tue, 16 Apr 2013 14:29:21 +0000 (16:29 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 16 Apr 2013 15:05:30 +0000 (17:05 +0200)
Change-Id: I3effd31849b21a9497fadfb22c959562bff7951b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
src/quick/scenegraph/qsgdefaultglyphnode_p.cpp

index 419062d..3df1153 100644 (file)
@@ -95,7 +95,8 @@ const char *QSGTextMaskMaterialData::fragmentShader() const {
         "uniform sampler2D texture;                     \n"
         "uniform lowp vec4 color;                       \n"
         "void main() {                                  \n"
-        "    gl_FragColor = vec4(texture2D(texture, sampleCoord).rgb * color.a, 1.0); \n"
+        "    lowp vec4 glyph = texture2D(texture, sampleCoord); \n"
+        "    gl_FragColor = vec4(glyph.rgb * color.a, glyph.a); \n"
         "}";
 }
 
@@ -162,7 +163,7 @@ void QSGTextMaskMaterialData::updateState(const RenderState &state, QSGMaterial
             state.context()->functions()->glBlendColor(c.redF(),
                                                        c.greenF(),
                                                        c.blueF(),
-                                                       1.0f);
+                                                       c.alphaF());
         }
     }