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

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

Issue 1110033004: Make XPFragmentBuilder only Builder with access to DstCopy. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/GrOvalEffect.cpp ('k') | src/gpu/effects/GrRRectEffect.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 2014 Google Inc. 2 * Copyright 2014 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 "effects/GrPorterDuffXferProcessor.h" 8 #include "effects/GrPorterDuffXferProcessor.h"
9 9
10 #include "GrBlend.h" 10 #include "GrBlend.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 GrBlendCoeff fDstBlend; 133 GrBlendCoeff fDstBlend;
134 GrColor fBlendConstant; 134 GrColor fBlendConstant;
135 PrimaryOutputType fPrimaryOutputType; 135 PrimaryOutputType fPrimaryOutputType;
136 SecondaryOutputType fSecondaryOutputType; 136 SecondaryOutputType fSecondaryOutputType;
137 137
138 typedef GrXferProcessor INHERITED; 138 typedef GrXferProcessor INHERITED;
139 }; 139 };
140 140
141 /////////////////////////////////////////////////////////////////////////////// 141 ///////////////////////////////////////////////////////////////////////////////
142 142
143 bool append_porterduff_term(GrGLFPFragmentBuilder* fsBuilder, GrBlendCoeff coeff , 143 bool append_porterduff_term(GrGLXPFragmentBuilder* fsBuilder, GrBlendCoeff coeff ,
144 const char* colorName, const char* srcColorName, 144 const char* colorName, const char* srcColorName,
145 const char* dstColorName, bool hasPrevious) { 145 const char* dstColorName, bool hasPrevious) {
146 if (kZero_GrBlendCoeff == coeff) { 146 if (kZero_GrBlendCoeff == coeff) {
147 return hasPrevious; 147 return hasPrevious;
148 } else { 148 } else {
149 if (hasPrevious) { 149 if (hasPrevious) {
150 fsBuilder->codeAppend(" + "); 150 fsBuilder->codeAppend(" + ");
151 } 151 }
152 fsBuilder->codeAppendf("%s", colorName); 152 fsBuilder->codeAppendf("%s", colorName);
153 switch (coeff) { 153 switch (coeff) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 b->add32(xp.secondaryOutputType()); 197 b->add32(xp.secondaryOutputType());
198 if (xp.willReadDstColor()) { 198 if (xp.willReadDstColor()) {
199 b->add32(xp.getSrcBlend()); 199 b->add32(xp.getSrcBlend());
200 b->add32(xp.getDstBlend()); 200 b->add32(xp.getDstBlend());
201 } 201 }
202 }; 202 };
203 203
204 private: 204 private:
205 void onEmitCode(const EmitArgs& args) override { 205 void onEmitCode(const EmitArgs& args) override {
206 const PorterDuffXferProcessor& xp = args.fXP.cast<PorterDuffXferProcesso r>(); 206 const PorterDuffXferProcessor& xp = args.fXP.cast<PorterDuffXferProcesso r>();
207 GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 207 GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
208 if (PorterDuffXferProcessor::kCustom_PrimaryOutputType != xp.primaryOutp utType()) { 208 if (PorterDuffXferProcessor::kCustom_PrimaryOutputType != xp.primaryOutp utType()) {
209 SkASSERT(!xp.willReadDstColor()); 209 SkASSERT(!xp.willReadDstColor());
210 switch(xp.secondaryOutputType()) { 210 switch(xp.secondaryOutputType()) {
211 case PorterDuffXferProcessor::kNone_SecondaryOutputType: 211 case PorterDuffXferProcessor::kNone_SecondaryOutputType:
212 break; 212 break;
213 case PorterDuffXferProcessor::kCoverage_SecondaryOutputType: 213 case PorterDuffXferProcessor::kCoverage_SecondaryOutputType:
214 fsBuilder->codeAppendf("%s = %s;", args.fOutputSecondary, 214 fsBuilder->codeAppendf("%s = %s;", args.fOutputSecondary,
215 args.fInputCoverage); 215 args.fInputCoverage);
216 break; 216 break;
217 case PorterDuffXferProcessor::kCoverageISA_SecondaryOutputType: 217 case PorterDuffXferProcessor::kCoverageISA_SecondaryOutputType:
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory); 700 GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory);
701 701
702 GrXPFactory* GrPorterDuffXPFactory::TestCreate(SkRandom* random, 702 GrXPFactory* GrPorterDuffXPFactory::TestCreate(SkRandom* random,
703 GrContext*, 703 GrContext*,
704 const GrDrawTargetCaps&, 704 const GrDrawTargetCaps&,
705 GrTexture*[]) { 705 GrTexture*[]) {
706 SkXfermode::Mode mode = SkXfermode::Mode(random->nextULessThan(SkXfermode::k LastCoeffMode)); 706 SkXfermode::Mode mode = SkXfermode::Mode(random->nextULessThan(SkXfermode::k LastCoeffMode));
707 return GrPorterDuffXPFactory::Create(mode); 707 return GrPorterDuffXPFactory::Create(mode);
708 } 708 }
709 709
OLDNEW
« no previous file with comments | « src/gpu/effects/GrOvalEffect.cpp ('k') | src/gpu/effects/GrRRectEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698