Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Side by Side Diff: src/gpu/effects/GrBitmapTextGeoProc.cpp

Issue 1339213004: On gpu, use max(r,g,b) for coverage alpha in LCD and update lcd blend gm. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrBitmapTextGeoProc.h" 8 #include "GrBitmapTextGeoProc.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "GrTexture.h" 10 #include "GrTexture.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 fsBuilder->appendTextureLookupAndModulate(args.fOutputColor, 62 fsBuilder->appendTextureLookupAndModulate(args.fOutputColor,
63 args.fSamplers[0], 63 args.fSamplers[0],
64 v.fsIn(), 64 v.fsIn(),
65 kVec2f_GrSLType); 65 kVec2f_GrSLType);
66 fsBuilder->codeAppend(";"); 66 fsBuilder->codeAppend(";");
67 fsBuilder->codeAppendf("%s = vec4(1);", args.fOutputCoverage); 67 fsBuilder->codeAppendf("%s = vec4(1);", args.fOutputCoverage);
68 } else { 68 } else {
69 fsBuilder->codeAppendf("%s = ", args.fOutputCoverage); 69 fsBuilder->codeAppendf("%s = ", args.fOutputCoverage);
70 fsBuilder->appendTextureLookup(args.fSamplers[0], v.fsIn(), kVec2f_G rSLType); 70 fsBuilder->appendTextureLookup(args.fSamplers[0], v.fsIn(), kVec2f_G rSLType);
71 fsBuilder->codeAppend(";"); 71 fsBuilder->codeAppend(";");
72 if (cte.maskFormat() == kA565_GrMaskFormat) {
73 // set alpha to be max of rgb coverage
74 fsBuilder->codeAppendf("%s.a = max(max(%s.r, %s.g), %s.b);",
75 args.fOutputCoverage, args.fOutputCoverag e,
76 args.fOutputCoverage, args.fOutputCoverag e);
77 }
72 } 78 }
73 } 79 }
74 80
75 void setData(const GrGLProgramDataManager& pdman, const GrPrimitiveProcessor & gp) override { 81 void setData(const GrGLProgramDataManager& pdman, const GrPrimitiveProcessor & gp) override {
76 const GrBitmapTextGeoProc& btgp = gp.cast<GrBitmapTextGeoProc>(); 82 const GrBitmapTextGeoProc& btgp = gp.cast<GrBitmapTextGeoProc>();
77 if (btgp.color() != fColor && !btgp.hasVertexColor()) { 83 if (btgp.color() != fColor && !btgp.hasVertexColor()) {
78 GrGLfloat c[4]; 84 GrGLfloat c[4];
79 GrColorToRGBAFloat(btgp.color(), c); 85 GrColorToRGBAFloat(btgp.color(), c);
80 pdman.set4fv(fColorUniform, 1, c); 86 pdman.set4fv(fColorUniform, 1, c);
81 fColor = btgp.color(); 87 fColor = btgp.color();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 break; 182 break;
177 case 2: 183 case 2:
178 format = kARGB_GrMaskFormat; 184 format = kARGB_GrMaskFormat;
179 break; 185 break;
180 } 186 }
181 187
182 return GrBitmapTextGeoProc::Create(GrRandomColor(d->fRandom), d->fTextures[t exIdx], params, 188 return GrBitmapTextGeoProc::Create(GrRandomColor(d->fRandom), d->fTextures[t exIdx], params,
183 format, GrTest::TestMatrix(d->fRandom), 189 format, GrTest::TestMatrix(d->fRandom),
184 d->fRandom->nextBool()); 190 d->fRandom->nextBool());
185 } 191 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698