| OLD | NEW |
| 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 19 matching lines...) Expand all Loading... |
| 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 const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; | 35 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 CircleEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar radius); | 38 CircleEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar radius); |
| 39 | 39 |
| 40 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; | 40 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; |
| 41 | 41 |
| 42 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; | 42 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; |
| 43 | 43 |
| 44 SkPoint fCenter; | 44 SkPoint fCenter; |
| 45 SkScalar fRadius; | 45 SkScalar fRadius; |
| 46 GrPrimitiveEdgeType fEdgeType; | 46 GrPrimitiveEdgeType fEdgeType; |
| 47 | 47 |
| 48 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 48 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
| 49 | 49 |
| 50 typedef GrFragmentProcessor INHERITED; | 50 typedef GrFragmentProcessor INHERITED; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 64 return GrTBackendFragmentProcessorFactory<CircleEffect>::getInstance(); | 64 return GrTBackendFragmentProcessorFactory<CircleEffect>::getInstance(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkSca
lar r) | 67 CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkSca
lar r) |
| 68 : fCenter(c) | 68 : fCenter(c) |
| 69 , fRadius(r) | 69 , fRadius(r) |
| 70 , fEdgeType(edgeType) { | 70 , fEdgeType(edgeType) { |
| 71 this->setWillReadFragmentPosition(); | 71 this->setWillReadFragmentPosition(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool CircleEffect::onIsEqual(const GrProcessor& other) const { | 74 bool CircleEffect::onIsEqual(const GrFragmentProcessor& other) const { |
| 75 const CircleEffect& ce = other.cast<CircleEffect>(); | 75 const CircleEffect& ce = other.cast<CircleEffect>(); |
| 76 return fEdgeType == ce.fEdgeType && fCenter == ce.fCenter && fRadius == ce.f
Radius; | 76 return fEdgeType == ce.fEdgeType && fCenter == ce.fCenter && fRadius == ce.f
Radius; |
| 77 } | 77 } |
| 78 | 78 |
| 79 ////////////////////////////////////////////////////////////////////////////// | 79 ////////////////////////////////////////////////////////////////////////////// |
| 80 | 80 |
| 81 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleEffect); | 81 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleEffect); |
| 82 | 82 |
| 83 GrFragmentProcessor* CircleEffect::TestCreate(SkRandom* random, | 83 GrFragmentProcessor* CircleEffect::TestCreate(SkRandom* random, |
| 84 GrContext*, | 84 GrContext*, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 202 |
| 203 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } | 203 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } |
| 204 | 204 |
| 205 typedef GLEllipseEffect GLProcessor; | 205 typedef GLEllipseEffect GLProcessor; |
| 206 | 206 |
| 207 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; | 207 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; |
| 208 | 208 |
| 209 private: | 209 private: |
| 210 EllipseEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar rx, SkSca
lar ry); | 210 EllipseEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar rx, SkSca
lar ry); |
| 211 | 211 |
| 212 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; | 212 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; |
| 213 | 213 |
| 214 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; | 214 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; |
| 215 | 215 |
| 216 SkPoint fCenter; | 216 SkPoint fCenter; |
| 217 SkVector fRadii; | 217 SkVector fRadii; |
| 218 GrPrimitiveEdgeType fEdgeType; | 218 GrPrimitiveEdgeType fEdgeType; |
| 219 | 219 |
| 220 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 220 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
| 221 | 221 |
| 222 typedef GrFragmentProcessor INHERITED; | 222 typedef GrFragmentProcessor INHERITED; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 238 return GrTBackendFragmentProcessorFactory<EllipseEffect>::getInstance(); | 238 return GrTBackendFragmentProcessorFactory<EllipseEffect>::getInstance(); |
| 239 } | 239 } |
| 240 | 240 |
| 241 EllipseEffect::EllipseEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkS
calar rx, SkScalar ry) | 241 EllipseEffect::EllipseEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkS
calar rx, SkScalar ry) |
| 242 : fCenter(c) | 242 : fCenter(c) |
| 243 , fRadii(SkVector::Make(rx, ry)) | 243 , fRadii(SkVector::Make(rx, ry)) |
| 244 , fEdgeType(edgeType) { | 244 , fEdgeType(edgeType) { |
| 245 this->setWillReadFragmentPosition(); | 245 this->setWillReadFragmentPosition(); |
| 246 } | 246 } |
| 247 | 247 |
| 248 bool EllipseEffect::onIsEqual(const GrProcessor& other) const { | 248 bool EllipseEffect::onIsEqual(const GrFragmentProcessor& other) const { |
| 249 const EllipseEffect& ee = other.cast<EllipseEffect>(); | 249 const EllipseEffect& ee = other.cast<EllipseEffect>(); |
| 250 return fEdgeType == ee.fEdgeType && fCenter == ee.fCenter && fRadii == ee.fR
adii; | 250 return fEdgeType == ee.fEdgeType && fCenter == ee.fCenter && fRadii == ee.fR
adii; |
| 251 } | 251 } |
| 252 | 252 |
| 253 ////////////////////////////////////////////////////////////////////////////// | 253 ////////////////////////////////////////////////////////////////////////////// |
| 254 | 254 |
| 255 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipseEffect); | 255 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipseEffect); |
| 256 | 256 |
| 257 GrFragmentProcessor* EllipseEffect::TestCreate(SkRandom* random, | 257 GrFragmentProcessor* EllipseEffect::TestCreate(SkRandom* random, |
| 258 GrContext*, | 258 GrContext*, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 w /= 2; | 381 w /= 2; |
| 382 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval
.fTop + w), w); | 382 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval
.fTop + w), w); |
| 383 } else { | 383 } else { |
| 384 w /= 2; | 384 w /= 2; |
| 385 h /= 2; | 385 h /= 2; |
| 386 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova
l.fTop + h), w, h); | 386 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova
l.fTop + h), w, h); |
| 387 } | 387 } |
| 388 | 388 |
| 389 return NULL; | 389 return NULL; |
| 390 } | 390 } |
| OLD | NEW |