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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 } | 353 } |
354 | 354 |
355 GrGLFragmentProcessor* EllipseEffect::onCreateGLInstance() const { | 355 GrGLFragmentProcessor* EllipseEffect::onCreateGLInstance() const { |
356 return new GLEllipseEffect(*this); | 356 return new GLEllipseEffect(*this); |
357 } | 357 } |
358 | 358 |
359 ////////////////////////////////////////////////////////////////////////////// | 359 ////////////////////////////////////////////////////////////////////////////// |
360 | 360 |
361 GrFragmentProcessor* GrOvalEffect::Create(GrPrimitiveEdgeType edgeType, const Sk
Rect& oval) { | 361 GrFragmentProcessor* GrOvalEffect::Create(GrPrimitiveEdgeType edgeType, const Sk
Rect& oval) { |
362 if (kHairlineAA_GrProcessorEdgeType == edgeType) { | 362 if (kHairlineAA_GrProcessorEdgeType == edgeType) { |
363 return NULL; | 363 return nullptr; |
364 } | 364 } |
365 SkScalar w = oval.width(); | 365 SkScalar w = oval.width(); |
366 SkScalar h = oval.height(); | 366 SkScalar h = oval.height(); |
367 if (SkScalarNearlyEqual(w, h)) { | 367 if (SkScalarNearlyEqual(w, h)) { |
368 w /= 2; | 368 w /= 2; |
369 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval
.fTop + w), w); | 369 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval
.fTop + w), w); |
370 } else { | 370 } else { |
371 w /= 2; | 371 w /= 2; |
372 h /= 2; | 372 h /= 2; |
373 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova
l.fTop + h), w, h); | 373 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova
l.fTop + h), w, h); |
374 } | 374 } |
375 | 375 |
376 return NULL; | 376 return nullptr; |
377 } | 377 } |
OLD | NEW |