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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 typedef GrFragmentProcessor INHERITED; | 75 typedef GrFragmentProcessor INHERITED; |
76 }; | 76 }; |
77 | 77 |
78 GrFragmentProcessor* CircularRRectEffect::Create(GrPrimitiveEdgeType edgeType, | 78 GrFragmentProcessor* CircularRRectEffect::Create(GrPrimitiveEdgeType edgeType, |
79 uint32_t circularCornerFlags, | 79 uint32_t circularCornerFlags, |
80 const SkRRect& rrect) { | 80 const SkRRect& rrect) { |
81 if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdg
eType != edgeType) { | 81 if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdg
eType != edgeType) { |
82 return NULL; | 82 return NULL; |
83 } | 83 } |
84 return SkNEW_ARGS(CircularRRectEffect, (edgeType, circularCornerFlags, rrect
)); | 84 return new CircularRRectEffect(edgeType, circularCornerFlags, rrect); |
85 } | 85 } |
86 | 86 |
87 void CircularRRectEffect::onComputeInvariantOutput(GrInvariantOutput* inout) con
st { | 87 void CircularRRectEffect::onComputeInvariantOutput(GrInvariantOutput* inout) con
st { |
88 inout->mulByUnknownSingleComponent(); | 88 inout->mulByUnknownSingleComponent(); |
89 } | 89 } |
90 | 90 |
91 CircularRRectEffect::CircularRRectEffect(GrPrimitiveEdgeType edgeType, uint32_t
circularCornerFlags, | 91 CircularRRectEffect::CircularRRectEffect(GrPrimitiveEdgeType edgeType, uint32_t
circularCornerFlags, |
92 const SkRRect& rrect) | 92 const SkRRect& rrect) |
93 : fRRect(rrect) | 93 : fRRect(rrect) |
94 , fEdgeType(edgeType) | 94 , fEdgeType(edgeType) |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 } | 361 } |
362 | 362 |
363 ////////////////////////////////////////////////////////////////////////////////
//////////////////// | 363 ////////////////////////////////////////////////////////////////////////////////
//////////////////// |
364 | 364 |
365 void CircularRRectEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, | 365 void CircularRRectEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, |
366 GrProcessorKeyBuilder* b) const { | 366 GrProcessorKeyBuilder* b) const { |
367 GLCircularRRectEffect::GenKey(*this, caps, b); | 367 GLCircularRRectEffect::GenKey(*this, caps, b); |
368 } | 368 } |
369 | 369 |
370 GrGLFragmentProcessor* CircularRRectEffect::onCreateGLInstance() const { | 370 GrGLFragmentProcessor* CircularRRectEffect::onCreateGLInstance() const { |
371 return SkNEW_ARGS(GLCircularRRectEffect, (*this)); | 371 return new GLCircularRRectEffect(*this); |
372 } | 372 } |
373 | 373 |
374 ////////////////////////////////////////////////////////////////////////////// | 374 ////////////////////////////////////////////////////////////////////////////// |
375 | 375 |
376 class EllipticalRRectEffect : public GrFragmentProcessor { | 376 class EllipticalRRectEffect : public GrFragmentProcessor { |
377 public: | 377 public: |
378 static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkRRect&); | 378 static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkRRect&); |
379 | 379 |
380 virtual ~EllipticalRRectEffect() {}; | 380 virtual ~EllipticalRRectEffect() {}; |
381 | 381 |
(...skipping 20 matching lines...) Expand all Loading... |
402 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 402 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
403 | 403 |
404 typedef GrFragmentProcessor INHERITED; | 404 typedef GrFragmentProcessor INHERITED; |
405 }; | 405 }; |
406 | 406 |
407 GrFragmentProcessor* | 407 GrFragmentProcessor* |
408 EllipticalRRectEffect::Create(GrPrimitiveEdgeType edgeType, const SkRRect& rrect
) { | 408 EllipticalRRectEffect::Create(GrPrimitiveEdgeType edgeType, const SkRRect& rrect
) { |
409 if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdg
eType != edgeType) { | 409 if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdg
eType != edgeType) { |
410 return NULL; | 410 return NULL; |
411 } | 411 } |
412 return SkNEW_ARGS(EllipticalRRectEffect, (edgeType, rrect)); | 412 return new EllipticalRRectEffect(edgeType, rrect); |
413 } | 413 } |
414 | 414 |
415 void EllipticalRRectEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c
onst { | 415 void EllipticalRRectEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c
onst { |
416 inout->mulByUnknownSingleComponent(); | 416 inout->mulByUnknownSingleComponent(); |
417 } | 417 } |
418 | 418 |
419 EllipticalRRectEffect::EllipticalRRectEffect(GrPrimitiveEdgeType edgeType, const
SkRRect& rrect) | 419 EllipticalRRectEffect::EllipticalRRectEffect(GrPrimitiveEdgeType edgeType, const
SkRRect& rrect) |
420 : fRRect(rrect) | 420 : fRRect(rrect) |
421 , fEdgeType(edgeType) { | 421 , fEdgeType(edgeType) { |
422 this->initClassID<EllipticalRRectEffect>(); | 422 this->initClassID<EllipticalRRectEffect>(); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 } | 610 } |
611 | 611 |
612 ////////////////////////////////////////////////////////////////////////////////
//////////////////// | 612 ////////////////////////////////////////////////////////////////////////////////
//////////////////// |
613 | 613 |
614 void EllipticalRRectEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, | 614 void EllipticalRRectEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, |
615 GrProcessorKeyBuilder* b) const { | 615 GrProcessorKeyBuilder* b) const { |
616 GLEllipticalRRectEffect::GenKey(*this, caps, b); | 616 GLEllipticalRRectEffect::GenKey(*this, caps, b); |
617 } | 617 } |
618 | 618 |
619 GrGLFragmentProcessor* EllipticalRRectEffect::onCreateGLInstance() const { | 619 GrGLFragmentProcessor* EllipticalRRectEffect::onCreateGLInstance() const { |
620 return SkNEW_ARGS(GLEllipticalRRectEffect, (*this)); | 620 return new GLEllipticalRRectEffect(*this); |
621 } | 621 } |
622 | 622 |
623 ////////////////////////////////////////////////////////////////////////////// | 623 ////////////////////////////////////////////////////////////////////////////// |
624 | 624 |
625 GrFragmentProcessor* GrRRectEffect::Create(GrPrimitiveEdgeType edgeType, const S
kRRect& rrect) { | 625 GrFragmentProcessor* GrRRectEffect::Create(GrPrimitiveEdgeType edgeType, const S
kRRect& rrect) { |
626 if (rrect.isRect()) { | 626 if (rrect.isRect()) { |
627 return GrConvexPolyEffect::Create(edgeType, rrect.getBounds()); | 627 return GrConvexPolyEffect::Create(edgeType, rrect.getBounds()); |
628 } | 628 } |
629 | 629 |
630 if (rrect.isOval()) { | 630 if (rrect.isOval()) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 if (rrect.isNinePatch()) { | 711 if (rrect.isNinePatch()) { |
712 return EllipticalRRectEffect::Create(edgeType, rrect); | 712 return EllipticalRRectEffect::Create(edgeType, rrect); |
713 } | 713 } |
714 return NULL; | 714 return NULL; |
715 } | 715 } |
716 } | 716 } |
717 } | 717 } |
718 | 718 |
719 return NULL; | 719 return NULL; |
720 } | 720 } |
OLD | NEW |