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

Side by Side Diff: src/gpu/effects/GrPorterDuffXferProcessor.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, 7 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/GrDisableColorXP.cpp ('k') | src/gpu/gl/GrGLProgram.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 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 17 matching lines...) Expand all
28 find that only 1, ISA, and ISC produce the correct destination when applied to S' and D. 28 find that only 1, ISA, and ISC produce the correct destination when applied to S' and D.
29 */ 29 */
30 return kOne_GrBlendCoeff == dstCoeff || 30 return kOne_GrBlendCoeff == dstCoeff ||
31 kISA_GrBlendCoeff == dstCoeff || 31 kISA_GrBlendCoeff == dstCoeff ||
32 kISC_GrBlendCoeff == dstCoeff; 32 kISC_GrBlendCoeff == dstCoeff;
33 } 33 }
34 34
35 class PorterDuffXferProcessor : public GrXferProcessor { 35 class PorterDuffXferProcessor : public GrXferProcessor {
36 public: 36 public:
37 static GrXferProcessor* Create(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend, 37 static GrXferProcessor* Create(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend,
38 GrColor constant, const GrDeviceCoordTexture* dstCopy, 38 GrColor constant, const DstTexture* dstTextur e,
39 bool willReadDstColor) { 39 bool willReadDstColor) {
40 return SkNEW_ARGS(PorterDuffXferProcessor, (srcBlend, dstBlend, constant , dstCopy, 40 return SkNEW_ARGS(PorterDuffXferProcessor, (srcBlend, dstBlend, constant , dstTexture,
41 willReadDstColor)); 41 willReadDstColor));
42 } 42 }
43 43
44 ~PorterDuffXferProcessor() override; 44 ~PorterDuffXferProcessor() override;
45 45
46 const char* name() const override { return "Porter Duff"; } 46 const char* name() const override { return "Porter Duff"; }
47 47
48 GrGLXferProcessor* createGLInstance() const override; 48 GrGLXferProcessor* createGLInstance() const override;
49 49
50 bool hasSecondaryOutput() const override; 50 bool hasSecondaryOutput() const override;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 }; 82 };
83 83
84 PrimaryOutputType primaryOutputType() const { return fPrimaryOutputType; } 84 PrimaryOutputType primaryOutputType() const { return fPrimaryOutputType; }
85 SecondaryOutputType secondaryOutputType() const { return fSecondaryOutputTyp e; } 85 SecondaryOutputType secondaryOutputType() const { return fSecondaryOutputTyp e; }
86 86
87 GrBlendCoeff getSrcBlend() const { return fSrcBlend; } 87 GrBlendCoeff getSrcBlend() const { return fSrcBlend; }
88 GrBlendCoeff getDstBlend() const { return fDstBlend; } 88 GrBlendCoeff getDstBlend() const { return fDstBlend; }
89 89
90 private: 90 private:
91 PorterDuffXferProcessor(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend, GrColo r constant, 91 PorterDuffXferProcessor(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend, GrColo r constant,
92 const GrDeviceCoordTexture* dstCopy, bool willReadDs tColor); 92 const DstTexture*, bool willReadDstColor);
93 93
94 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI, 94 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI,
95 const GrProcOptInfo& coveragePO I, 95 const GrProcOptInfo& coveragePO I,
96 bool doesStencilWrite, 96 bool doesStencilWrite,
97 GrColor* overrideColor, 97 GrColor* overrideColor,
98 const GrCaps& caps) override; 98 const GrCaps& caps) override;
99 99
100 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override; 100 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override;
101 101
102 void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override { 102 void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override {
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 void onSetData(const GrGLProgramDataManager&, const GrXferProcessor&) overri de {}; 270 void onSetData(const GrGLProgramDataManager&, const GrXferProcessor&) overri de {};
271 271
272 typedef GrGLXferProcessor INHERITED; 272 typedef GrGLXferProcessor INHERITED;
273 }; 273 };
274 274
275 /////////////////////////////////////////////////////////////////////////////// 275 ///////////////////////////////////////////////////////////////////////////////
276 276
277 PorterDuffXferProcessor::PorterDuffXferProcessor(GrBlendCoeff srcBlend, 277 PorterDuffXferProcessor::PorterDuffXferProcessor(GrBlendCoeff srcBlend,
278 GrBlendCoeff dstBlend, 278 GrBlendCoeff dstBlend,
279 GrColor constant, 279 GrColor constant,
280 const GrDeviceCoordTexture* dst Copy, 280 const DstTexture* dstTexture,
281 bool willReadDstColor) 281 bool willReadDstColor)
282 : INHERITED(dstCopy, willReadDstColor) 282 : INHERITED(dstTexture, willReadDstColor)
283 , fSrcBlend(srcBlend) 283 , fSrcBlend(srcBlend)
284 , fDstBlend(dstBlend) 284 , fDstBlend(dstBlend)
285 , fBlendConstant(constant) 285 , fBlendConstant(constant)
286 , fPrimaryOutputType(kModulate_PrimaryOutputType) 286 , fPrimaryOutputType(kModulate_PrimaryOutputType)
287 , fSecondaryOutputType(kNone_SecondaryOutputType) { 287 , fSecondaryOutputType(kNone_SecondaryOutputType) {
288 this->initClassID<PorterDuffXferProcessor>(); 288 this->initClassID<PorterDuffXferProcessor>();
289 } 289 }
290 290
291 PorterDuffXferProcessor::~PorterDuffXferProcessor() { 291 PorterDuffXferProcessor::~PorterDuffXferProcessor() {
292 } 292 }
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 } 669 }
670 default: 670 default:
671 return NULL; 671 return NULL;
672 } 672 }
673 } 673 }
674 674
675 GrXferProcessor* 675 GrXferProcessor*
676 GrPorterDuffXPFactory::onCreateXferProcessor(const GrCaps& caps, 676 GrPorterDuffXPFactory::onCreateXferProcessor(const GrCaps& caps,
677 const GrProcOptInfo& colorPOI, 677 const GrProcOptInfo& colorPOI,
678 const GrProcOptInfo& covPOI, 678 const GrProcOptInfo& covPOI,
679 const GrDeviceCoordTexture* dstCopy ) const { 679 const DstTexture* dstTexture) const {
680 if (covPOI.isFourChannelOutput()) { 680 if (covPOI.isFourChannelOutput()) {
681 return PDLCDXferProcessor::Create(fSrcCoeff, fDstCoeff, colorPOI); 681 return PDLCDXferProcessor::Create(fSrcCoeff, fDstCoeff, colorPOI);
682 } else { 682 } else {
683 return PorterDuffXferProcessor::Create(fSrcCoeff, fDstCoeff, 0, dstCopy, 683 return PorterDuffXferProcessor::Create(fSrcCoeff, fDstCoeff, 0, dstTextu re,
684 this->willReadDstColor(caps, colo rPOI, covPOI)); 684 this->willReadDstColor(caps, colo rPOI, covPOI));
685 } 685 }
686 } 686 }
687 687
688 bool GrPorterDuffXPFactory::supportsRGBCoverage(GrColor /*knownColor*/, 688 bool GrPorterDuffXPFactory::supportsRGBCoverage(GrColor /*knownColor*/,
689 uint32_t knownColorFlags) const { 689 uint32_t knownColorFlags) const {
690 if (kOne_GrBlendCoeff == fSrcCoeff && kISA_GrBlendCoeff == fDstCoeff && 690 if (kOne_GrBlendCoeff == fSrcCoeff && kISA_GrBlendCoeff == fDstCoeff &&
691 kRGBA_GrColorComponentFlags == knownColorFlags) { 691 kRGBA_GrColorComponentFlags == knownColorFlags) {
692 return true; 692 return true;
693 } 693 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory); 799 GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory);
800 800
801 GrXPFactory* GrPorterDuffXPFactory::TestCreate(SkRandom* random, 801 GrXPFactory* GrPorterDuffXPFactory::TestCreate(SkRandom* random,
802 GrContext*, 802 GrContext*,
803 const GrCaps&, 803 const GrCaps&,
804 GrTexture*[]) { 804 GrTexture*[]) {
805 SkXfermode::Mode mode = SkXfermode::Mode(random->nextULessThan(SkXfermode::k LastCoeffMode)); 805 SkXfermode::Mode mode = SkXfermode::Mode(random->nextULessThan(SkXfermode::k LastCoeffMode));
806 return GrPorterDuffXPFactory::Create(mode); 806 return GrPorterDuffXPFactory::Create(mode);
807 } 807 }
808 808
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDisableColorXP.cpp ('k') | src/gpu/gl/GrGLProgram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698