OLD | NEW |
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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 GrGLXferProcessor* PorterDuffXferProcessor::createGLInstance() const { | 421 GrGLXferProcessor* PorterDuffXferProcessor::createGLInstance() const { |
422 return SkNEW(GLPorterDuffXferProcessor); | 422 return SkNEW(GLPorterDuffXferProcessor); |
423 } | 423 } |
424 | 424 |
425 GrXferProcessor::OptFlags | 425 GrXferProcessor::OptFlags |
426 PorterDuffXferProcessor::onGetOptimizations(const GrProcOptInfo& colorPOI, | 426 PorterDuffXferProcessor::onGetOptimizations(const GrProcOptInfo& colorPOI, |
427 const GrProcOptInfo& coveragePOI, | 427 const GrProcOptInfo& coveragePOI, |
428 bool doesStencilWrite, | 428 bool doesStencilWrite, |
429 GrColor* overrideColor, | 429 GrColor* overrideColor, |
430 const GrCaps& caps) { | 430 const GrCaps& caps) { |
431 GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags; | 431 GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_Opt; |
432 if (!fBlendFormula.modifiesDst()) { | 432 if (!fBlendFormula.modifiesDst()) { |
433 if (!doesStencilWrite) { | 433 if (!doesStencilWrite) { |
434 optFlags |= GrXferProcessor::kSkipDraw_OptFlag; | 434 optFlags |= GrXferProcessor::kSkipDraw_OptFlag; |
435 } | 435 } |
436 optFlags |= (GrXferProcessor::kIgnoreColor_OptFlag | | 436 optFlags |= (GrXferProcessor::kIgnoreColor_OptFlag | |
437 GrXferProcessor::kIgnoreCoverage_OptFlag | | 437 GrXferProcessor::kIgnoreCoverage_OptFlag | |
438 GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag); | 438 GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag); |
439 } else { | 439 } else { |
440 if (!fBlendFormula.usesInputColor()) { | 440 if (!fBlendFormula.usesInputColor()) { |
441 optFlags |= GrXferProcessor::kIgnoreColor_OptFlag; | 441 optFlags |= GrXferProcessor::kIgnoreColor_OptFlag; |
(...skipping 22 matching lines...) Expand all Loading... |
464 | 464 |
465 const char* name() const override { return "Porter Duff Shader"; } | 465 const char* name() const override { return "Porter Duff Shader"; } |
466 | 466 |
467 GrGLXferProcessor* createGLInstance() const override; | 467 GrGLXferProcessor* createGLInstance() const override; |
468 | 468 |
469 SkXfermode::Mode getXfermode() const { return fXfermode; } | 469 SkXfermode::Mode getXfermode() const { return fXfermode; } |
470 | 470 |
471 private: | 471 private: |
472 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo&, const GrP
rocOptInfo&, | 472 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo&, const GrP
rocOptInfo&, |
473 bool, GrColor*, const GrCaps&)
override { | 473 bool, GrColor*, const GrCaps&)
override { |
474 return kNone_OptFlags; | 474 return kNone_Opt; |
475 } | 475 } |
476 | 476 |
477 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst override; | 477 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst override; |
478 | 478 |
479 bool onIsEqual(const GrXferProcessor& xpBase) const override { | 479 bool onIsEqual(const GrXferProcessor& xpBase) const override { |
480 const ShaderPDXferProcessor& xp = xpBase.cast<ShaderPDXferProcessor>(); | 480 const ShaderPDXferProcessor& xp = xpBase.cast<ShaderPDXferProcessor>(); |
481 return fXfermode == xp.fXfermode; | 481 return fXfermode == xp.fXfermode; |
482 } | 482 } |
483 | 483 |
484 const SkXfermode::Mode fXfermode; | 484 const SkXfermode::Mode fXfermode; |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 int* outSecondary) { | 821 int* outSecondary) { |
822 if (!!strcmp(xp->name(), "Porter Duff")) { | 822 if (!!strcmp(xp->name(), "Porter Duff")) { |
823 *outPrimary = *outSecondary = -1; | 823 *outPrimary = *outSecondary = -1; |
824 return; | 824 return; |
825 } | 825 } |
826 BlendFormula blendFormula = static_cast<const PorterDuffXferProcessor*>(xp)-
>getBlendFormula(); | 826 BlendFormula blendFormula = static_cast<const PorterDuffXferProcessor*>(xp)-
>getBlendFormula(); |
827 *outPrimary = blendFormula.fPrimaryOutputType; | 827 *outPrimary = blendFormula.fPrimaryOutputType; |
828 *outSecondary = blendFormula.fSecondaryOutputType; | 828 *outSecondary = blendFormula.fSecondaryOutputType; |
829 } | 829 } |
830 | 830 |
OLD | NEW |