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

Side by Side Diff: src/utils/debugger/SkOverdrawMode.cpp

Issue 1666773002: Clean up GrGLSLFragmentProcessor-derived classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 | « src/gpu/effects/GrYUVEffect.cpp ('k') | tests/GLProgramsTest.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 2016 Google Inc. 2 * Copyright 2016 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 "SkColorPriv.h" 8 #include "SkColorPriv.h"
9 #include "SkOverdrawMode.h" 9 #include "SkOverdrawMode.h"
10 #include "SkString.h" 10 #include "SkString.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 fragBuilder->codeAppend("if (dst.r < 0.25) { nextIdx = 1; }"); 98 fragBuilder->codeAppend("if (dst.r < 0.25) { nextIdx = 1; }");
99 // cap 'idx' at 10 99 // cap 'idx' at 10
100 fragBuilder->codeAppend("else if (dst.g < 0.0977) { nextIdx = 10; }"); 100 fragBuilder->codeAppend("else if (dst.g < 0.0977) { nextIdx = 10; }");
101 fragBuilder->codeAppend("else if (dst.b > 0.08) { nextIdx = 8 - int(6.0 * ds t.b + 0.5); }"); 101 fragBuilder->codeAppend("else if (dst.b > 0.08) { nextIdx = 8 - int(6.0 * ds t.b + 0.5); }");
102 fragBuilder->codeAppend("else { nextIdx = 11 - int(5.7 * dst.g + 0.5); }"); 102 fragBuilder->codeAppend("else { nextIdx = 11 - int(5.7 * dst.g + 0.5); }");
103 fragBuilder->codeAppendf("%s = %s(float(nextIdx));", outputColor, colorTable FuncName.c_str()); 103 fragBuilder->codeAppendf("%s = %s(float(nextIdx));", outputColor, colorTable FuncName.c_str());
104 } 104 }
105 105
106 class GLOverdrawFP : public GrGLSLFragmentProcessor { 106 class GLOverdrawFP : public GrGLSLFragmentProcessor {
107 public: 107 public:
108 GLOverdrawFP(const GrOverdrawFP&) {}
109
110 ~GLOverdrawFP() override {}
111
112 void emitCode(EmitArgs& args) override { 108 void emitCode(EmitArgs& args) override {
113 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 109 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
114 SkString dstColor("dstColor"); 110 SkString dstColor("dstColor");
115 this->emitChild(0, nullptr, &dstColor, args); 111 this->emitChild(0, nullptr, &dstColor, args);
116 112
117 add_overdraw_code(fragBuilder, dstColor.c_str(), args.fOutputColor); 113 add_overdraw_code(fragBuilder, dstColor.c_str(), args.fOutputColor);
118 } 114 }
119 115
120 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuil der*) { } 116 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuil der*) { }
121 117
122 private: 118 private:
123 typedef GrGLSLFragmentProcessor INHERITED; 119 typedef GrGLSLFragmentProcessor INHERITED;
124 }; 120 };
125 121
126 /////////////////////////////////////////////////////////////////////////////// 122 ///////////////////////////////////////////////////////////////////////////////
127 123
128 GrGLSLFragmentProcessor* GrOverdrawFP::onCreateGLSLInstance() const { 124 GrGLSLFragmentProcessor* GrOverdrawFP::onCreateGLSLInstance() const {
129 return new GLOverdrawFP(*this); 125 return new GLOverdrawFP;
130 } 126 }
131 127
132 void GrOverdrawFP::onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyB uilder* b) const { 128 void GrOverdrawFP::onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyB uilder* b) const {
133 GLOverdrawFP::GenKey(*this, caps, b); 129 GLOverdrawFP::GenKey(*this, caps, b);
134 } 130 }
135 131
136 const GrFragmentProcessor* GrOverdrawFP::TestCreate(GrProcessorTestData* d) { 132 const GrFragmentProcessor* GrOverdrawFP::TestCreate(GrProcessorTestData* d) {
137 SkAutoTUnref<const GrFragmentProcessor> dst(GrProcessorUnitTest::CreateChild FP(d)); 133 SkAutoTUnref<const GrFragmentProcessor> dst(GrProcessorUnitTest::CreateChild FP(d));
138 return new GrOverdrawFP(dst); 134 return new GrOverdrawFP(dst);
139 } 135 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 321
326 SkFlattenable* SkOverdrawXfermode::CreateProc(SkReadBuffer& buffer) { 322 SkFlattenable* SkOverdrawXfermode::CreateProc(SkReadBuffer& buffer) {
327 return Create(); 323 return Create();
328 } 324 }
329 325
330 SkXfermode* SkOverdrawMode::Create() { return new SkOverdrawXfermode; } 326 SkXfermode* SkOverdrawMode::Create() { return new SkOverdrawXfermode; }
331 327
332 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkOverdrawMode) 328 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkOverdrawMode)
333 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkOverdrawXfermode) 329 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkOverdrawXfermode)
334 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 330 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/gpu/effects/GrYUVEffect.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698