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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 static const char* Name() { return "CircularRRect"; } | 52 static const char* Name() { return "CircularRRect"; } |
53 | 53 |
54 const SkRRect& getRRect() const { return fRRect; } | 54 const SkRRect& getRRect() const { return fRRect; } |
55 | 55 |
56 uint32_t getCircularCornerFlags() const { return fCircularCornerFlags; } | 56 uint32_t getCircularCornerFlags() const { return fCircularCornerFlags; } |
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 void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; | |
63 | |
64 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; | 62 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; |
65 | 63 |
66 private: | 64 private: |
67 CircularRRectEffect(GrPrimitiveEdgeType, uint32_t circularCornerFlags, const
SkRRect&); | 65 CircularRRectEffect(GrPrimitiveEdgeType, uint32_t circularCornerFlags, const
SkRRect&); |
68 | 66 |
69 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; | 67 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; |
70 | 68 |
| 69 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; |
| 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; |
78 }; | 78 }; |
79 | 79 |
80 GrFragmentProcessor* CircularRRectEffect::Create(GrPrimitiveEdgeType edgeType, | 80 GrFragmentProcessor* CircularRRectEffect::Create(GrPrimitiveEdgeType edgeType, |
81 uint32_t circularCornerFlags, | 81 uint32_t circularCornerFlags, |
82 const SkRRect& rrect) { | 82 const SkRRect& rrect) { |
83 if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdg
eType != edgeType) { | 83 if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdg
eType != edgeType) { |
84 return NULL; | 84 return NULL; |
85 } | 85 } |
86 return SkNEW_ARGS(CircularRRectEffect, (edgeType, circularCornerFlags, rrect
)); | 86 return SkNEW_ARGS(CircularRRectEffect, (edgeType, circularCornerFlags, rrect
)); |
87 } | 87 } |
88 | 88 |
89 void CircularRRectEffect::getConstantColorComponents(GrColor* color, uint32_t* v
alidFlags) const { | 89 void CircularRRectEffect::onComputeInvariantOutput(InvariantOutput* inout) const
{ |
90 *validFlags = 0; | 90 inout->fValidFlags = 0; |
| 91 inout->fIsSingleComponent = false; |
91 } | 92 } |
92 | 93 |
93 const GrBackendFragmentProcessorFactory& CircularRRectEffect::getFactory() const
{ | 94 const GrBackendFragmentProcessorFactory& CircularRRectEffect::getFactory() const
{ |
94 return GrTBackendFragmentProcessorFactory<CircularRRectEffect>::getInstance(
); | 95 return GrTBackendFragmentProcessorFactory<CircularRRectEffect>::getInstance(
); |
95 } | 96 } |
96 | 97 |
97 CircularRRectEffect::CircularRRectEffect(GrPrimitiveEdgeType edgeType, uint32_t
circularCornerFlags, | 98 CircularRRectEffect::CircularRRectEffect(GrPrimitiveEdgeType edgeType, uint32_t
circularCornerFlags, |
98 const SkRRect& rrect) | 99 const SkRRect& rrect) |
99 : fRRect(rrect) | 100 : fRRect(rrect) |
100 , fEdgeType(edgeType) | 101 , fEdgeType(edgeType) |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 virtual ~EllipticalRRectEffect() {}; | 393 virtual ~EllipticalRRectEffect() {}; |
393 static const char* Name() { return "EllipticalRRect"; } | 394 static const char* Name() { return "EllipticalRRect"; } |
394 | 395 |
395 const SkRRect& getRRect() const { return fRRect; } | 396 const SkRRect& getRRect() const { return fRRect; } |
396 | 397 |
397 | 398 |
398 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } | 399 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } |
399 | 400 |
400 typedef GLEllipticalRRectEffect GLProcessor; | 401 typedef GLEllipticalRRectEffect GLProcessor; |
401 | 402 |
402 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; | |
403 | |
404 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; | 403 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; |
405 | 404 |
406 private: | 405 private: |
407 EllipticalRRectEffect(GrPrimitiveEdgeType, const SkRRect&); | 406 EllipticalRRectEffect(GrPrimitiveEdgeType, const SkRRect&); |
408 | 407 |
409 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; | 408 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; |
410 | 409 |
| 410 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; |
| 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 GrFragmentProcessor* |
420 EllipticalRRectEffect::Create(GrPrimitiveEdgeType edgeType, const SkRRect& rrect
) { | 421 EllipticalRRectEffect::Create(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 NULL; | 423 return NULL; |
423 } | 424 } |
424 return SkNEW_ARGS(EllipticalRRectEffect, (edgeType, rrect)); | 425 return SkNEW_ARGS(EllipticalRRectEffect, (edgeType, rrect)); |
425 } | 426 } |
426 | 427 |
427 void EllipticalRRectEffect::getConstantColorComponents(GrColor* color, uint32_t*
validFlags) const { | 428 void EllipticalRRectEffect::onComputeInvariantOutput(InvariantOutput* inout) con
st { |
428 *validFlags = 0; | 429 inout->fValidFlags = 0; |
| 430 inout->fIsSingleComponent = false; |
429 } | 431 } |
430 | 432 |
431 const GrBackendFragmentProcessorFactory& EllipticalRRectEffect::getFactory() con
st { | 433 const GrBackendFragmentProcessorFactory& EllipticalRRectEffect::getFactory() con
st { |
432 return GrTBackendFragmentProcessorFactory<EllipticalRRectEffect>::getInstanc
e(); | 434 return GrTBackendFragmentProcessorFactory<EllipticalRRectEffect>::getInstanc
e(); |
433 } | 435 } |
434 | 436 |
435 EllipticalRRectEffect::EllipticalRRectEffect(GrPrimitiveEdgeType edgeType, const
SkRRect& rrect) | 437 EllipticalRRectEffect::EllipticalRRectEffect(GrPrimitiveEdgeType edgeType, const
SkRRect& rrect) |
436 : fRRect(rrect) | 438 : fRRect(rrect) |
437 , fEdgeType(edgeType){ | 439 , fEdgeType(edgeType){ |
438 this->setWillReadFragmentPosition(); | 440 this->setWillReadFragmentPosition(); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 if (rrect.isNinePatch()) { | 730 if (rrect.isNinePatch()) { |
729 return EllipticalRRectEffect::Create(edgeType, rrect); | 731 return EllipticalRRectEffect::Create(edgeType, rrect); |
730 } | 732 } |
731 return NULL; | 733 return NULL; |
732 } | 734 } |
733 } | 735 } |
734 } | 736 } |
735 | 737 |
736 return NULL; | 738 return NULL; |
737 } | 739 } |
OLD | NEW |