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

Side by Side Diff: src/effects/SkLumaColorFilter.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/effects/SkLightingShader.cpp ('k') | src/effects/SkMagnifierImageFilter.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 2013 Google Inc. 2 * Copyright 2013 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 "SkLumaColorFilter.h" 8 #include "SkLumaColorFilter.h"
9 9
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #if SK_SUPPORT_GPU 58 #if SK_SUPPORT_GPU
59 class LumaColorFilterEffect : public GrFragmentProcessor { 59 class LumaColorFilterEffect : public GrFragmentProcessor {
60 public: 60 public:
61 static GrFragmentProcessor* Create() { 61 static GrFragmentProcessor* Create() {
62 GR_CREATE_STATIC_PROCESSOR(gLumaEffect, LumaColorFilterEffect, ()); 62 GR_CREATE_STATIC_PROCESSOR(gLumaEffect, LumaColorFilterEffect, ());
63 return SkRef(gLumaEffect); 63 return SkRef(gLumaEffect);
64 } 64 }
65 65
66 const char* name() const override { return "Luminance-to-Alpha"; } 66 const char* name() const override { return "Luminance-to-Alpha"; }
67 67
68 GrGLFragmentProcessor* createGLInstance() const override {
69 return SkNEW_ARGS(GLProcessor, (*this));
70 }
71
72 class GLProcessor : public GrGLFragmentProcessor { 68 class GLProcessor : public GrGLFragmentProcessor {
73 public: 69 public:
74 GLProcessor(const GrProcessor&) {} 70 GLProcessor(const GrProcessor&) {}
75 71
76 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKey Builder* b) {} 72 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKey Builder* b) {}
77 73
78 virtual void emitCode(EmitArgs& args) override { 74 virtual void emitCode(EmitArgs& args) override {
79 if (NULL == args.fInputColor) { 75 if (NULL == args.fInputColor) {
80 args.fInputColor = "vec4(1)"; 76 args.fInputColor = "vec4(1)";
81 } 77 }
(...skipping 11 matching lines...) Expand all
93 89
94 private: 90 private:
95 typedef GrGLFragmentProcessor INHERITED; 91 typedef GrGLFragmentProcessor INHERITED;
96 }; 92 };
97 93
98 private: 94 private:
99 LumaColorFilterEffect() { 95 LumaColorFilterEffect() {
100 this->initClassID<LumaColorFilterEffect>(); 96 this->initClassID<LumaColorFilterEffect>();
101 } 97 }
102 98
99 GrGLFragmentProcessor* onCreateGLInstance() const override {
100 return SkNEW_ARGS(GLProcessor, (*this));
101 }
102
103 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps, 103 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps,
104 GrProcessorKeyBuilder* b) const override { 104 GrProcessorKeyBuilder* b) const override {
105 GLProcessor::GenKey(*this, caps, b); 105 GLProcessor::GenKey(*this, caps, b);
106 } 106 }
107 107
108 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } 108 bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
109 109
110 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { 110 void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
111 // The output is always black. The alpha value for the color passed in i s arbitrary. 111 // The output is always black. The alpha value for the color passed in i s arbitrary.
112 inout->setToOther(kRGB_GrColorComponentFlags, GrColorPackRGBA(0, 0, 0, 0 ), 112 inout->setToOther(kRGB_GrColorComponentFlags, GrColorPackRGBA(0, 0, 0, 0 ),
(...skipping 10 matching lines...) Expand all
123 *array->append() = frag; 123 *array->append() = frag;
124 } else { 124 } else {
125 frag->unref(); 125 frag->unref();
126 SkDEBUGCODE(frag = NULL;) 126 SkDEBUGCODE(frag = NULL;)
127 } 127 }
128 return true; 128 return true;
129 } 129 }
130 return false; 130 return false;
131 } 131 }
132 #endif 132 #endif
OLDNEW
« no previous file with comments | « src/effects/SkLightingShader.cpp ('k') | src/effects/SkMagnifierImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698