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

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

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 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') | src/gpu/effects/GrDashingEffect.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 2015 Google Inc. 2 * Copyright 2015 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/GrCustomXfermode.h" 8 #include "effects/GrCustomXfermode.h"
9 #include "effects/GrCustomXfermodePriv.h" 9 #include "effects/GrCustomXfermodePriv.h"
10 10
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 429
430 /////////////////////////////////////////////////////////////////////////////// 430 ///////////////////////////////////////////////////////////////////////////////
431 // Fragment Processor 431 // Fragment Processor
432 /////////////////////////////////////////////////////////////////////////////// 432 ///////////////////////////////////////////////////////////////////////////////
433 433
434 GrFragmentProcessor* GrCustomXfermode::CreateFP(GrProcessorDataManager* procData Manager, 434 GrFragmentProcessor* GrCustomXfermode::CreateFP(GrProcessorDataManager* procData Manager,
435 SkXfermode::Mode mode, GrTexture * background) { 435 SkXfermode::Mode mode, GrTexture * background) {
436 if (!GrCustomXfermode::IsSupportedMode(mode)) { 436 if (!GrCustomXfermode::IsSupportedMode(mode)) {
437 return NULL; 437 return NULL;
438 } else { 438 } else {
439 return SkNEW_ARGS(GrCustomXferFP, (procDataManager, mode, background)); 439 return new GrCustomXferFP(procDataManager, mode, background);
440 } 440 }
441 } 441 }
442 442
443 /////////////////////////////////////////////////////////////////////////////// 443 ///////////////////////////////////////////////////////////////////////////////
444 444
445 class GLCustomXferFP : public GrGLFragmentProcessor { 445 class GLCustomXferFP : public GrGLFragmentProcessor {
446 public: 446 public:
447 GLCustomXferFP(const GrFragmentProcessor&) {} 447 GLCustomXferFP(const GrFragmentProcessor&) {}
448 ~GLCustomXferFP() override {}; 448 ~GLCustomXferFP() override {};
449 449
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 this->addCoordTransform(&fBackgroundTransform); 486 this->addCoordTransform(&fBackgroundTransform);
487 fBackgroundAccess.reset(background); 487 fBackgroundAccess.reset(background);
488 this->addTextureAccess(&fBackgroundAccess); 488 this->addTextureAccess(&fBackgroundAccess);
489 } 489 }
490 490
491 void GrCustomXferFP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyB uilder* b) const { 491 void GrCustomXferFP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyB uilder* b) const {
492 GLCustomXferFP::GenKey(*this, caps, b); 492 GLCustomXferFP::GenKey(*this, caps, b);
493 } 493 }
494 494
495 GrGLFragmentProcessor* GrCustomXferFP::onCreateGLInstance() const { 495 GrGLFragmentProcessor* GrCustomXferFP::onCreateGLInstance() const {
496 return SkNEW_ARGS(GLCustomXferFP, (*this)); 496 return new GLCustomXferFP(*this);
497 } 497 }
498 498
499 bool GrCustomXferFP::onIsEqual(const GrFragmentProcessor& other) const { 499 bool GrCustomXferFP::onIsEqual(const GrFragmentProcessor& other) const {
500 const GrCustomXferFP& s = other.cast<GrCustomXferFP>(); 500 const GrCustomXferFP& s = other.cast<GrCustomXferFP>();
501 return fMode == s.fMode; 501 return fMode == s.fMode;
502 } 502 }
503 503
504 void GrCustomXferFP::onComputeInvariantOutput(GrInvariantOutput* inout) const { 504 void GrCustomXferFP::onComputeInvariantOutput(GrInvariantOutput* inout) const {
505 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput); 505 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
506 } 506 }
507 507
508 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCustomXferFP); 508 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCustomXferFP);
509 GrFragmentProcessor* GrCustomXferFP::TestCreate(GrProcessorTestData* d) { 509 GrFragmentProcessor* GrCustomXferFP::TestCreate(GrProcessorTestData* d) {
510 int mode = d->fRandom->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode ::kLastSeparableMode); 510 int mode = d->fRandom->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode ::kLastSeparableMode);
511 511
512 return SkNEW_ARGS(GrCustomXferFP, (d->fProcDataManager, static_cast<SkXfermo de::Mode>(mode), 512 return new GrCustomXferFP(d->fProcDataManager, static_cast<SkXfermode::Mode> (mode),
513 d->fTextures[0])); 513 d->fTextures[0]);
514 } 514 }
515 515
516 /////////////////////////////////////////////////////////////////////////////// 516 ///////////////////////////////////////////////////////////////////////////////
517 // Xfer Processor 517 // Xfer Processor
518 /////////////////////////////////////////////////////////////////////////////// 518 ///////////////////////////////////////////////////////////////////////////////
519 519
520 class CustomXP : public GrXferProcessor { 520 class CustomXP : public GrXferProcessor {
521 public: 521 public:
522 CustomXP(SkXfermode::Mode mode, GrBlendEquation hwBlendEquation) 522 CustomXP(SkXfermode::Mode mode, GrBlendEquation hwBlendEquation)
523 : fMode(mode), 523 : fMode(mode),
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 564
565 typedef GrXferProcessor INHERITED; 565 typedef GrXferProcessor INHERITED;
566 }; 566 };
567 567
568 /////////////////////////////////////////////////////////////////////////////// 568 ///////////////////////////////////////////////////////////////////////////////
569 569
570 GrXPFactory* GrCustomXfermode::CreateXPFactory(SkXfermode::Mode mode) { 570 GrXPFactory* GrCustomXfermode::CreateXPFactory(SkXfermode::Mode mode) {
571 if (!GrCustomXfermode::IsSupportedMode(mode)) { 571 if (!GrCustomXfermode::IsSupportedMode(mode)) {
572 return NULL; 572 return NULL;
573 } else { 573 } else {
574 return SkNEW_ARGS(GrCustomXPFactory, (mode)); 574 return new GrCustomXPFactory(mode);
575 } 575 }
576 } 576 }
577 577
578 /////////////////////////////////////////////////////////////////////////////// 578 ///////////////////////////////////////////////////////////////////////////////
579 579
580 class GLCustomXP : public GrGLXferProcessor { 580 class GLCustomXP : public GrGLXferProcessor {
581 public: 581 public:
582 GLCustomXP(const GrXferProcessor&) {} 582 GLCustomXP(const GrXferProcessor&) {}
583 ~GLCustomXP() override {} 583 ~GLCustomXP() override {}
584 584
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 }; 630 };
631 631
632 /////////////////////////////////////////////////////////////////////////////// 632 ///////////////////////////////////////////////////////////////////////////////
633 633
634 void CustomXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder * b) const { 634 void CustomXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder * b) const {
635 GLCustomXP::GenKey(*this, caps, b); 635 GLCustomXP::GenKey(*this, caps, b);
636 } 636 }
637 637
638 GrGLXferProcessor* CustomXP::createGLInstance() const { 638 GrGLXferProcessor* CustomXP::createGLInstance() const {
639 SkASSERT(this->willReadDstColor() != this->hasHWBlendEquation()); 639 SkASSERT(this->willReadDstColor() != this->hasHWBlendEquation());
640 return SkNEW_ARGS(GLCustomXP, (*this)); 640 return new GLCustomXP(*this);
641 } 641 }
642 642
643 bool CustomXP::onIsEqual(const GrXferProcessor& other) const { 643 bool CustomXP::onIsEqual(const GrXferProcessor& other) const {
644 const CustomXP& s = other.cast<CustomXP>(); 644 const CustomXP& s = other.cast<CustomXP>();
645 return fMode == s.fMode && fHWBlendEquation == s.fHWBlendEquation; 645 return fMode == s.fMode && fHWBlendEquation == s.fHWBlendEquation;
646 } 646 }
647 647
648 GrXferProcessor::OptFlags CustomXP::onGetOptimizations(const GrProcOptInfo& colo rPOI, 648 GrXferProcessor::OptFlags CustomXP::onGetOptimizations(const GrProcOptInfo& colo rPOI,
649 const GrProcOptInfo& cove ragePOI, 649 const GrProcOptInfo& cove ragePOI,
650 bool doesStencilWrite, 650 bool doesStencilWrite,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 } 779 }
780 780
781 GrXferProcessor* 781 GrXferProcessor*
782 GrCustomXPFactory::onCreateXferProcessor(const GrCaps& caps, 782 GrCustomXPFactory::onCreateXferProcessor(const GrCaps& caps,
783 const GrProcOptInfo& colorPOI, 783 const GrProcOptInfo& colorPOI,
784 const GrProcOptInfo& coveragePOI, 784 const GrProcOptInfo& coveragePOI,
785 bool hasMixedSamples, 785 bool hasMixedSamples,
786 const DstTexture* dstTexture) const { 786 const DstTexture* dstTexture) const {
787 if (can_use_hw_blend_equation(fHWBlendEquation, coveragePOI, caps)) { 787 if (can_use_hw_blend_equation(fHWBlendEquation, coveragePOI, caps)) {
788 SkASSERT(!dstTexture || !dstTexture->texture()); 788 SkASSERT(!dstTexture || !dstTexture->texture());
789 return SkNEW_ARGS(CustomXP, (fMode, fHWBlendEquation)); 789 return new CustomXP(fMode, fHWBlendEquation);
790 } 790 }
791 return SkNEW_ARGS(CustomXP, (dstTexture, hasMixedSamples, fMode)); 791 return new CustomXP(dstTexture, hasMixedSamples, fMode);
792 } 792 }
793 793
794 bool GrCustomXPFactory::willReadDstColor(const GrCaps& caps, 794 bool GrCustomXPFactory::willReadDstColor(const GrCaps& caps,
795 const GrProcOptInfo& colorPOI, 795 const GrProcOptInfo& colorPOI,
796 const GrProcOptInfo& coveragePOI, 796 const GrProcOptInfo& coveragePOI,
797 bool hasMixedSamples) const { 797 bool hasMixedSamples) const {
798 return !can_use_hw_blend_equation(fHWBlendEquation, coveragePOI, caps); 798 return !can_use_hw_blend_equation(fHWBlendEquation, coveragePOI, caps);
799 } 799 }
800 800
801 void GrCustomXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI, 801 void GrCustomXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
802 InvariantBlendedColor* blendedC olor) const { 802 InvariantBlendedColor* blendedC olor) const {
803 blendedColor->fWillBlendWithDst = true; 803 blendedColor->fWillBlendWithDst = true;
804 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags; 804 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags;
805 } 805 }
806 806
807 GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory); 807 GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory);
808 GrXPFactory* GrCustomXPFactory::TestCreate(GrProcessorTestData* d) { 808 GrXPFactory* GrCustomXPFactory::TestCreate(GrProcessorTestData* d) {
809 int mode = d->fRandom->nextRangeU(SkXfermode::kLastCoeffMode + 1, 809 int mode = d->fRandom->nextRangeU(SkXfermode::kLastCoeffMode + 1,
810 SkXfermode::kLastSeparableMode); 810 SkXfermode::kLastSeparableMode);
811 811
812 return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode))); 812 return new GrCustomXPFactory(static_cast<SkXfermode::Mode>(mode));
813 } 813 }
814 814
OLDNEW
« no previous file with comments | « src/gpu/effects/GrCoverageSetOpXP.cpp ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698