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

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: Move coverage to inclue 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
« src/gpu/SkGpuDevice.cpp ('K') | « src/gpu/effects/GrCoverageSetOpXP.h ('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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 const GrProcOptInfo& coveragePOI) c onst { 591 const GrProcOptInfo& coveragePOI) c onst {
592 return false; 592 return false;
593 } 593 }
594 594
595 GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory); 595 GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory);
596 596
597 GrXPFactory* GrPorterDuffXPFactory::TestCreate(SkRandom* random, 597 GrXPFactory* GrPorterDuffXPFactory::TestCreate(SkRandom* random,
598 GrContext*, 598 GrContext*,
599 const GrDrawTargetCaps&, 599 const GrDrawTargetCaps&,
600 GrTexture*[]) { 600 GrTexture*[]) {
601 GrBlendCoeff src; 601 SkXfermode::Mode mode = SkXfermode::Mode(random->nextULessThan(SkXfermode::k LastCoeffMode));
602 do { 602 return GrPorterDuffXPFactory::Create(mode);
603 src = GrBlendCoeff(random->nextRangeU(kFirstPublicGrBlendCoeff, kLastPub licGrBlendCoeff));
604 } while (GrBlendCoeffRefsSrc(src));
605
606 GrBlendCoeff dst;
607 do {
608 dst = GrBlendCoeff(random->nextRangeU(kFirstPublicGrBlendCoeff, kLastPub licGrBlendCoeff));
609 } while (GrBlendCoeffRefsDst(dst));
610
611 return GrPorterDuffXPFactory::Create(src, dst);
612 } 603 }
613 604
OLDNEW
« src/gpu/SkGpuDevice.cpp ('K') | « src/gpu/effects/GrCoverageSetOpXP.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698