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

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

Issue 1287023009: Added tree structure to GrGLFragmentProcessor, i.e. GL instances (Closed) Base URL: https://skia.googlesource.com/skia@cs3_isequal_nonrecursive
Patch Set: moved onSetData from public to protected, onCreateGLInstance from public to private in subclasses Created 5 years, 4 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/GrCustomXfermodePriv.h ('k') | src/gpu/effects/GrMatrixConvolutionEffect.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 "GrDitherEffect.h" 8 #include "GrDitherEffect.h"
9 #include "GrFragmentProcessor.h" 9 #include "GrFragmentProcessor.h"
10 #include "GrInvariantOutput.h" 10 #include "GrInvariantOutput.h"
11 #include "SkRect.h" 11 #include "SkRect.h"
12 #include "gl/GrGLFragmentProcessor.h" 12 #include "gl/GrGLFragmentProcessor.h"
13 #include "gl/builders/GrGLProgramBuilder.h" 13 #include "gl/builders/GrGLProgramBuilder.h"
14 14
15 ////////////////////////////////////////////////////////////////////////////// 15 //////////////////////////////////////////////////////////////////////////////
16 16
17 class DitherEffect : public GrFragmentProcessor { 17 class DitherEffect : public GrFragmentProcessor {
18 public: 18 public:
19 static GrFragmentProcessor* Create() { 19 static GrFragmentProcessor* Create() {
20 GR_CREATE_STATIC_PROCESSOR(gDitherEffect, DitherEffect, ()) 20 GR_CREATE_STATIC_PROCESSOR(gDitherEffect, DitherEffect, ())
21 return SkRef(gDitherEffect); 21 return SkRef(gDitherEffect);
22 } 22 }
23 23
24 virtual ~DitherEffect() {}; 24 virtual ~DitherEffect() {};
25 25
26 const char* name() const override { return "Dither"; } 26 const char* name() const override { return "Dither"; }
27 27
28 GrGLFragmentProcessor* createGLInstance() const override;
29
30 private: 28 private:
31 DitherEffect() { 29 DitherEffect() {
32 this->initClassID<DitherEffect>(); 30 this->initClassID<DitherEffect>();
33 this->setWillReadFragmentPosition(); 31 this->setWillReadFragmentPosition();
34 } 32 }
35 33
34 GrGLFragmentProcessor* onCreateGLInstance() const override;
35
36 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov erride; 36 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov erride;
37 37
38 // All dither effects are equal 38 // All dither effects are equal
39 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } 39 bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
40 40
41 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; 41 void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
42 42
43 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 43 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
44 44
45 typedef GrFragmentProcessor INHERITED; 45 typedef GrFragmentProcessor INHERITED;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 args.fOutputColor, GrGLSLExpr4(args.fInputColor).c_st r()); 90 args.fOutputColor, GrGLSLExpr4(args.fInputColor).c_st r());
91 } 91 }
92 92
93 ////////////////////////////////////////////////////////////////////////////// 93 //////////////////////////////////////////////////////////////////////////////
94 94
95 void DitherEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, 95 void DitherEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
96 GrProcessorKeyBuilder* b) const { 96 GrProcessorKeyBuilder* b) const {
97 GLDitherEffect::GenKey(*this, caps, b); 97 GLDitherEffect::GenKey(*this, caps, b);
98 } 98 }
99 99
100 GrGLFragmentProcessor* DitherEffect::createGLInstance() const { 100 GrGLFragmentProcessor* DitherEffect::onCreateGLInstance() const {
101 return SkNEW_ARGS(GLDitherEffect, (*this)); 101 return SkNEW_ARGS(GLDitherEffect, (*this));
102 } 102 }
103 103
104 GrFragmentProcessor* GrDitherEffect::Create() { return DitherEffect::Create(); } 104 GrFragmentProcessor* GrDitherEffect::Create() { return DitherEffect::Create(); }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrCustomXfermodePriv.h ('k') | src/gpu/effects/GrMatrixConvolutionEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698