diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-01-05 16:59:27 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-01-05 16:59:27 +0000 |
commit | c3e159a325892e5a271c06285631c2f5a2277617 (patch) | |
tree | b78a1e201fcff61e402ee1b558ce0fee37ee675e /src/gpu | |
parent | dc9a695a62ffe0f18e2835bffd325b60b64b547b (diff) |
When applying a color matrix, unpremultiply the source, and premultiply
the result.
Review URL: http://codereview.appspot.com/5520046/
git-svn-id: http://skia.googlecode.com/svn/trunk@2969 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrGLProgram.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gpu/GrGLProgram.cpp b/src/gpu/GrGLProgram.cpp index ce87b857af..4d733a9df7 100644 --- a/src/gpu/GrGLProgram.cpp +++ b/src/gpu/GrGLProgram.cpp @@ -373,7 +373,8 @@ static void addColorFilter(GrStringBuilder* fsCode, const char * outputVar, */ static void addColorMatrix(GrStringBuilder* fsCode, const char * outputVar, const char* inColor) { - fsCode->appendf("%s = %s * %s + %s;\n", outputVar, COL_MATRIX_UNI_NAME, inColor, COL_MATRIX_VEC_UNI_NAME); + fsCode->appendf("\t%s = %s * vec4(%s.rgb / %s.a, %s.a) + %s;\n", outputVar, COL_MATRIX_UNI_NAME, inColor, inColor, inColor, COL_MATRIX_VEC_UNI_NAME); + fsCode->appendf("\t%s.rgb *= %s.a;\n", outputVar, outputVar); } namespace { |