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

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

Issue 1132093004: Move DstCoordTexture to GrXP, rename and remove the word "copy" from dstcopytexture names. (Closed) Base URL: https://skia.googlesource.com/skia.git@copy
Patch Set: remove asserts Created 5 years, 6 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/GrCustomXfermodePriv.h » ('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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 501
502 return SkNEW_ARGS(GrCustomXferFP, (static_cast<SkXfermode::Mode>(mode), text ures[0])); 502 return SkNEW_ARGS(GrCustomXferFP, (static_cast<SkXfermode::Mode>(mode), text ures[0]));
503 } 503 }
504 504
505 /////////////////////////////////////////////////////////////////////////////// 505 ///////////////////////////////////////////////////////////////////////////////
506 // Xfer Processor 506 // Xfer Processor
507 /////////////////////////////////////////////////////////////////////////////// 507 ///////////////////////////////////////////////////////////////////////////////
508 508
509 class CustomXP : public GrXferProcessor { 509 class CustomXP : public GrXferProcessor {
510 public: 510 public:
511 static GrXferProcessor* Create(SkXfermode::Mode mode, const GrDeviceCoordTex ture* dstCopy, 511 static GrXferProcessor* Create(SkXfermode::Mode mode, const DstTexture* dstT exture,
512 bool willReadDstColor) { 512 bool willReadDstColor) {
513 if (!GrCustomXfermode::IsSupportedMode(mode)) { 513 if (!GrCustomXfermode::IsSupportedMode(mode)) {
514 return NULL; 514 return NULL;
515 } else { 515 } else {
516 return SkNEW_ARGS(CustomXP, (mode, dstCopy, willReadDstColor)); 516 return SkNEW_ARGS(CustomXP, (mode, dstTexture, willReadDstColor));
517 } 517 }
518 } 518 }
519 519
520 ~CustomXP() override {}; 520 ~CustomXP() override {};
521 521
522 const char* name() const override { return "Custom Xfermode"; } 522 const char* name() const override { return "Custom Xfermode"; }
523 523
524 GrGLXferProcessor* createGLInstance() const override; 524 GrGLXferProcessor* createGLInstance() const override;
525 525
526 bool hasSecondaryOutput() const override { return false; } 526 bool hasSecondaryOutput() const override { return false; }
527 527
528 SkXfermode::Mode mode() const { return fMode; } 528 SkXfermode::Mode mode() const { return fMode; }
529 bool hasHWBlendEquation() const { return -1 != static_cast<int>(fHWBlendEqua tion); } 529 bool hasHWBlendEquation() const { return -1 != static_cast<int>(fHWBlendEqua tion); }
530 530
531 GrBlendEquation hwBlendEquation() const { 531 GrBlendEquation hwBlendEquation() const {
532 SkASSERT(this->hasHWBlendEquation()); 532 SkASSERT(this->hasHWBlendEquation());
533 return fHWBlendEquation; 533 return fHWBlendEquation;
534 } 534 }
535 535
536 private: 536 private:
537 CustomXP(SkXfermode::Mode mode, const GrDeviceCoordTexture* dstCopy, bool wi llReadDstColor); 537 CustomXP(SkXfermode::Mode mode, const DstTexture*, bool willReadDstColor);
538 538
539 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI, 539 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI,
540 const GrProcOptInfo& coveragePO I, 540 const GrProcOptInfo& coveragePO I,
541 bool doesStencilWrite, 541 bool doesStencilWrite,
542 GrColor* overrideColor, 542 GrColor* overrideColor,
543 const GrCaps& caps) override; 543 const GrCaps& caps) override;
544 544
545 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override; 545 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override;
546 546
547 bool onWillNeedXferBarrier(const GrRenderTarget* rt, 547 bool onWillNeedXferBarrier(const GrRenderTarget* rt,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 } 619 }
620 } 620 }
621 621
622 void onSetData(const GrGLProgramDataManager&, const GrXferProcessor&) overri de {} 622 void onSetData(const GrGLProgramDataManager&, const GrXferProcessor&) overri de {}
623 623
624 typedef GrGLFragmentProcessor INHERITED; 624 typedef GrGLFragmentProcessor INHERITED;
625 }; 625 };
626 626
627 /////////////////////////////////////////////////////////////////////////////// 627 ///////////////////////////////////////////////////////////////////////////////
628 628
629 CustomXP::CustomXP(SkXfermode::Mode mode, const GrDeviceCoordTexture* dstCopy, 629 CustomXP::CustomXP(SkXfermode::Mode mode, const DstTexture* dstTexture, bool wil lReadDstColor)
630 bool willReadDstColor) 630 : INHERITED(dstTexture, willReadDstColor),
631 : INHERITED(dstCopy, willReadDstColor),
632 fMode(mode), 631 fMode(mode),
633 fHWBlendEquation(static_cast<GrBlendEquation>(-1)) { 632 fHWBlendEquation(static_cast<GrBlendEquation>(-1)) {
634 this->initClassID<CustomXP>(); 633 this->initClassID<CustomXP>();
635 } 634 }
636 635
637 void CustomXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder * b) const { 636 void CustomXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder * b) const {
638 GLCustomXP::GenKey(*this, caps, b); 637 GLCustomXP::GenKey(*this, caps, b);
639 } 638 }
640 639
641 GrGLXferProcessor* CustomXP::createGLInstance() const { 640 GrGLXferProcessor* CustomXP::createGLInstance() const {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 782
784 GrCustomXPFactory::GrCustomXPFactory(SkXfermode::Mode mode) 783 GrCustomXPFactory::GrCustomXPFactory(SkXfermode::Mode mode)
785 : fMode(mode) { 784 : fMode(mode) {
786 this->initClassID<GrCustomXPFactory>(); 785 this->initClassID<GrCustomXPFactory>();
787 } 786 }
788 787
789 GrXferProcessor* 788 GrXferProcessor*
790 GrCustomXPFactory::onCreateXferProcessor(const GrCaps& caps, 789 GrCustomXPFactory::onCreateXferProcessor(const GrCaps& caps,
791 const GrProcOptInfo& colorPOI, 790 const GrProcOptInfo& colorPOI,
792 const GrProcOptInfo& coveragePOI, 791 const GrProcOptInfo& coveragePOI,
793 const GrDeviceCoordTexture* dstCopy) co nst { 792 const DstTexture* dstTexture) const {
794 return CustomXP::Create(fMode, dstCopy, this->willReadDstColor(caps, colorPO I, coveragePOI)); 793 return CustomXP::Create(fMode, dstTexture, this->willReadDstColor(caps, colo rPOI, coveragePOI));
795 } 794 }
796 795
797 bool GrCustomXPFactory::willReadDstColor(const GrCaps& caps, 796 bool GrCustomXPFactory::willReadDstColor(const GrCaps& caps,
798 const GrProcOptInfo& colorPOI, 797 const GrProcOptInfo& colorPOI,
799 const GrProcOptInfo& coveragePOI) const { 798 const GrProcOptInfo& coveragePOI) const {
800 if (!caps.advancedBlendEquationSupport()) { 799 if (!caps.advancedBlendEquationSupport()) {
801 // No hardware support for advanced blend equations; we will need to do it in the shader. 800 // No hardware support for advanced blend equations; we will need to do it in the shader.
802 return true; 801 return true;
803 } 802 }
804 if (coveragePOI.isFourChannelOutput()) { 803 if (coveragePOI.isFourChannelOutput()) {
(...skipping 13 matching lines...) Expand all
818 GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory); 817 GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory);
819 GrXPFactory* GrCustomXPFactory::TestCreate(SkRandom* rand, 818 GrXPFactory* GrCustomXPFactory::TestCreate(SkRandom* rand,
820 GrContext*, 819 GrContext*,
821 const GrCaps&, 820 const GrCaps&,
822 GrTexture*[]) { 821 GrTexture*[]) {
823 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas tSeparableMode); 822 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas tSeparableMode);
824 823
825 return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode))); 824 return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode)));
826 } 825 }
827 826
OLDNEW
« no previous file with comments | « src/gpu/effects/GrCoverageSetOpXP.cpp ('k') | src/gpu/effects/GrCustomXfermodePriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698