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