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

Side by Side Diff: src/gpu/effects/GrOvalEffect.cpp

Issue 608253002: Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "gl/builders/GrGLProgramBuilder.h" 8 #include "gl/builders/GrGLProgramBuilder.h"
9 #include "GrOvalEffect.h" 9 #include "GrOvalEffect.h"
10 10
(...skipping 14 matching lines...) Expand all
25 virtual ~CircleEffect() {}; 25 virtual ~CircleEffect() {};
26 static const char* Name() { return "Circle"; } 26 static const char* Name() { return "Circle"; }
27 27
28 const SkPoint& getCenter() const { return fCenter; } 28 const SkPoint& getCenter() const { return fCenter; }
29 SkScalar getRadius() const { return fRadius; } 29 SkScalar getRadius() const { return fRadius; }
30 30
31 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } 31 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
32 32
33 typedef GLCircleEffect GLProcessor; 33 typedef GLCircleEffect GLProcessor;
34 34
35 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE;
36
37 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE; 35 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE;
38 36
39 private: 37 private:
40 CircleEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar radius); 38 CircleEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar radius);
41 39
42 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; 40 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
43 41
42 virtual void onGetConstantColorComponents(GrColor* color, uint32_t* validFla gs,
43 bool* isSingleComponent) const SK_ OVERRIDE;
44
44 SkPoint fCenter; 45 SkPoint fCenter;
45 SkScalar fRadius; 46 SkScalar fRadius;
46 GrPrimitiveEdgeType fEdgeType; 47 GrPrimitiveEdgeType fEdgeType;
47 48
48 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 49 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
49 50
50 typedef GrFragmentProcessor INHERITED; 51 typedef GrFragmentProcessor INHERITED;
51 }; 52 };
52 53
53 GrFragmentProcessor* CircleEffect::Create(GrPrimitiveEdgeType edgeType, const Sk Point& center, 54 GrFragmentProcessor* CircleEffect::Create(GrPrimitiveEdgeType edgeType, const Sk Point& center,
54 SkScalar radius) { 55 SkScalar radius) {
55 SkASSERT(radius >= 0); 56 SkASSERT(radius >= 0);
56 return SkNEW_ARGS(CircleEffect, (edgeType, center, radius)); 57 return SkNEW_ARGS(CircleEffect, (edgeType, center, radius));
57 } 58 }
58 59
59 void CircleEffect::getConstantColorComponents(GrColor* color, uint32_t* validFla gs) const { 60 void CircleEffect::onGetConstantColorComponents(GrColor* color, uint32_t* validF lags,
61 bool* isSingleComponent) const {
60 *validFlags = 0; 62 *validFlags = 0;
61 } 63 }
62 64
63 const GrBackendFragmentProcessorFactory& CircleEffect::getFactory() const { 65 const GrBackendFragmentProcessorFactory& CircleEffect::getFactory() const {
64 return GrTBackendFragmentProcessorFactory<CircleEffect>::getInstance(); 66 return GrTBackendFragmentProcessorFactory<CircleEffect>::getInstance();
65 } 67 }
66 68
67 CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkSca lar r) 69 CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkSca lar r)
68 : fCenter(c) 70 : fCenter(c)
69 , fRadius(r) 71 , fRadius(r)
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 virtual ~EllipseEffect() {}; 199 virtual ~EllipseEffect() {};
198 static const char* Name() { return "Ellipse"; } 200 static const char* Name() { return "Ellipse"; }
199 201
200 const SkPoint& getCenter() const { return fCenter; } 202 const SkPoint& getCenter() const { return fCenter; }
201 SkVector getRadii() const { return fRadii; } 203 SkVector getRadii() const { return fRadii; }
202 204
203 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } 205 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
204 206
205 typedef GLEllipseEffect GLProcessor; 207 typedef GLEllipseEffect GLProcessor;
206 208
207 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE;
208
209 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE; 209 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE;
210 210
211 private: 211 private:
212 EllipseEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar rx, SkSca lar ry); 212 EllipseEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar rx, SkSca lar ry);
213 213
214 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; 214 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
215 215
216 virtual void onGetConstantColorComponents(GrColor* color, uint32_t* validFla gs,
217 bool* isSingleComponent) const SK_ OVERRIDE;
218
216 SkPoint fCenter; 219 SkPoint fCenter;
217 SkVector fRadii; 220 SkVector fRadii;
218 GrPrimitiveEdgeType fEdgeType; 221 GrPrimitiveEdgeType fEdgeType;
219 222
220 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 223 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
221 224
222 typedef GrFragmentProcessor INHERITED; 225 typedef GrFragmentProcessor INHERITED;
223 }; 226 };
224 227
225 GrFragmentProcessor* EllipseEffect::Create(GrPrimitiveEdgeType edgeType, 228 GrFragmentProcessor* EllipseEffect::Create(GrPrimitiveEdgeType edgeType,
226 const SkPoint& center, 229 const SkPoint& center,
227 SkScalar rx, 230 SkScalar rx,
228 SkScalar ry) { 231 SkScalar ry) {
229 SkASSERT(rx >= 0 && ry >= 0); 232 SkASSERT(rx >= 0 && ry >= 0);
230 return SkNEW_ARGS(EllipseEffect, (edgeType, center, rx, ry)); 233 return SkNEW_ARGS(EllipseEffect, (edgeType, center, rx, ry));
231 } 234 }
232 235
233 void EllipseEffect::getConstantColorComponents(GrColor* color, uint32_t* validFl ags) const { 236 void EllipseEffect::onGetConstantColorComponents(GrColor* color, uint32_t* valid Flags,
237 bool* isSingleComponent) const {
234 *validFlags = 0; 238 *validFlags = 0;
235 } 239 }
236 240
237 const GrBackendFragmentProcessorFactory& EllipseEffect::getFactory() const { 241 const GrBackendFragmentProcessorFactory& EllipseEffect::getFactory() const {
238 return GrTBackendFragmentProcessorFactory<EllipseEffect>::getInstance(); 242 return GrTBackendFragmentProcessorFactory<EllipseEffect>::getInstance();
239 } 243 }
240 244
241 EllipseEffect::EllipseEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkS calar rx, SkScalar ry) 245 EllipseEffect::EllipseEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkS calar rx, SkScalar ry)
242 : fCenter(c) 246 : fCenter(c)
243 , fRadii(SkVector::Make(rx, ry)) 247 , fRadii(SkVector::Make(rx, ry))
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 w /= 2; 385 w /= 2;
382 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval .fTop + w), w); 386 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval .fTop + w), w);
383 } else { 387 } else {
384 w /= 2; 388 w /= 2;
385 h /= 2; 389 h /= 2;
386 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova l.fTop + h), w, h); 390 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova l.fTop + h), w, h);
387 } 391 }
388 392
389 return NULL; 393 return NULL;
390 } 394 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698