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

Side by Side Diff: src/gpu/GrAARectRenderer.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/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrDrawState.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 2012 Google Inc. 2 * Copyright 2012 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 "GrAARectRenderer.h" 8 #include "GrAARectRenderer.h"
9 #include "GrGpu.h" 9 #include "GrGpu.h"
10 #include "gl/builders/GrGLFullProgramBuilder.h" 10 #include "gl/builders/GrGLFullProgramBuilder.h"
(...skipping 12 matching lines...) Expand all
23 static GrGeometryProcessor* Create() { 23 static GrGeometryProcessor* Create() {
24 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gAlignedRectEffect, GrAlignedRectEff ect, ()); 24 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gAlignedRectEffect, GrAlignedRectEff ect, ());
25 gAlignedRectEffect->ref(); 25 gAlignedRectEffect->ref();
26 return gAlignedRectEffect; 26 return gAlignedRectEffect;
27 } 27 }
28 28
29 virtual ~GrAlignedRectEffect() {} 29 virtual ~GrAlignedRectEffect() {}
30 30
31 static const char* Name() { return "AlignedRectEdge"; } 31 static const char* Name() { return "AlignedRectEdge"; }
32 32
33 virtual void getConstantColorComponents(GrColor* color,
34 uint32_t* validFlags) const SK_OVERR IDE {
35 *validFlags = 0;
36 }
37
38 const GrShaderVar& inRect() const { return fInRect; } 33 const GrShaderVar& inRect() const { return fInRect; }
39 34
40 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR IDE { 35 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR IDE {
41 return GrTBackendGeometryProcessorFactory<GrAlignedRectEffect>::getInsta nce(); 36 return GrTBackendGeometryProcessorFactory<GrAlignedRectEffect>::getInsta nce();
42 } 37 }
43 38
44 class GLProcessor : public GrGLGeometryProcessor { 39 class GLProcessor : public GrGLGeometryProcessor {
45 public: 40 public:
46 GLProcessor(const GrBackendProcessorFactory& factory, const GrProcessor& ) 41 GLProcessor(const GrBackendProcessorFactory& factory, const GrProcessor& )
47 : INHERITED (factory) {} 42 : INHERITED (factory) {}
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 GrAlignedRectEffect() 100 GrAlignedRectEffect()
106 : fInRect(this->addVertexAttrib(GrShaderVar("inRect", 101 : fInRect(this->addVertexAttrib(GrShaderVar("inRect",
107 kVec4f_GrSLType, 102 kVec4f_GrSLType,
108 GrShaderVar::kAttribute_Type Modifier))) { 103 GrShaderVar::kAttribute_Type Modifier))) {
109 } 104 }
110 105
111 const GrShaderVar& fInRect; 106 const GrShaderVar& fInRect;
112 107
113 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { return true; } 108 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { return true; }
114 109
110 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE {
111 inout->fValidFlags = 0;
112 inout->fIsSingleComponent = false;
113 }
114
115 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 115 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
116 116
117 typedef GrGeometryProcessor INHERITED; 117 typedef GrGeometryProcessor INHERITED;
118 }; 118 };
119 119
120 120
121 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrAlignedRectEffect); 121 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrAlignedRectEffect);
122 122
123 GrGeometryProcessor* GrAlignedRectEffect::TestCreate(SkRandom* random, 123 GrGeometryProcessor* GrAlignedRectEffect::TestCreate(SkRandom* random,
124 GrContext* context, 124 GrContext* context,
(...skipping 23 matching lines...) Expand all
148 static GrGeometryProcessor* Create() { 148 static GrGeometryProcessor* Create() {
149 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gRectEffect, GrRectEffect, ()); 149 GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gRectEffect, GrRectEffect, ());
150 gRectEffect->ref(); 150 gRectEffect->ref();
151 return gRectEffect; 151 return gRectEffect;
152 } 152 }
153 153
154 virtual ~GrRectEffect() {} 154 virtual ~GrRectEffect() {}
155 155
156 static const char* Name() { return "RectEdge"; } 156 static const char* Name() { return "RectEdge"; }
157 157
158 virtual void getConstantColorComponents(GrColor* color,
159 uint32_t* validFlags) const SK_OVERR IDE {
160 *validFlags = 0;
161 }
162
163 const GrShaderVar& inRectEdge() const { return fInRectEdge; } 158 const GrShaderVar& inRectEdge() const { return fInRectEdge; }
164 const GrShaderVar& inWidthHeight() const { return fInWidthHeight; } 159 const GrShaderVar& inWidthHeight() const { return fInWidthHeight; }
165 160
166 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR IDE { 161 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR IDE {
167 return GrTBackendGeometryProcessorFactory<GrRectEffect>::getInstance(); 162 return GrTBackendGeometryProcessorFactory<GrRectEffect>::getInstance();
168 } 163 }
169 164
170 class GLProcessor : public GrGLGeometryProcessor { 165 class GLProcessor : public GrGLGeometryProcessor {
171 public: 166 public:
172 GLProcessor(const GrBackendProcessorFactory& factory, const GrProcessor& ) 167 GLProcessor(const GrBackendProcessorFactory& factory, const GrProcessor& )
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 GrShaderVar::kAttribute_ TypeModifier))) 245 GrShaderVar::kAttribute_ TypeModifier)))
251 , fInWidthHeight(this->addVertexAttrib( 246 , fInWidthHeight(this->addVertexAttrib(
252 GrShaderVar("inWidthHeight", 247 GrShaderVar("inWidthHeight",
253 kVec2f_GrSLType, 248 kVec2f_GrSLType,
254 GrShaderVar::kAttribute_TypeModifier))) { 249 GrShaderVar::kAttribute_TypeModifier))) {
255 this->setWillReadFragmentPosition(); 250 this->setWillReadFragmentPosition();
256 } 251 }
257 252
258 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { return true; } 253 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { return true; }
259 254
255 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE {
256 inout->fValidFlags = 0;
257 inout->fIsSingleComponent = false;
258 }
259
260 const GrShaderVar& fInRectEdge; 260 const GrShaderVar& fInRectEdge;
261 const GrShaderVar& fInWidthHeight; 261 const GrShaderVar& fInWidthHeight;
262 262
263 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 263 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
264 264
265 typedef GrGeometryProcessor INHERITED; 265 typedef GrGeometryProcessor INHERITED;
266 }; 266 };
267 267
268 268
269 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrRectEffect); 269 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrRectEffect);
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 // can't call mapRect for devInside since it calls sort 963 // can't call mapRect for devInside since it calls sort
964 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2) ; 964 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2) ;
965 965
966 if (devInside.isEmpty()) { 966 if (devInside.isEmpty()) {
967 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside); 967 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside);
968 return; 968 return;
969 } 969 }
970 970
971 this->geometryStrokeAARect(gpu, target, devOutside, devOutsideAssist, devIns ide, true); 971 this->geometryStrokeAARect(gpu, target, devOutside, devOutsideAssist, devIns ide, true);
972 } 972 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698