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

Side by Side Diff: src/effects/SkLumaColorFilter.cpp

Issue 1457543003: Add ShaderBuilders to EmitArgs and remove gettings from ProgBuilder. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/effects/SkLightingImageFilter.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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 public: 65 public:
66 GLSLProcessor(const GrProcessor&) {} 66 GLSLProcessor(const GrProcessor&) {}
67 67
68 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKey Builder* b) {} 68 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKey Builder* b) {}
69 69
70 virtual void emitCode(EmitArgs& args) override { 70 virtual void emitCode(EmitArgs& args) override {
71 if (nullptr == args.fInputColor) { 71 if (nullptr == args.fInputColor) {
72 args.fInputColor = "vec4(1)"; 72 args.fInputColor = "vec4(1)";
73 } 73 }
74 74
75 GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderB uilder(); 75 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
76 fsBuilder->codeAppendf("\tfloat luma = dot(vec3(%f, %f, %f), %s.rgb) ;\n", 76 fragBuilder->codeAppendf("\tfloat luma = dot(vec3(%f, %f, %f), %s.rg b);\n",
77 SK_ITU_BT709_LUM_COEFF_R, 77 SK_ITU_BT709_LUM_COEFF_R,
78 SK_ITU_BT709_LUM_COEFF_G, 78 SK_ITU_BT709_LUM_COEFF_G,
79 SK_ITU_BT709_LUM_COEFF_B, 79 SK_ITU_BT709_LUM_COEFF_B,
80 args.fInputColor); 80 args.fInputColor);
81 fsBuilder->codeAppendf("\t%s = vec4(0, 0, 0, luma);\n", 81 fragBuilder->codeAppendf("\t%s = vec4(0, 0, 0, luma);\n",
82 args.fOutputColor); 82 args.fOutputColor);
83 83
84 } 84 }
85 85
86 private: 86 private:
87 typedef GrGLSLFragmentProcessor INHERITED; 87 typedef GrGLSLFragmentProcessor INHERITED;
88 }; 88 };
89 89
90 private: 90 private:
91 LumaColorFilterEffect() { 91 LumaColorFilterEffect() {
92 this->initClassID<LumaColorFilterEffect>(); 92 this->initClassID<LumaColorFilterEffect>();
(...skipping 15 matching lines...) Expand all
108 inout->setToOther(kRGB_GrColorComponentFlags, GrColorPackRGBA(0, 0, 0, 0 ), 108 inout->setToOther(kRGB_GrColorComponentFlags, GrColorPackRGBA(0, 0, 0, 0 ),
109 GrInvariantOutput::kWill_ReadInput); 109 GrInvariantOutput::kWill_ReadInput);
110 } 110 }
111 }; 111 };
112 112
113 const GrFragmentProcessor* SkLumaColorFilter::asFragmentProcessor(GrContext*) co nst { 113 const GrFragmentProcessor* SkLumaColorFilter::asFragmentProcessor(GrContext*) co nst {
114 114
115 return LumaColorFilterEffect::Create(); 115 return LumaColorFilterEffect::Create();
116 } 116 }
117 #endif 117 #endif
OLDNEW
« no previous file with comments | « src/effects/SkLightingImageFilter.cpp ('k') | src/effects/SkMagnifierImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698