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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 typedef GrFragmentProcessor INHERITED; | 49 typedef GrFragmentProcessor INHERITED; |
50 }; | 50 }; |
51 | 51 |
52 GrFragmentProcessor* CircleEffect::Create(GrPrimitiveEdgeType edgeType, const Sk
Point& center, | 52 GrFragmentProcessor* CircleEffect::Create(GrPrimitiveEdgeType edgeType, const Sk
Point& center, |
53 SkScalar radius) { | 53 SkScalar radius) { |
54 SkASSERT(radius >= 0); | 54 SkASSERT(radius >= 0); |
55 return SkNEW_ARGS(CircleEffect, (edgeType, center, radius)); | 55 return SkNEW_ARGS(CircleEffect, (edgeType, center, radius)); |
56 } | 56 } |
57 | 57 |
58 void CircleEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { | 58 void CircleEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { |
59 inout->mulByUnknownAlpha(); | 59 inout->mulByUnknownSingleComponent(); |
60 } | 60 } |
61 | 61 |
62 CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkSca
lar r) | 62 CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkSca
lar r) |
63 : fCenter(c) | 63 : fCenter(c) |
64 , fRadius(r) | 64 , fRadius(r) |
65 , fEdgeType(edgeType) { | 65 , fEdgeType(edgeType) { |
66 this->initClassID<CircleEffect>(); | 66 this->initClassID<CircleEffect>(); |
67 this->setWillReadFragmentPosition(); | 67 this->setWillReadFragmentPosition(); |
68 } | 68 } |
69 | 69 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 GrFragmentProcessor* EllipseEffect::Create(GrPrimitiveEdgeType edgeType, | 227 GrFragmentProcessor* EllipseEffect::Create(GrPrimitiveEdgeType edgeType, |
228 const SkPoint& center, | 228 const SkPoint& center, |
229 SkScalar rx, | 229 SkScalar rx, |
230 SkScalar ry) { | 230 SkScalar ry) { |
231 SkASSERT(rx >= 0 && ry >= 0); | 231 SkASSERT(rx >= 0 && ry >= 0); |
232 return SkNEW_ARGS(EllipseEffect, (edgeType, center, rx, ry)); | 232 return SkNEW_ARGS(EllipseEffect, (edgeType, center, rx, ry)); |
233 } | 233 } |
234 | 234 |
235 void EllipseEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { | 235 void EllipseEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { |
236 inout->mulByUnknownAlpha(); | 236 inout->mulByUnknownSingleComponent(); |
237 } | 237 } |
238 | 238 |
239 EllipseEffect::EllipseEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkS
calar rx, SkScalar ry) | 239 EllipseEffect::EllipseEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkS
calar rx, SkScalar ry) |
240 : fCenter(c) | 240 : fCenter(c) |
241 , fRadii(SkVector::Make(rx, ry)) | 241 , fRadii(SkVector::Make(rx, ry)) |
242 , fEdgeType(edgeType) { | 242 , fEdgeType(edgeType) { |
243 this->initClassID<EllipseEffect>(); | 243 this->initClassID<EllipseEffect>(); |
244 this->setWillReadFragmentPosition(); | 244 this->setWillReadFragmentPosition(); |
245 } | 245 } |
246 | 246 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 w /= 2; | 387 w /= 2; |
388 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval
.fTop + w), w); | 388 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval
.fTop + w), w); |
389 } else { | 389 } else { |
390 w /= 2; | 390 w /= 2; |
391 h /= 2; | 391 h /= 2; |
392 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova
l.fTop + h), w, h); | 392 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova
l.fTop + h), w, h); |
393 } | 393 } |
394 | 394 |
395 return NULL; | 395 return NULL; |
396 } | 396 } |
OLD | NEW |