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 "gl/GrGLEffect.h" | 10 #include "gl/GrGLEffect.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 GR_DECLARE_EFFECT_TEST; | 47 GR_DECLARE_EFFECT_TEST; |
48 | 48 |
49 typedef GrEffect INHERITED; | 49 typedef GrEffect INHERITED; |
50 }; | 50 }; |
51 | 51 |
52 GrEffectRef* CircleEffect::Create(GrEffectEdgeType edgeType, | 52 GrEffectRef* CircleEffect::Create(GrEffectEdgeType edgeType, |
53 const SkPoint& center, | 53 const SkPoint& center, |
54 SkScalar radius) { | 54 SkScalar radius) { |
55 SkASSERT(radius >= 0); | 55 SkASSERT(radius >= 0); |
56 return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(CircleEffect, | 56 return SkNEW_ARGS(CircleEffect, (edgeType, center, radius)); |
57 (edgeType, center, radius)
))); | |
58 } | 57 } |
59 | 58 |
60 void CircleEffect::getConstantColorComponents(GrColor* color, uint32_t* validFla
gs) const { | 59 void CircleEffect::getConstantColorComponents(GrColor* color, uint32_t* validFla
gs) const { |
61 *validFlags = 0; | 60 *validFlags = 0; |
62 } | 61 } |
63 | 62 |
64 const GrBackendEffectFactory& CircleEffect::getFactory() const { | 63 const GrBackendEffectFactory& CircleEffect::getFactory() const { |
65 return GrTBackendEffectFactory<CircleEffect>::getInstance(); | 64 return GrTBackendEffectFactory<CircleEffect>::getInstance(); |
66 } | 65 } |
67 | 66 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 GR_DECLARE_EFFECT_TEST; | 217 GR_DECLARE_EFFECT_TEST; |
219 | 218 |
220 typedef GrEffect INHERITED; | 219 typedef GrEffect INHERITED; |
221 }; | 220 }; |
222 | 221 |
223 GrEffectRef* EllipseEffect::Create(GrEffectEdgeType edgeType, | 222 GrEffectRef* EllipseEffect::Create(GrEffectEdgeType edgeType, |
224 const SkPoint& center, | 223 const SkPoint& center, |
225 SkScalar rx, | 224 SkScalar rx, |
226 SkScalar ry) { | 225 SkScalar ry) { |
227 SkASSERT(rx >= 0 && ry >= 0); | 226 SkASSERT(rx >= 0 && ry >= 0); |
228 return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(EllipseEffect, | 227 return SkNEW_ARGS(EllipseEffect, (edgeType, center, rx, ry)); |
229 (edgeType, center, rx, ry)
))); | |
230 } | 228 } |
231 | 229 |
232 void EllipseEffect::getConstantColorComponents(GrColor* color, uint32_t* validFl
ags) const { | 230 void EllipseEffect::getConstantColorComponents(GrColor* color, uint32_t* validFl
ags) const { |
233 *validFlags = 0; | 231 *validFlags = 0; |
234 } | 232 } |
235 | 233 |
236 const GrBackendEffectFactory& EllipseEffect::getFactory() const { | 234 const GrBackendEffectFactory& EllipseEffect::getFactory() const { |
237 return GrTBackendEffectFactory<EllipseEffect>::getInstance(); | 235 return GrTBackendEffectFactory<EllipseEffect>::getInstance(); |
238 } | 236 } |
239 | 237 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 w /= 2; | 376 w /= 2; |
379 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval
.fTop + w), w); | 377 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval
.fTop + w), w); |
380 } else { | 378 } else { |
381 w /= 2; | 379 w /= 2; |
382 h /= 2; | 380 h /= 2; |
383 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova
l.fTop + h), w, h); | 381 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova
l.fTop + h), w, h); |
384 } | 382 } |
385 | 383 |
386 return NULL; | 384 return NULL; |
387 } | 385 } |
OLD | NEW |