| 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 "GrOvalEffect.h" | 8 #include "GrOvalEffect.h" |
| 9 | 9 |
| 10 #include "GrFragmentProcessor.h" | 10 #include "GrFragmentProcessor.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 void CircleEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { | 59 void CircleEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { |
| 60 inout->mulByUnknownSingleComponent(); | 60 inout->mulByUnknownSingleComponent(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkSca
lar r) | 63 CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkSca
lar r) |
| 64 : fCenter(c) | 64 : fCenter(c) |
| 65 , fRadius(r) | 65 , fRadius(r) |
| 66 , fEdgeType(edgeType) { | 66 , fEdgeType(edgeType) { |
| 67 this->initClassID<CircleEffect>(); | 67 this->initClassID<CircleEffect>(); |
| 68 this->setWillReadFragmentPosition(); | 68 this->enableBuiltInState(kFragmentPosition_BuiltInState); |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool CircleEffect::onIsEqual(const GrFragmentProcessor& other) const { | 71 bool CircleEffect::onIsEqual(const GrFragmentProcessor& other) const { |
| 72 const CircleEffect& ce = other.cast<CircleEffect>(); | 72 const CircleEffect& ce = other.cast<CircleEffect>(); |
| 73 return fEdgeType == ce.fEdgeType && fCenter == ce.fCenter && fRadius == ce.f
Radius; | 73 return fEdgeType == ce.fEdgeType && fCenter == ce.fCenter && fRadius == ce.f
Radius; |
| 74 } | 74 } |
| 75 | 75 |
| 76 ////////////////////////////////////////////////////////////////////////////// | 76 ////////////////////////////////////////////////////////////////////////////// |
| 77 | 77 |
| 78 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleEffect); | 78 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleEffect); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 225 |
| 226 void EllipseEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { | 226 void EllipseEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { |
| 227 inout->mulByUnknownSingleComponent(); | 227 inout->mulByUnknownSingleComponent(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 EllipseEffect::EllipseEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkS
calar rx, SkScalar ry) | 230 EllipseEffect::EllipseEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkS
calar rx, SkScalar ry) |
| 231 : fCenter(c) | 231 : fCenter(c) |
| 232 , fRadii(SkVector::Make(rx, ry)) | 232 , fRadii(SkVector::Make(rx, ry)) |
| 233 , fEdgeType(edgeType) { | 233 , fEdgeType(edgeType) { |
| 234 this->initClassID<EllipseEffect>(); | 234 this->initClassID<EllipseEffect>(); |
| 235 this->setWillReadFragmentPosition(); | 235 this->enableBuiltInState(kFragmentPosition_BuiltInState); |
| 236 } | 236 } |
| 237 | 237 |
| 238 bool EllipseEffect::onIsEqual(const GrFragmentProcessor& other) const { | 238 bool EllipseEffect::onIsEqual(const GrFragmentProcessor& other) const { |
| 239 const EllipseEffect& ee = other.cast<EllipseEffect>(); | 239 const EllipseEffect& ee = other.cast<EllipseEffect>(); |
| 240 return fEdgeType == ee.fEdgeType && fCenter == ee.fCenter && fRadii == ee.fR
adii; | 240 return fEdgeType == ee.fEdgeType && fCenter == ee.fCenter && fRadii == ee.fR
adii; |
| 241 } | 241 } |
| 242 | 242 |
| 243 ////////////////////////////////////////////////////////////////////////////// | 243 ////////////////////////////////////////////////////////////////////////////// |
| 244 | 244 |
| 245 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipseEffect); | 245 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipseEffect); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 w /= 2; | 401 w /= 2; |
| 402 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval
.fTop + w), w); | 402 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval
.fTop + w), w); |
| 403 } else { | 403 } else { |
| 404 w /= 2; | 404 w /= 2; |
| 405 h /= 2; | 405 h /= 2; |
| 406 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova
l.fTop + h), w, h); | 406 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova
l.fTop + h), w, h); |
| 407 } | 407 } |
| 408 | 408 |
| 409 return nullptr; | 409 return nullptr; |
| 410 } | 410 } |
| OLD | NEW |