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

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

Issue 1709153002: Add more specialized fragment builders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make MSVC happy Created 4 years, 10 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
« no previous file with comments | « src/gpu/effects/GrDashingEffect.cpp ('k') | src/gpu/effects/GrDitherEffect.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "GrDistanceFieldGeoProc.h" 8 #include "GrDistanceFieldGeoProc.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "GrTexture.h" 10 #include "GrTexture.h"
(...skipping 16 matching lines...) Expand all
27 GrGLDistanceFieldA8TextGeoProc() 27 GrGLDistanceFieldA8TextGeoProc()
28 : fViewMatrix(SkMatrix::InvalidMatrix()) 28 : fViewMatrix(SkMatrix::InvalidMatrix())
29 #ifdef SK_GAMMA_APPLY_TO_A8 29 #ifdef SK_GAMMA_APPLY_TO_A8
30 , fDistanceAdjust(-1.0f) 30 , fDistanceAdjust(-1.0f)
31 #endif 31 #endif
32 {} 32 {}
33 33
34 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{ 34 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
35 const GrDistanceFieldA8TextGeoProc& dfTexEffect = 35 const GrDistanceFieldA8TextGeoProc& dfTexEffect =
36 args.fGP.cast<GrDistanceFieldA8TextGeoProc>(); 36 args.fGP.cast<GrDistanceFieldA8TextGeoProc>();
37 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 37 GrGLSLPPFragmentBuilder* fragBuilder = args.fFragBuilder;
38 SkAssertResult(fragBuilder->enableFeature( 38 SkAssertResult(fragBuilder->enableFeature(
39 GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature)); 39 GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
40 40
41 GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder; 41 GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
42 GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler; 42 GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
43 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; 43 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
44 44
45 // emit attributes 45 // emit attributes
46 varyingHandler->emitAttributes(dfTexEffect); 46 varyingHandler->emitAttributes(dfTexEffect);
47 47
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 class GrGLDistanceFieldPathGeoProc : public GrGLSLGeometryProcessor { 272 class GrGLDistanceFieldPathGeoProc : public GrGLSLGeometryProcessor {
273 public: 273 public:
274 GrGLDistanceFieldPathGeoProc() 274 GrGLDistanceFieldPathGeoProc()
275 : fViewMatrix(SkMatrix::InvalidMatrix()) 275 : fViewMatrix(SkMatrix::InvalidMatrix())
276 , fTextureSize(SkISize::Make(-1, -1)) {} 276 , fTextureSize(SkISize::Make(-1, -1)) {}
277 277
278 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{ 278 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
279 const GrDistanceFieldPathGeoProc& dfTexEffect = args.fGP.cast<GrDistance FieldPathGeoProc>(); 279 const GrDistanceFieldPathGeoProc& dfTexEffect = args.fGP.cast<GrDistance FieldPathGeoProc>();
280 280
281 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 281 GrGLSLPPFragmentBuilder* fragBuilder = args.fFragBuilder;
282 SkAssertResult(fragBuilder->enableFeature( 282 SkAssertResult(fragBuilder->enableFeature(
283 GrGLSLFragmentShaderBuilder::kStandardDeriv atives_GLSLFeature)); 283 GrGLSLFragmentShaderBuilder::kStandardDeriv atives_GLSLFeature));
284 284
285 GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder; 285 GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
286 GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler; 286 GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
287 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; 287 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
288 288
289 // emit attributes 289 // emit attributes
290 varyingHandler->emitAttributes(dfTexEffect); 290 varyingHandler->emitAttributes(dfTexEffect);
291 291
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 const GrDistanceFieldLCDTextGeoProc& dfTexEffect = 488 const GrDistanceFieldLCDTextGeoProc& dfTexEffect =
489 args.fGP.cast<GrDistanceFieldLCDTextGeoProc>(); 489 args.fGP.cast<GrDistanceFieldLCDTextGeoProc>();
490 490
491 GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder; 491 GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
492 GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler; 492 GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
493 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; 493 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
494 494
495 // emit attributes 495 // emit attributes
496 varyingHandler->emitAttributes(dfTexEffect); 496 varyingHandler->emitAttributes(dfTexEffect);
497 497
498 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 498 GrGLSLPPFragmentBuilder* fragBuilder = args.fFragBuilder;
499 499
500 // setup pass through color 500 // setup pass through color
501 if (!dfTexEffect.colorIgnored()) { 501 if (!dfTexEffect.colorIgnored()) {
502 varyingHandler->addPassThroughAttribute(dfTexEffect.inColor(), args. fOutputColor); 502 varyingHandler->addPassThroughAttribute(dfTexEffect.inColor(), args. fOutputColor);
503 } 503 }
504 504
505 // Setup position 505 // Setup position
506 this->setupPosition(vertBuilder, 506 this->setupPosition(vertBuilder,
507 uniformHandler, 507 uniformHandler,
508 gpArgs, 508 gpArgs,
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; 743 uint32_t flags = kUseLCD_DistanceFieldEffectFlag;
744 flags |= d->fRandom->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; 744 flags |= d->fRandom->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0;
745 flags |= d->fRandom->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; 745 flags |= d->fRandom->nextBool() ? kBGR_DistanceFieldEffectFlag : 0;
746 return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(d->fRandom), 746 return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(d->fRandom),
747 GrTest::TestMatrix(d->fRandom), 747 GrTest::TestMatrix(d->fRandom),
748 d->fTextures[texIdx], params, 748 d->fTextures[texIdx], params,
749 wa, 749 wa,
750 flags, 750 flags,
751 d->fRandom->nextBool()); 751 d->fRandom->nextBool());
752 } 752 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDashingEffect.cpp ('k') | src/gpu/effects/GrDitherEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698