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

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

Issue 1443743002: Rename some processor functions from GL to GLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@primProcs
Patch Set: nits Created 5 years, 1 month 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 9
10 #include "GrCoordTransform.h" 10 #include "GrCoordTransform.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 CustomXP(const DstTexture* dstTexture, bool hasMixedSamples, SkXfermode::Mod e mode) 82 CustomXP(const DstTexture* dstTexture, bool hasMixedSamples, SkXfermode::Mod e mode)
83 : INHERITED(dstTexture, true, hasMixedSamples), 83 : INHERITED(dstTexture, true, hasMixedSamples),
84 fMode(mode), 84 fMode(mode),
85 fHWBlendEquation(static_cast<GrBlendEquation>(-1)) { 85 fHWBlendEquation(static_cast<GrBlendEquation>(-1)) {
86 this->initClassID<CustomXP>(); 86 this->initClassID<CustomXP>();
87 } 87 }
88 88
89 const char* name() const override { return "Custom Xfermode"; } 89 const char* name() const override { return "Custom Xfermode"; }
90 90
91 GrGLSLXferProcessor* createGLInstance() const override; 91 GrGLSLXferProcessor* createGLSLInstance() const override;
92 92
93 SkXfermode::Mode mode() const { return fMode; } 93 SkXfermode::Mode mode() const { return fMode; }
94 bool hasHWBlendEquation() const { return -1 != static_cast<int>(fHWBlendEqua tion); } 94 bool hasHWBlendEquation() const { return -1 != static_cast<int>(fHWBlendEqua tion); }
95 95
96 GrBlendEquation hwBlendEquation() const { 96 GrBlendEquation hwBlendEquation() const {
97 SkASSERT(this->hasHWBlendEquation()); 97 SkASSERT(this->hasHWBlendEquation());
98 return fHWBlendEquation; 98 return fHWBlendEquation;
99 } 99 }
100 100
101 private: 101 private:
102 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI, 102 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI,
103 const GrProcOptInfo& coveragePO I, 103 const GrProcOptInfo& coveragePO I,
104 bool doesStencilWrite, 104 bool doesStencilWrite,
105 GrColor* overrideColor, 105 GrColor* overrideColor,
106 const GrCaps& caps) override; 106 const GrCaps& caps) override;
107 107
108 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override; 108 void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
109 109
110 GrXferBarrierType onXferBarrier(const GrRenderTarget*, const GrCaps&) const override; 110 GrXferBarrierType onXferBarrier(const GrRenderTarget*, const GrCaps&) const override;
111 111
112 void onGetBlendInfo(BlendInfo*) const override; 112 void onGetBlendInfo(BlendInfo*) const override;
113 113
114 bool onIsEqual(const GrXferProcessor& xpBase) const override; 114 bool onIsEqual(const GrXferProcessor& xpBase) const override;
115 115
116 const SkXfermode::Mode fMode; 116 const SkXfermode::Mode fMode;
117 const GrBlendEquation fHWBlendEquation; 117 const GrBlendEquation fHWBlendEquation;
118 118
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 GrGLSLBlend::AppendMode(fsBuilder, srcColor, dstColor, outColor, xp.mode ()); 168 GrGLSLBlend::AppendMode(fsBuilder, srcColor, dstColor, outColor, xp.mode ());
169 } 169 }
170 170
171 void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) over ride {} 171 void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) over ride {}
172 172
173 typedef GrGLSLXferProcessor INHERITED; 173 typedef GrGLSLXferProcessor INHERITED;
174 }; 174 };
175 175
176 /////////////////////////////////////////////////////////////////////////////// 176 ///////////////////////////////////////////////////////////////////////////////
177 177
178 void CustomXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder * b) const { 178 void CustomXP::onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuild er* b) const {
179 GLCustomXP::GenKey(*this, caps, b); 179 GLCustomXP::GenKey(*this, caps, b);
180 } 180 }
181 181
182 GrGLSLXferProcessor* CustomXP::createGLInstance() const { 182 GrGLSLXferProcessor* CustomXP::createGLSLInstance() const {
183 SkASSERT(this->willReadDstColor() != this->hasHWBlendEquation()); 183 SkASSERT(this->willReadDstColor() != this->hasHWBlendEquation());
184 return new GLCustomXP(*this); 184 return new GLCustomXP(*this);
185 } 185 }
186 186
187 bool CustomXP::onIsEqual(const GrXferProcessor& other) const { 187 bool CustomXP::onIsEqual(const GrXferProcessor& other) const {
188 const CustomXP& s = other.cast<CustomXP>(); 188 const CustomXP& s = other.cast<CustomXP>();
189 return fMode == s.fMode && fHWBlendEquation == s.fHWBlendEquation; 189 return fMode == s.fMode && fHWBlendEquation == s.fHWBlendEquation;
190 } 190 }
191 191
192 GrXferProcessor::OptFlags CustomXP::onGetOptimizations(const GrProcOptInfo& colo rPOI, 192 GrXferProcessor::OptFlags CustomXP::onGetOptimizations(const GrProcOptInfo& colo rPOI,
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 392
393 /////////////////////////////////////////////////////////////////////////////// 393 ///////////////////////////////////////////////////////////////////////////////
394 394
395 GrXPFactory* GrCustomXfermode::CreateXPFactory(SkXfermode::Mode mode) { 395 GrXPFactory* GrCustomXfermode::CreateXPFactory(SkXfermode::Mode mode) {
396 if (!GrCustomXfermode::IsSupportedMode(mode)) { 396 if (!GrCustomXfermode::IsSupportedMode(mode)) {
397 return nullptr; 397 return nullptr;
398 } else { 398 } else {
399 return new CustomXPFactory(mode); 399 return new CustomXPFactory(mode);
400 } 400 }
401 } 401 }
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