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 "gl/builders/GrGLProgramBuilder.h" | 8 #include "gl/builders/GrGLProgramBuilder.h" |
9 #include "GrRRectEffect.h" | 9 #include "GrRRectEffect.h" |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } | 58 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } |
59 | 59 |
60 typedef GLCircularRRectEffect GLProcessor; | 60 typedef GLCircularRRectEffect GLProcessor; |
61 | 61 |
62 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; | 62 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; |
63 | 63 |
64 private: | 64 private: |
65 CircularRRectEffect(GrPrimitiveEdgeType, uint32_t circularCornerFlags, const
SkRRect&); | 65 CircularRRectEffect(GrPrimitiveEdgeType, uint32_t circularCornerFlags, const
SkRRect&); |
66 | 66 |
67 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; | 67 virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE; |
68 | 68 |
69 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; | 69 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; |
70 | 70 |
71 SkRRect fRRect; | 71 SkRRect fRRect; |
72 GrPrimitiveEdgeType fEdgeType; | 72 GrPrimitiveEdgeType fEdgeType; |
73 uint32_t fCircularCornerFlags; | 73 uint32_t fCircularCornerFlags; |
74 | 74 |
75 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 75 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
76 | 76 |
77 typedef GrFragmentProcessor INHERITED; | 77 typedef GrFragmentProcessor INHERITED; |
(...skipping 17 matching lines...) Expand all Loading... |
95 } | 95 } |
96 | 96 |
97 CircularRRectEffect::CircularRRectEffect(GrPrimitiveEdgeType edgeType, uint32_t
circularCornerFlags, | 97 CircularRRectEffect::CircularRRectEffect(GrPrimitiveEdgeType edgeType, uint32_t
circularCornerFlags, |
98 const SkRRect& rrect) | 98 const SkRRect& rrect) |
99 : fRRect(rrect) | 99 : fRRect(rrect) |
100 , fEdgeType(edgeType) | 100 , fEdgeType(edgeType) |
101 , fCircularCornerFlags(circularCornerFlags) { | 101 , fCircularCornerFlags(circularCornerFlags) { |
102 this->setWillReadFragmentPosition(); | 102 this->setWillReadFragmentPosition(); |
103 } | 103 } |
104 | 104 |
105 bool CircularRRectEffect::onIsEqual(const GrProcessor& other) const { | 105 bool CircularRRectEffect::onIsEqual(const GrFragmentProcessor& other) const { |
106 const CircularRRectEffect& crre = other.cast<CircularRRectEffect>(); | 106 const CircularRRectEffect& crre = other.cast<CircularRRectEffect>(); |
107 // The corner flags are derived from fRRect, so no need to check them. | 107 // The corner flags are derived from fRRect, so no need to check them. |
108 return fEdgeType == crre.fEdgeType && fRRect == crre.fRRect; | 108 return fEdgeType == crre.fEdgeType && fRRect == crre.fRRect; |
109 } | 109 } |
110 | 110 |
111 ////////////////////////////////////////////////////////////////////////////// | 111 ////////////////////////////////////////////////////////////////////////////// |
112 | 112 |
113 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircularRRectEffect); | 113 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircularRRectEffect); |
114 | 114 |
115 GrFragmentProcessor* CircularRRectEffect::TestCreate(SkRandom* random, | 115 GrFragmentProcessor* CircularRRectEffect::TestCreate(SkRandom* random, |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 | 397 |
398 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } | 398 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } |
399 | 399 |
400 typedef GLEllipticalRRectEffect GLProcessor; | 400 typedef GLEllipticalRRectEffect GLProcessor; |
401 | 401 |
402 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; | 402 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; |
403 | 403 |
404 private: | 404 private: |
405 EllipticalRRectEffect(GrPrimitiveEdgeType, const SkRRect&); | 405 EllipticalRRectEffect(GrPrimitiveEdgeType, const SkRRect&); |
406 | 406 |
407 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; | 407 virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE; |
408 | 408 |
409 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; | 409 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; |
410 | 410 |
411 SkRRect fRRect; | 411 SkRRect fRRect; |
412 GrPrimitiveEdgeType fEdgeType; | 412 GrPrimitiveEdgeType fEdgeType; |
413 | 413 |
414 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 414 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
415 | 415 |
416 typedef GrFragmentProcessor INHERITED; | 416 typedef GrFragmentProcessor INHERITED; |
417 }; | 417 }; |
(...skipping 13 matching lines...) Expand all Loading... |
431 const GrBackendFragmentProcessorFactory& EllipticalRRectEffect::getFactory() con
st { | 431 const GrBackendFragmentProcessorFactory& EllipticalRRectEffect::getFactory() con
st { |
432 return GrTBackendFragmentProcessorFactory<EllipticalRRectEffect>::getInstanc
e(); | 432 return GrTBackendFragmentProcessorFactory<EllipticalRRectEffect>::getInstanc
e(); |
433 } | 433 } |
434 | 434 |
435 EllipticalRRectEffect::EllipticalRRectEffect(GrPrimitiveEdgeType edgeType, const
SkRRect& rrect) | 435 EllipticalRRectEffect::EllipticalRRectEffect(GrPrimitiveEdgeType edgeType, const
SkRRect& rrect) |
436 : fRRect(rrect) | 436 : fRRect(rrect) |
437 , fEdgeType(edgeType){ | 437 , fEdgeType(edgeType){ |
438 this->setWillReadFragmentPosition(); | 438 this->setWillReadFragmentPosition(); |
439 } | 439 } |
440 | 440 |
441 bool EllipticalRRectEffect::onIsEqual(const GrProcessor& other) const { | 441 bool EllipticalRRectEffect::onIsEqual(const GrFragmentProcessor& other) const { |
442 const EllipticalRRectEffect& erre = other.cast<EllipticalRRectEffect>(); | 442 const EllipticalRRectEffect& erre = other.cast<EllipticalRRectEffect>(); |
443 return fEdgeType == erre.fEdgeType && fRRect == erre.fRRect; | 443 return fEdgeType == erre.fEdgeType && fRRect == erre.fRRect; |
444 } | 444 } |
445 | 445 |
446 ////////////////////////////////////////////////////////////////////////////// | 446 ////////////////////////////////////////////////////////////////////////////// |
447 | 447 |
448 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipticalRRectEffect); | 448 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipticalRRectEffect); |
449 | 449 |
450 GrFragmentProcessor* EllipticalRRectEffect::TestCreate(SkRandom* random, | 450 GrFragmentProcessor* EllipticalRRectEffect::TestCreate(SkRandom* random, |
451 GrContext*, | 451 GrContext*, |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 if (rrect.isNinePatch()) { | 728 if (rrect.isNinePatch()) { |
729 return EllipticalRRectEffect::Create(edgeType, rrect); | 729 return EllipticalRRectEffect::Create(edgeType, rrect); |
730 } | 730 } |
731 return NULL; | 731 return NULL; |
732 } | 732 } |
733 } | 733 } |
734 } | 734 } |
735 | 735 |
736 return NULL; | 736 return NULL; |
737 } | 737 } |
OLD | NEW |