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 onGetConstantColorComponents(GrColor* color, uint32_t* validFla
gs, |
| 70 bool* isSingleComponent) const SK_
OVERRIDE; |
| 71 |
71 SkRRect fRRect; | 72 SkRRect fRRect; |
72 GrPrimitiveEdgeType fEdgeType; | 73 GrPrimitiveEdgeType fEdgeType; |
73 uint32_t fCircularCornerFlags; | 74 uint32_t fCircularCornerFlags; |
74 | 75 |
75 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 76 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
76 | 77 |
77 typedef GrFragmentProcessor INHERITED; | 78 typedef GrFragmentProcessor INHERITED; |
78 }; | 79 }; |
79 | 80 |
80 GrFragmentProcessor* CircularRRectEffect::Create(GrPrimitiveEdgeType edgeType, | 81 GrFragmentProcessor* CircularRRectEffect::Create(GrPrimitiveEdgeType edgeType, |
81 uint32_t circularCornerFlags, | 82 uint32_t circularCornerFlags, |
82 const SkRRect& rrect) { | 83 const SkRRect& rrect) { |
83 if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdg
eType != edgeType) { | 84 if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdg
eType != edgeType) { |
84 return NULL; | 85 return NULL; |
85 } | 86 } |
86 return SkNEW_ARGS(CircularRRectEffect, (edgeType, circularCornerFlags, rrect
)); | 87 return SkNEW_ARGS(CircularRRectEffect, (edgeType, circularCornerFlags, rrect
)); |
87 } | 88 } |
88 | 89 |
89 void CircularRRectEffect::getConstantColorComponents(GrColor* color, uint32_t* v
alidFlags) const { | 90 void CircularRRectEffect::onGetConstantColorComponents(GrColor* color, uint32_t*
validFlags, |
| 91 bool* isSingleComponent)
const { |
90 *validFlags = 0; | 92 *validFlags = 0; |
91 } | 93 } |
92 | 94 |
93 const GrBackendFragmentProcessorFactory& CircularRRectEffect::getFactory() const
{ | 95 const GrBackendFragmentProcessorFactory& CircularRRectEffect::getFactory() const
{ |
94 return GrTBackendFragmentProcessorFactory<CircularRRectEffect>::getInstance(
); | 96 return GrTBackendFragmentProcessorFactory<CircularRRectEffect>::getInstance(
); |
95 } | 97 } |
96 | 98 |
97 CircularRRectEffect::CircularRRectEffect(GrPrimitiveEdgeType edgeType, uint32_t
circularCornerFlags, | 99 CircularRRectEffect::CircularRRectEffect(GrPrimitiveEdgeType edgeType, uint32_t
circularCornerFlags, |
98 const SkRRect& rrect) | 100 const SkRRect& rrect) |
99 : fRRect(rrect) | 101 : fRRect(rrect) |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 virtual ~EllipticalRRectEffect() {}; | 394 virtual ~EllipticalRRectEffect() {}; |
393 static const char* Name() { return "EllipticalRRect"; } | 395 static const char* Name() { return "EllipticalRRect"; } |
394 | 396 |
395 const SkRRect& getRRect() const { return fRRect; } | 397 const SkRRect& getRRect() const { return fRRect; } |
396 | 398 |
397 | 399 |
398 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } | 400 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } |
399 | 401 |
400 typedef GLEllipticalRRectEffect GLProcessor; | 402 typedef GLEllipticalRRectEffect GLProcessor; |
401 | 403 |
402 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; | |
403 | |
404 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; | 404 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; |
405 | 405 |
406 private: | 406 private: |
407 EllipticalRRectEffect(GrPrimitiveEdgeType, const SkRRect&); | 407 EllipticalRRectEffect(GrPrimitiveEdgeType, const SkRRect&); |
408 | 408 |
409 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; | 409 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; |
410 | 410 |
| 411 virtual void onGetConstantColorComponents(GrColor* color, uint32_t* validFla
gs, |
| 412 bool* isSingleComponent) const SK_
OVERRIDE; |
| 413 |
411 SkRRect fRRect; | 414 SkRRect fRRect; |
412 GrPrimitiveEdgeType fEdgeType; | 415 GrPrimitiveEdgeType fEdgeType; |
413 | 416 |
414 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 417 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
415 | 418 |
416 typedef GrFragmentProcessor INHERITED; | 419 typedef GrFragmentProcessor INHERITED; |
417 }; | 420 }; |
418 | 421 |
419 GrFragmentProcessor* | 422 GrFragmentProcessor* |
420 EllipticalRRectEffect::Create(GrPrimitiveEdgeType edgeType, const SkRRect& rrect
) { | 423 EllipticalRRectEffect::Create(GrPrimitiveEdgeType edgeType, const SkRRect& rrect
) { |
421 if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdg
eType != edgeType) { | 424 if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdg
eType != edgeType) { |
422 return NULL; | 425 return NULL; |
423 } | 426 } |
424 return SkNEW_ARGS(EllipticalRRectEffect, (edgeType, rrect)); | 427 return SkNEW_ARGS(EllipticalRRectEffect, (edgeType, rrect)); |
425 } | 428 } |
426 | 429 |
427 void EllipticalRRectEffect::getConstantColorComponents(GrColor* color, uint32_t*
validFlags) const { | 430 void EllipticalRRectEffect::onGetConstantColorComponents(GrColor* color, uint32_
t* validFlags, |
| 431 bool* isSingleComponent
) const { |
428 *validFlags = 0; | 432 *validFlags = 0; |
429 } | 433 } |
430 | 434 |
431 const GrBackendFragmentProcessorFactory& EllipticalRRectEffect::getFactory() con
st { | 435 const GrBackendFragmentProcessorFactory& EllipticalRRectEffect::getFactory() con
st { |
432 return GrTBackendFragmentProcessorFactory<EllipticalRRectEffect>::getInstanc
e(); | 436 return GrTBackendFragmentProcessorFactory<EllipticalRRectEffect>::getInstanc
e(); |
433 } | 437 } |
434 | 438 |
435 EllipticalRRectEffect::EllipticalRRectEffect(GrPrimitiveEdgeType edgeType, const
SkRRect& rrect) | 439 EllipticalRRectEffect::EllipticalRRectEffect(GrPrimitiveEdgeType edgeType, const
SkRRect& rrect) |
436 : fRRect(rrect) | 440 : fRRect(rrect) |
437 , fEdgeType(edgeType){ | 441 , fEdgeType(edgeType){ |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 if (rrect.isNinePatch()) { | 732 if (rrect.isNinePatch()) { |
729 return EllipticalRRectEffect::Create(edgeType, rrect); | 733 return EllipticalRRectEffect::Create(edgeType, rrect); |
730 } | 734 } |
731 return NULL; | 735 return NULL; |
732 } | 736 } |
733 } | 737 } |
734 } | 738 } |
735 | 739 |
736 return NULL; | 740 return NULL; |
737 } | 741 } |
OLD | NEW |