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

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

Issue 926593005: Use SkXfermode as public facing enum for GrPorterDuffXP (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Review fixes Created 5 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/GrCoverageSetOpXP.cpp ('k') | no next file » | 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 259
260 // If we do have coverage determine whether it matters. Dual source blendin g is expensive so 260 // If we do have coverage determine whether it matters. Dual source blendin g is expensive so
261 // we don't do it if we are doing coverage drawing. If we aren't then We al ways do dual source 261 // we don't do it if we are doing coverage drawing. If we aren't then We al ways do dual source
262 // blending if we have any effective coverage stages OR the geometry process or doesn't emits 262 // blending if we have any effective coverage stages OR the geometry process or doesn't emits
263 // solid coverage. 263 // solid coverage.
264 if (!(optFlags & kSetCoverageDrawing_OptFlag) && !hasSolidCoverage) { 264 if (!(optFlags & kSetCoverageDrawing_OptFlag) && !hasSolidCoverage) {
265 if (caps.dualSourceBlendingSupport()) { 265 if (caps.dualSourceBlendingSupport()) {
266 if (kZero_GrBlendCoeff == fDstBlend) { 266 if (kZero_GrBlendCoeff == fDstBlend) {
267 // write the coverage value to second color 267 // write the coverage value to second color
268 fSecondaryOutputType = kCoverage_SecondaryOutputType; 268 fSecondaryOutputType = kCoverage_SecondaryOutputType;
269 fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; 269 fDstBlend = kIS2C_GrBlendCoeff;
270 } else if (kSA_GrBlendCoeff == fDstBlend) { 270 } else if (kSA_GrBlendCoeff == fDstBlend) {
271 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially covered. 271 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially covered.
272 fSecondaryOutputType = kCoverageISA_SecondaryOutputType; 272 fSecondaryOutputType = kCoverageISA_SecondaryOutputType;
273 fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; 273 fDstBlend = kIS2C_GrBlendCoeff;
274 } else if (kSC_GrBlendCoeff == fDstBlend) { 274 } else if (kSC_GrBlendCoeff == fDstBlend) {
275 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially covered. 275 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially covered.
276 fSecondaryOutputType = kCoverageISC_SecondaryOutputType; 276 fSecondaryOutputType = kCoverageISC_SecondaryOutputType;
277 fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; 277 fDstBlend = kIS2C_GrBlendCoeff;
278 } 278 }
279 } 279 }
280 } 280 }
281 } 281 }
282 282
283 GrXferProcessor::OptFlags 283 GrXferProcessor::OptFlags
284 PorterDuffXferProcessor::internalGetOptimizations(const GrProcOptInfo& colorPOI, 284 PorterDuffXferProcessor::internalGetOptimizations(const GrProcOptInfo& colorPOI,
285 const GrProcOptInfo& coverageP OI, 285 const GrProcOptInfo& coverageP OI,
286 bool doesStencilWrite) { 286 bool doesStencilWrite) {
287 bool srcAIsOne; 287 bool srcAIsOne;
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 const GrProcOptInfo& coveragePOI) c onst { 610 const GrProcOptInfo& coveragePOI) c onst {
611 return false; 611 return false;
612 } 612 }
613 613
614 GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory); 614 GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory);
615 615
616 GrXPFactory* GrPorterDuffXPFactory::TestCreate(SkRandom* random, 616 GrXPFactory* GrPorterDuffXPFactory::TestCreate(SkRandom* random,
617 GrContext*, 617 GrContext*,
618 const GrDrawTargetCaps&, 618 const GrDrawTargetCaps&,
619 GrTexture*[]) { 619 GrTexture*[]) {
620 GrBlendCoeff src; 620 SkXfermode::Mode mode = SkXfermode::Mode(random->nextULessThan(SkXfermode::k LastCoeffMode));
621 do { 621 return GrPorterDuffXPFactory::Create(mode);
622 src = GrBlendCoeff(random->nextRangeU(kFirstPublicGrBlendCoeff, kLastPub licGrBlendCoeff));
623 } while (GrBlendCoeffRefsSrc(src));
624
625 GrBlendCoeff dst;
626 do {
627 dst = GrBlendCoeff(random->nextRangeU(kFirstPublicGrBlendCoeff, kLastPub licGrBlendCoeff));
628 } while (GrBlendCoeffRefsDst(dst));
629
630 return GrPorterDuffXPFactory::Create(src, dst);
631 } 622 }
632 623
OLDNEW
« no previous file with comments | « src/gpu/effects/GrCoverageSetOpXP.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698