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

Side by Side Diff: include/gpu/effects/GrPorterDuffXferProcessor.h

Issue 900883002: Revert of Move DstCopy on gpu into the GrXferProcessor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« no previous file with comments | « include/gpu/GrXferProcessor.h ('k') | src/effects/SkArithmeticMode_gpu.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 #ifndef GrPorterDuffXferProcessor_DEFINED 8 #ifndef GrPorterDuffXferProcessor_DEFINED
9 #define GrPorterDuffXferProcessor_DEFINED 9 #define GrPorterDuffXferProcessor_DEFINED
10 10
11 #include "GrTypes.h" 11 #include "GrTypes.h"
12 #include "GrXferProcessor.h" 12 #include "GrXferProcessor.h"
13 #include "SkXfermode.h" 13 #include "SkXfermode.h"
14 14
15 class GrDrawTargetCaps;
16 class GrProcOptInfo; 15 class GrProcOptInfo;
17 16
18 class GrPorterDuffXferProcessor : public GrXferProcessor { 17 class GrPorterDuffXferProcessor : public GrXferProcessor {
19 public: 18 public:
20 static GrXferProcessor* Create(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend, 19 static GrXferProcessor* Create(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend,
21 GrColor constant, const GrDeviceCoordTexture* dstCopy, 20 GrColor constant = 0) {
22 bool willReadDstColor) { 21 return SkNEW_ARGS(GrPorterDuffXferProcessor, (srcBlend, dstBlend, consta nt));
23 return SkNEW_ARGS(GrPorterDuffXferProcessor, (srcBlend, dstBlend, consta nt, dstCopy,
24 willReadDstColor));
25 } 22 }
26 23
27 ~GrPorterDuffXferProcessor() SK_OVERRIDE; 24 ~GrPorterDuffXferProcessor() SK_OVERRIDE;
28 25
29 const char* name() const SK_OVERRIDE { return "Porter Duff"; } 26 const char* name() const SK_OVERRIDE { return "Porter Duff"; }
30 27
28 void getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE;
29
31 GrGLXferProcessor* createGLInstance() const SK_OVERRIDE; 30 GrGLXferProcessor* createGLInstance() const SK_OVERRIDE;
32 31
33 bool hasSecondaryOutput() const SK_OVERRIDE; 32 bool hasSecondaryOutput() const SK_OVERRIDE;
34 33
35 /////////////////////////////////////////////////////////////////////////// 34 ///////////////////////////////////////////////////////////////////////////
36 /// @name Stage Output Types 35 /// @name Stage Output Types
37 //// 36 ////
38 37
39 enum PrimaryOutputType { 38 enum PrimaryOutputType {
40 kNone_PrimaryOutputType, 39 kNone_PrimaryOutputType,
(...skipping 28 matching lines...) Expand all
69 GrColor* overrideColor, 68 GrColor* overrideColor,
70 const GrDrawTargetCaps& caps) SK_ OVERRIDE; 69 const GrDrawTargetCaps& caps) SK_ OVERRIDE;
71 70
72 void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE { 71 void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE {
73 blendInfo->fSrcBlend = fSrcBlend; 72 blendInfo->fSrcBlend = fSrcBlend;
74 blendInfo->fDstBlend = fDstBlend; 73 blendInfo->fDstBlend = fDstBlend;
75 blendInfo->fBlendConstant = fBlendConstant; 74 blendInfo->fBlendConstant = fBlendConstant;
76 } 75 }
77 76
78 private: 77 private:
79 GrPorterDuffXferProcessor(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend, GrCo lor constant, 78 GrPorterDuffXferProcessor(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend, GrCo lor constant);
80 const GrDeviceCoordTexture* dstCopy, bool willRead DstColor);
81
82 void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) con st SK_OVERRIDE;
83 79
84 bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE { 80 bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE {
85 const GrPorterDuffXferProcessor& xp = xpBase.cast<GrPorterDuffXferProces sor>(); 81 const GrPorterDuffXferProcessor& xp = xpBase.cast<GrPorterDuffXferProces sor>();
86 if (fSrcBlend != xp.fSrcBlend || 82 if (fSrcBlend != xp.fSrcBlend ||
87 fDstBlend != xp.fDstBlend || 83 fDstBlend != xp.fDstBlend ||
88 fBlendConstant != xp.fBlendConstant || 84 fBlendConstant != xp.fBlendConstant ||
89 fPrimaryOutputType != xp.fPrimaryOutputType || 85 fPrimaryOutputType != xp.fPrimaryOutputType ||
90 fSecondaryOutputType != xp.fSecondaryOutputType) { 86 fSecondaryOutputType != xp.fSecondaryOutputType) {
91 return false; 87 return false;
92 } 88 }
(...skipping 23 matching lines...) Expand all
116 static GrXPFactory* Create(SkXfermode::Mode mode); 112 static GrXPFactory* Create(SkXfermode::Mode mode);
117 113
118 static GrXPFactory* Create(SkXfermode::Coeff src, SkXfermode::Coeff dst) { 114 static GrXPFactory* Create(SkXfermode::Coeff src, SkXfermode::Coeff dst) {
119 return SkNEW_ARGS(GrPorterDuffXPFactory, ((GrBlendCoeff)(src), (GrBlendC oeff)(dst))); 115 return SkNEW_ARGS(GrPorterDuffXPFactory, ((GrBlendCoeff)(src), (GrBlendC oeff)(dst)));
120 } 116 }
121 117
122 static GrXPFactory* Create(GrBlendCoeff src, GrBlendCoeff dst) { 118 static GrXPFactory* Create(GrBlendCoeff src, GrBlendCoeff dst) {
123 return SkNEW_ARGS(GrPorterDuffXPFactory, (src, dst)); 119 return SkNEW_ARGS(GrPorterDuffXPFactory, (src, dst));
124 } 120 }
125 121
122 GrXferProcessor* createXferProcessor(const GrProcOptInfo& colorPOI,
123 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE;
124
126 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const SK_OVERRIDE; 125 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const SK_OVERRIDE;
127 126
128 bool canApplyCoverage(const GrProcOptInfo& colorPOI, 127 bool canApplyCoverage(const GrProcOptInfo& colorPOI,
129 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE; 128 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE;
130 129
131 bool canTweakAlphaForCoverage() const SK_OVERRIDE; 130 bool canTweakAlphaForCoverage() const SK_OVERRIDE;
132 131
133 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI, 132 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
134 GrXPFactory::InvariantOutput*) const SK_OVERRIDE; 133 GrXPFactory::InvariantOutput*) const SK_OVERRIDE;
135 134
135 bool willReadDst() const SK_OVERRIDE { return false; }
136
136 private: 137 private:
137 GrPorterDuffXPFactory(GrBlendCoeff src, GrBlendCoeff dst); 138 GrPorterDuffXPFactory(GrBlendCoeff src, GrBlendCoeff dst);
138 139
139 GrXferProcessor* onCreateXferProcessor(const GrProcOptInfo& colorPOI,
140 const GrProcOptInfo& coveragePOI,
141 const GrDeviceCoordTexture* dstCopy) const SK_OVERRIDE;
142
143 bool willReadDstColor() const SK_OVERRIDE;
144
145 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { 140 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE {
146 const GrPorterDuffXPFactory& xpf = xpfBase.cast<GrPorterDuffXPFactory>() ; 141 const GrPorterDuffXPFactory& xpf = xpfBase.cast<GrPorterDuffXPFactory>() ;
147 return (fSrcCoeff == xpf.fSrcCoeff && fDstCoeff == xpf.fDstCoeff); 142 return (fSrcCoeff == xpf.fSrcCoeff && fDstCoeff == xpf.fDstCoeff);
148 } 143 }
149 144
150 GR_DECLARE_XP_FACTORY_TEST; 145 GR_DECLARE_XP_FACTORY_TEST;
151 146
152 GrBlendCoeff fSrcCoeff; 147 GrBlendCoeff fSrcCoeff;
153 GrBlendCoeff fDstCoeff; 148 GrBlendCoeff fDstCoeff;
154 149
155 typedef GrXPFactory INHERITED; 150 typedef GrXPFactory INHERITED;
156 }; 151 };
157 152
158 #endif 153 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrXferProcessor.h ('k') | src/effects/SkArithmeticMode_gpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698