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 "GrRRectEffect.h" | 8 #include "GrRRectEffect.h" |
9 | 9 |
10 #include "GrConvexPolyEffect.h" | 10 #include "GrConvexPolyEffect.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 kBottom_CornerFlags = kBottomLeft_CornerFlag | kBottomRight_CornerFlag, | 38 kBottom_CornerFlags = kBottomLeft_CornerFlag | kBottomRight_CornerFlag, |
39 | 39 |
40 kAll_CornerFlags = kTopLeft_CornerFlag | kTopRight_CornerFlag | | 40 kAll_CornerFlags = kTopLeft_CornerFlag | kTopRight_CornerFlag | |
41 kBottomLeft_CornerFlag | kBottomRight_CornerFlag, | 41 kBottomLeft_CornerFlag | kBottomRight_CornerFlag, |
42 | 42 |
43 kNone_CornerFlags = 0 | 43 kNone_CornerFlags = 0 |
44 }; | 44 }; |
45 | 45 |
46 // The flags are used to indicate which corners are circluar (unflagged corn
ers are assumed to | 46 // The flags are used to indicate which corners are circluar (unflagged corn
ers are assumed to |
47 // be square). | 47 // be square). |
48 static GrFragmentProcessor* Create(GrPrimitiveEdgeType, uint32_t circularCor
nerFlags, | 48 static sk_sp<GrFragmentProcessor> Make(GrPrimitiveEdgeType, uint32_t circula
rCornerFlags, |
49 const SkRRect&); | 49 const SkRRect&); |
50 | 50 |
51 virtual ~CircularRRectEffect() {}; | 51 virtual ~CircularRRectEffect() {}; |
52 | 52 |
53 const char* name() const override { return "CircularRRect"; } | 53 const char* name() const override { return "CircularRRect"; } |
54 | 54 |
55 const SkRRect& getRRect() const { return fRRect; } | 55 const SkRRect& getRRect() const { return fRRect; } |
56 | 56 |
57 uint32_t getCircularCornerFlags() const { return fCircularCornerFlags; } | 57 uint32_t getCircularCornerFlags() const { return fCircularCornerFlags; } |
58 | 58 |
59 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } | 59 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } |
(...skipping 11 matching lines...) Expand all Loading... |
71 | 71 |
72 SkRRect fRRect; | 72 SkRRect fRRect; |
73 GrPrimitiveEdgeType fEdgeType; | 73 GrPrimitiveEdgeType fEdgeType; |
74 uint32_t fCircularCornerFlags; | 74 uint32_t fCircularCornerFlags; |
75 | 75 |
76 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 76 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
77 | 77 |
78 typedef GrFragmentProcessor INHERITED; | 78 typedef GrFragmentProcessor INHERITED; |
79 }; | 79 }; |
80 | 80 |
81 GrFragmentProcessor* CircularRRectEffect::Create(GrPrimitiveEdgeType edgeType, | 81 sk_sp<GrFragmentProcessor> CircularRRectEffect::Make(GrPrimitiveEdgeType edgeTyp
e, |
82 uint32_t circularCornerFlags, | 82 uint32_t circularCornerFlag
s, |
83 const SkRRect& rrect) { | 83 const SkRRect& rrect) { |
84 if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdg
eType != edgeType) { | 84 if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdg
eType != edgeType) { |
85 return nullptr; | 85 return nullptr; |
86 } | 86 } |
87 return new CircularRRectEffect(edgeType, circularCornerFlags, rrect); | 87 return sk_sp<GrFragmentProcessor>( |
| 88 new CircularRRectEffect(edgeType, circularCornerFlags, rrect)); |
88 } | 89 } |
89 | 90 |
90 void CircularRRectEffect::onComputeInvariantOutput(GrInvariantOutput* inout) con
st { | 91 void CircularRRectEffect::onComputeInvariantOutput(GrInvariantOutput* inout) con
st { |
91 inout->mulByUnknownSingleComponent(); | 92 inout->mulByUnknownSingleComponent(); |
92 } | 93 } |
93 | 94 |
94 CircularRRectEffect::CircularRRectEffect(GrPrimitiveEdgeType edgeType, uint32_t
circularCornerFlags, | 95 CircularRRectEffect::CircularRRectEffect(GrPrimitiveEdgeType edgeType, uint32_t
circularCornerFlags, |
95 const SkRRect& rrect) | 96 const SkRRect& rrect) |
96 : fRRect(rrect) | 97 : fRRect(rrect) |
97 , fEdgeType(edgeType) | 98 , fEdgeType(edgeType) |
98 , fCircularCornerFlags(circularCornerFlags) { | 99 , fCircularCornerFlags(circularCornerFlags) { |
99 this->initClassID<CircularRRectEffect>(); | 100 this->initClassID<CircularRRectEffect>(); |
100 this->setWillReadFragmentPosition(); | 101 this->setWillReadFragmentPosition(); |
101 } | 102 } |
102 | 103 |
103 bool CircularRRectEffect::onIsEqual(const GrFragmentProcessor& other) const { | 104 bool CircularRRectEffect::onIsEqual(const GrFragmentProcessor& other) const { |
104 const CircularRRectEffect& crre = other.cast<CircularRRectEffect>(); | 105 const CircularRRectEffect& crre = other.cast<CircularRRectEffect>(); |
105 // The corner flags are derived from fRRect, so no need to check them. | 106 // The corner flags are derived from fRRect, so no need to check them. |
106 return fEdgeType == crre.fEdgeType && fRRect == crre.fRRect; | 107 return fEdgeType == crre.fEdgeType && fRRect == crre.fRRect; |
107 } | 108 } |
108 | 109 |
109 ////////////////////////////////////////////////////////////////////////////// | 110 ////////////////////////////////////////////////////////////////////////////// |
110 | 111 |
111 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircularRRectEffect); | 112 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircularRRectEffect); |
112 | 113 |
113 const GrFragmentProcessor* CircularRRectEffect::TestCreate(GrProcessorTestData*
d) { | 114 sk_sp<GrFragmentProcessor> CircularRRectEffect::TestCreate(GrProcessorTestData*
d) { |
114 SkScalar w = d->fRandom->nextRangeScalar(20.f, 1000.f); | 115 SkScalar w = d->fRandom->nextRangeScalar(20.f, 1000.f); |
115 SkScalar h = d->fRandom->nextRangeScalar(20.f, 1000.f); | 116 SkScalar h = d->fRandom->nextRangeScalar(20.f, 1000.f); |
116 SkScalar r = d->fRandom->nextRangeF(kRadiusMin, 9.f); | 117 SkScalar r = d->fRandom->nextRangeF(kRadiusMin, 9.f); |
117 SkRRect rrect; | 118 SkRRect rrect; |
118 rrect.setRectXY(SkRect::MakeWH(w, h), r, r); | 119 rrect.setRectXY(SkRect::MakeWH(w, h), r, r); |
119 GrFragmentProcessor* fp; | 120 sk_sp<GrFragmentProcessor> fp; |
120 do { | 121 do { |
121 GrPrimitiveEdgeType et = | 122 GrPrimitiveEdgeType et = |
122 (GrPrimitiveEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeT
ypeCnt); | 123 (GrPrimitiveEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeT
ypeCnt); |
123 fp = GrRRectEffect::Create(et, rrect); | 124 fp = GrRRectEffect::Make(et, rrect); |
124 } while (nullptr == fp); | 125 } while (nullptr == fp); |
125 return fp; | 126 return fp; |
126 } | 127 } |
127 | 128 |
128 ////////////////////////////////////////////////////////////////////////////// | 129 ////////////////////////////////////////////////////////////////////////////// |
129 | 130 |
130 class GLCircularRRectEffect : public GrGLSLFragmentProcessor { | 131 class GLCircularRRectEffect : public GrGLSLFragmentProcessor { |
131 public: | 132 public: |
132 GLCircularRRectEffect() { | 133 GLCircularRRectEffect() { |
133 fPrevRRect.setEmpty(); | 134 fPrevRRect.setEmpty(); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 381 } |
381 | 382 |
382 GrGLSLFragmentProcessor* CircularRRectEffect::onCreateGLSLInstance() const { | 383 GrGLSLFragmentProcessor* CircularRRectEffect::onCreateGLSLInstance() const { |
383 return new GLCircularRRectEffect; | 384 return new GLCircularRRectEffect; |
384 } | 385 } |
385 | 386 |
386 ////////////////////////////////////////////////////////////////////////////// | 387 ////////////////////////////////////////////////////////////////////////////// |
387 | 388 |
388 class EllipticalRRectEffect : public GrFragmentProcessor { | 389 class EllipticalRRectEffect : public GrFragmentProcessor { |
389 public: | 390 public: |
390 static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkRRect&); | 391 static sk_sp<GrFragmentProcessor> Make(GrPrimitiveEdgeType, const SkRRect&); |
391 | 392 |
392 virtual ~EllipticalRRectEffect() {}; | 393 virtual ~EllipticalRRectEffect() {}; |
393 | 394 |
394 const char* name() const override { return "EllipticalRRect"; } | 395 const char* name() const override { return "EllipticalRRect"; } |
395 | 396 |
396 const SkRRect& getRRect() const { return fRRect; } | 397 const SkRRect& getRRect() const { return fRRect; } |
397 | 398 |
398 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } | 399 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } |
399 | 400 |
400 private: | 401 private: |
401 EllipticalRRectEffect(GrPrimitiveEdgeType, const SkRRect&); | 402 EllipticalRRectEffect(GrPrimitiveEdgeType, const SkRRect&); |
402 | 403 |
403 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; | 404 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
404 | 405 |
405 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const
override; | 406 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const
override; |
406 | 407 |
407 bool onIsEqual(const GrFragmentProcessor& other) const override; | 408 bool onIsEqual(const GrFragmentProcessor& other) const override; |
408 | 409 |
409 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; | 410 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
410 | 411 |
411 SkRRect fRRect; | 412 SkRRect fRRect; |
412 GrPrimitiveEdgeType fEdgeType; | 413 GrPrimitiveEdgeType fEdgeType; |
413 | 414 |
414 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 415 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
415 | 416 |
416 typedef GrFragmentProcessor INHERITED; | 417 typedef GrFragmentProcessor INHERITED; |
417 }; | 418 }; |
418 | 419 |
419 GrFragmentProcessor* | 420 sk_sp<GrFragmentProcessor> |
420 EllipticalRRectEffect::Create(GrPrimitiveEdgeType edgeType, const SkRRect& rrect
) { | 421 EllipticalRRectEffect::Make(GrPrimitiveEdgeType edgeType, const SkRRect& rrect)
{ |
421 if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdg
eType != edgeType) { | 422 if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdg
eType != edgeType) { |
422 return nullptr; | 423 return nullptr; |
423 } | 424 } |
424 return new EllipticalRRectEffect(edgeType, rrect); | 425 return sk_sp<GrFragmentProcessor>(new EllipticalRRectEffect(edgeType, rrect)
); |
425 } | 426 } |
426 | 427 |
427 void EllipticalRRectEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c
onst { | 428 void EllipticalRRectEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c
onst { |
428 inout->mulByUnknownSingleComponent(); | 429 inout->mulByUnknownSingleComponent(); |
429 } | 430 } |
430 | 431 |
431 EllipticalRRectEffect::EllipticalRRectEffect(GrPrimitiveEdgeType edgeType, const
SkRRect& rrect) | 432 EllipticalRRectEffect::EllipticalRRectEffect(GrPrimitiveEdgeType edgeType, const
SkRRect& rrect) |
432 : fRRect(rrect) | 433 : fRRect(rrect) |
433 , fEdgeType(edgeType) { | 434 , fEdgeType(edgeType) { |
434 this->initClassID<EllipticalRRectEffect>(); | 435 this->initClassID<EllipticalRRectEffect>(); |
435 this->setWillReadFragmentPosition(); | 436 this->setWillReadFragmentPosition(); |
436 } | 437 } |
437 | 438 |
438 bool EllipticalRRectEffect::onIsEqual(const GrFragmentProcessor& other) const { | 439 bool EllipticalRRectEffect::onIsEqual(const GrFragmentProcessor& other) const { |
439 const EllipticalRRectEffect& erre = other.cast<EllipticalRRectEffect>(); | 440 const EllipticalRRectEffect& erre = other.cast<EllipticalRRectEffect>(); |
440 return fEdgeType == erre.fEdgeType && fRRect == erre.fRRect; | 441 return fEdgeType == erre.fEdgeType && fRRect == erre.fRRect; |
441 } | 442 } |
442 | 443 |
443 ////////////////////////////////////////////////////////////////////////////// | 444 ////////////////////////////////////////////////////////////////////////////// |
444 | 445 |
445 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipticalRRectEffect); | 446 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipticalRRectEffect); |
446 | 447 |
447 const GrFragmentProcessor* EllipticalRRectEffect::TestCreate(GrProcessorTestData
* d) { | 448 sk_sp<GrFragmentProcessor> EllipticalRRectEffect::TestCreate(GrProcessorTestData
* d) { |
448 SkScalar w = d->fRandom->nextRangeScalar(20.f, 1000.f); | 449 SkScalar w = d->fRandom->nextRangeScalar(20.f, 1000.f); |
449 SkScalar h = d->fRandom->nextRangeScalar(20.f, 1000.f); | 450 SkScalar h = d->fRandom->nextRangeScalar(20.f, 1000.f); |
450 SkVector r[4]; | 451 SkVector r[4]; |
451 r[SkRRect::kUpperLeft_Corner].fX = d->fRandom->nextRangeF(kRadiusMin, 9.f); | 452 r[SkRRect::kUpperLeft_Corner].fX = d->fRandom->nextRangeF(kRadiusMin, 9.f); |
452 // ensure at least one corner really is elliptical | 453 // ensure at least one corner really is elliptical |
453 do { | 454 do { |
454 r[SkRRect::kUpperLeft_Corner].fY = d->fRandom->nextRangeF(kRadiusMin, 9.
f); | 455 r[SkRRect::kUpperLeft_Corner].fY = d->fRandom->nextRangeF(kRadiusMin, 9.
f); |
455 } while (r[SkRRect::kUpperLeft_Corner].fY == r[SkRRect::kUpperLeft_Corner].f
X); | 456 } while (r[SkRRect::kUpperLeft_Corner].fY == r[SkRRect::kUpperLeft_Corner].f
X); |
456 | 457 |
457 SkRRect rrect; | 458 SkRRect rrect; |
458 if (d->fRandom->nextBool()) { | 459 if (d->fRandom->nextBool()) { |
459 // half the time create a four-radii rrect. | 460 // half the time create a four-radii rrect. |
460 r[SkRRect::kLowerRight_Corner].fX = d->fRandom->nextRangeF(kRadiusMin, 9
.f); | 461 r[SkRRect::kLowerRight_Corner].fX = d->fRandom->nextRangeF(kRadiusMin, 9
.f); |
461 r[SkRRect::kLowerRight_Corner].fY = d->fRandom->nextRangeF(kRadiusMin, 9
.f); | 462 r[SkRRect::kLowerRight_Corner].fY = d->fRandom->nextRangeF(kRadiusMin, 9
.f); |
462 | 463 |
463 r[SkRRect::kUpperRight_Corner].fX = r[SkRRect::kLowerRight_Corner].fX; | 464 r[SkRRect::kUpperRight_Corner].fX = r[SkRRect::kLowerRight_Corner].fX; |
464 r[SkRRect::kUpperRight_Corner].fY = r[SkRRect::kUpperLeft_Corner].fY; | 465 r[SkRRect::kUpperRight_Corner].fY = r[SkRRect::kUpperLeft_Corner].fY; |
465 | 466 |
466 r[SkRRect::kLowerLeft_Corner].fX = r[SkRRect::kUpperLeft_Corner].fX; | 467 r[SkRRect::kLowerLeft_Corner].fX = r[SkRRect::kUpperLeft_Corner].fX; |
467 r[SkRRect::kLowerLeft_Corner].fY = r[SkRRect::kLowerRight_Corner].fY; | 468 r[SkRRect::kLowerLeft_Corner].fY = r[SkRRect::kLowerRight_Corner].fY; |
468 | 469 |
469 rrect.setRectRadii(SkRect::MakeWH(w, h), r); | 470 rrect.setRectRadii(SkRect::MakeWH(w, h), r); |
470 } else { | 471 } else { |
471 rrect.setRectXY(SkRect::MakeWH(w, h), r[SkRRect::kUpperLeft_Corner].fX, | 472 rrect.setRectXY(SkRect::MakeWH(w, h), r[SkRRect::kUpperLeft_Corner].fX, |
472 r[SkRRect::kUpperLeft_Corner].fY); | 473 r[SkRRect::kUpperLeft_Corner].fY); |
473 } | 474 } |
474 GrFragmentProcessor* fp; | 475 sk_sp<GrFragmentProcessor> fp; |
475 do { | 476 do { |
476 GrPrimitiveEdgeType et = | 477 GrPrimitiveEdgeType et = |
477 (GrPrimitiveEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeT
ypeCnt); | 478 (GrPrimitiveEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeT
ypeCnt); |
478 fp = GrRRectEffect::Create(et, rrect); | 479 fp = GrRRectEffect::Make(et, rrect); |
479 } while (nullptr == fp); | 480 } while (nullptr == fp); |
480 return fp; | 481 return fp; |
481 } | 482 } |
482 | 483 |
483 ////////////////////////////////////////////////////////////////////////////// | 484 ////////////////////////////////////////////////////////////////////////////// |
484 | 485 |
485 class GLEllipticalRRectEffect : public GrGLSLFragmentProcessor { | 486 class GLEllipticalRRectEffect : public GrGLSLFragmentProcessor { |
486 public: | 487 public: |
487 GLEllipticalRRectEffect() { | 488 GLEllipticalRRectEffect() { |
488 fPrevRRect.setEmpty(); | 489 fPrevRRect.setEmpty(); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 GrProcessorKeyBuilder* b) cons
t { | 674 GrProcessorKeyBuilder* b) cons
t { |
674 GLEllipticalRRectEffect::GenKey(*this, caps, b); | 675 GLEllipticalRRectEffect::GenKey(*this, caps, b); |
675 } | 676 } |
676 | 677 |
677 GrGLSLFragmentProcessor* EllipticalRRectEffect::onCreateGLSLInstance() const { | 678 GrGLSLFragmentProcessor* EllipticalRRectEffect::onCreateGLSLInstance() const { |
678 return new GLEllipticalRRectEffect; | 679 return new GLEllipticalRRectEffect; |
679 } | 680 } |
680 | 681 |
681 ////////////////////////////////////////////////////////////////////////////// | 682 ////////////////////////////////////////////////////////////////////////////// |
682 | 683 |
683 GrFragmentProcessor* GrRRectEffect::Create(GrPrimitiveEdgeType edgeType, const S
kRRect& rrect) { | 684 sk_sp<GrFragmentProcessor> GrRRectEffect::Make(GrPrimitiveEdgeType edgeType, con
st SkRRect& rrect) { |
684 if (rrect.isRect()) { | 685 if (rrect.isRect()) { |
685 return GrConvexPolyEffect::Create(edgeType, rrect.getBounds()); | 686 return GrConvexPolyEffect::Make(edgeType, rrect.getBounds()); |
686 } | 687 } |
687 | 688 |
688 if (rrect.isOval()) { | 689 if (rrect.isOval()) { |
689 return GrOvalEffect::Create(edgeType, rrect.getBounds()); | 690 return GrOvalEffect::Make(edgeType, rrect.getBounds()); |
690 } | 691 } |
691 | 692 |
692 if (rrect.isSimple()) { | 693 if (rrect.isSimple()) { |
693 if (rrect.getSimpleRadii().fX < kRadiusMin || rrect.getSimpleRadii().fY
< kRadiusMin) { | 694 if (rrect.getSimpleRadii().fX < kRadiusMin || rrect.getSimpleRadii().fY
< kRadiusMin) { |
694 // In this case the corners are extremely close to rectangular and w
e collapse the | 695 // In this case the corners are extremely close to rectangular and w
e collapse the |
695 // clip to a rectangular clip. | 696 // clip to a rectangular clip. |
696 return GrConvexPolyEffect::Create(edgeType, rrect.getBounds()); | 697 return GrConvexPolyEffect::Make(edgeType, rrect.getBounds()); |
697 } | 698 } |
698 if (rrect.getSimpleRadii().fX == rrect.getSimpleRadii().fY) { | 699 if (rrect.getSimpleRadii().fX == rrect.getSimpleRadii().fY) { |
699 return CircularRRectEffect::Create(edgeType, CircularRRectEffect::kA
ll_CornerFlags, | 700 return CircularRRectEffect::Make(edgeType, CircularRRectEffect::kAll
_CornerFlags, |
700 rrect); | 701 rrect); |
701 } else { | 702 } else { |
702 return EllipticalRRectEffect::Create(edgeType, rrect); | 703 return EllipticalRRectEffect::Make(edgeType, rrect); |
703 } | 704 } |
704 } | 705 } |
705 | 706 |
706 if (rrect.isComplex() || rrect.isNinePatch()) { | 707 if (rrect.isComplex() || rrect.isNinePatch()) { |
707 // Check for the "tab" cases - two adjacent circular corners and two squ
are corners. | 708 // Check for the "tab" cases - two adjacent circular corners and two squ
are corners. |
708 SkScalar circularRadius = 0; | 709 SkScalar circularRadius = 0; |
709 uint32_t cornerFlags = 0; | 710 uint32_t cornerFlags = 0; |
710 | 711 |
711 SkVector radii[4]; | 712 SkVector radii[4]; |
712 bool squashedRadii = false; | 713 bool squashedRadii = false; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 case CircularRRectEffect::kBottomRight_CornerFlag: | 749 case CircularRRectEffect::kBottomRight_CornerFlag: |
749 case CircularRRectEffect::kBottomLeft_CornerFlag: | 750 case CircularRRectEffect::kBottomLeft_CornerFlag: |
750 case CircularRRectEffect::kLeft_CornerFlags: | 751 case CircularRRectEffect::kLeft_CornerFlags: |
751 case CircularRRectEffect::kTop_CornerFlags: | 752 case CircularRRectEffect::kTop_CornerFlags: |
752 case CircularRRectEffect::kRight_CornerFlags: | 753 case CircularRRectEffect::kRight_CornerFlags: |
753 case CircularRRectEffect::kBottom_CornerFlags: { | 754 case CircularRRectEffect::kBottom_CornerFlags: { |
754 SkTCopyOnFirstWrite<SkRRect> rr(rrect); | 755 SkTCopyOnFirstWrite<SkRRect> rr(rrect); |
755 if (squashedRadii) { | 756 if (squashedRadii) { |
756 rr.writable()->setRectRadii(rrect.getBounds(), radii); | 757 rr.writable()->setRectRadii(rrect.getBounds(), radii); |
757 } | 758 } |
758 return CircularRRectEffect::Create(edgeType, cornerFlags, *rr); | 759 return CircularRRectEffect::Make(edgeType, cornerFlags, *rr); |
759 } | 760 } |
760 case CircularRRectEffect::kNone_CornerFlags: | 761 case CircularRRectEffect::kNone_CornerFlags: |
761 return GrConvexPolyEffect::Create(edgeType, rrect.getBounds()); | 762 return GrConvexPolyEffect::Make(edgeType, rrect.getBounds()); |
762 default: { | 763 default: { |
763 if (squashedRadii) { | 764 if (squashedRadii) { |
764 // If we got here then we squashed some but not all the radi
i to zero. (If all | 765 // If we got here then we squashed some but not all the radi
i to zero. (If all |
765 // had been squashed cornerFlags would be 0.) The elliptical
effect doesn't | 766 // had been squashed cornerFlags would be 0.) The elliptical
effect doesn't |
766 // support some rounded and some square corners. | 767 // support some rounded and some square corners. |
767 return nullptr; | 768 return nullptr; |
768 } | 769 } |
769 if (rrect.isNinePatch()) { | 770 if (rrect.isNinePatch()) { |
770 return EllipticalRRectEffect::Create(edgeType, rrect); | 771 return EllipticalRRectEffect::Make(edgeType, rrect); |
771 } | 772 } |
772 return nullptr; | 773 return nullptr; |
773 } | 774 } |
774 } | 775 } |
775 } | 776 } |
776 | 777 |
777 return nullptr; | 778 return nullptr; |
778 } | 779 } |
OLD | NEW |