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

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

Issue 608253002: Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix isSolidWhite Created 6 years, 2 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/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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 GR_CREATE_STATIC_FRAGMENT_PROCESSOR(gLumaEffect, LumaColorFilterEffect, ()); 66 GR_CREATE_STATIC_FRAGMENT_PROCESSOR(gLumaEffect, LumaColorFilterEffect, ());
67 return SkRef(gLumaEffect); 67 return SkRef(gLumaEffect);
68 } 68 }
69 69
70 static const char* Name() { return "Luminance-to-Alpha"; } 70 static const char* Name() { return "Luminance-to-Alpha"; }
71 71
72 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE { 72 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE {
73 return GrTBackendFragmentProcessorFactory<LumaColorFilterEffect>::getIns tance(); 73 return GrTBackendFragmentProcessorFactory<LumaColorFilterEffect>::getIns tance();
74 } 74 }
75 75
76 virtual void getConstantColorComponents(GrColor* color,
77 uint32_t* validFlags) const SK_OVERR IDE {
78 // The output is always black.
79 *color = GrColorPackRGBA(0, 0, 0, GrColorUnpackA(*color));
80 *validFlags = kRGB_GrColorComponentFlags;
81 }
82
83 class GLProcessor : public GrGLFragmentProcessor { 76 class GLProcessor : public GrGLFragmentProcessor {
84 public: 77 public:
85 GLProcessor(const GrBackendProcessorFactory& factory, 78 GLProcessor(const GrBackendProcessorFactory& factory,
86 const GrProcessor&) 79 const GrProcessor&)
87 : INHERITED(factory) { 80 : INHERITED(factory) {
88 } 81 }
89 82
90 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBu ilder* b) {} 83 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBu ilder* b) {}
91 84
92 virtual void emitCode(GrGLProgramBuilder* builder, 85 virtual void emitCode(GrGLProgramBuilder* builder,
(...skipping 19 matching lines...) Expand all
112 } 105 }
113 106
114 private: 107 private:
115 typedef GrGLFragmentProcessor INHERITED; 108 typedef GrGLFragmentProcessor INHERITED;
116 }; 109 };
117 110
118 private: 111 private:
119 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { 112 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE {
120 return true; 113 return true;
121 } 114 }
115
116 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE {
117 // The output is always black.
118 inout->fColor = GrColorPackRGBA(0, 0, 0, GrColorUnpackA(inout->fColor));
119 inout->fValidFlags = kRGB_GrColorComponentFlags;
120 inout->fIsSingleComponent = false;
121 }
122 }; 122 };
123 123
124 GrFragmentProcessor* SkLumaColorFilter::asFragmentProcessor(GrContext*) const { 124 GrFragmentProcessor* SkLumaColorFilter::asFragmentProcessor(GrContext*) const {
125 return LumaColorFilterEffect::Create(); 125 return LumaColorFilterEffect::Create();
126 } 126 }
127 #endif 127 #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