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 30 matching lines...) Expand all Loading... |
41 kNone_CornerFlags = 0 | 41 kNone_CornerFlags = 0 |
42 }; | 42 }; |
43 | 43 |
44 // The flags are used to indicate which corners are circluar (unflagged corn
ers are assumed to | 44 // The flags are used to indicate which corners are circluar (unflagged corn
ers are assumed to |
45 // be square). | 45 // be square). |
46 static GrFragmentProcessor* Create(GrPrimitiveEdgeType, uint32_t circularCor
nerFlags, | 46 static GrFragmentProcessor* Create(GrPrimitiveEdgeType, uint32_t circularCor
nerFlags, |
47 const SkRRect&); | 47 const SkRRect&); |
48 | 48 |
49 virtual ~CircularRRectEffect() {}; | 49 virtual ~CircularRRectEffect() {}; |
50 | 50 |
51 const char* name() const SK_OVERRIDE { return "CircularRRect"; } | 51 const char* name() const override { return "CircularRRect"; } |
52 | 52 |
53 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const SK_OVE
RRIDE; | 53 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const overri
de; |
54 | 54 |
55 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; | 55 GrGLFragmentProcessor* createGLInstance() const override; |
56 | 56 |
57 const SkRRect& getRRect() const { return fRRect; } | 57 const SkRRect& getRRect() const { return fRRect; } |
58 | 58 |
59 uint32_t getCircularCornerFlags() const { return fCircularCornerFlags; } | 59 uint32_t getCircularCornerFlags() const { return fCircularCornerFlags; } |
60 | 60 |
61 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } | 61 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } |
62 | 62 |
63 private: | 63 private: |
64 CircularRRectEffect(GrPrimitiveEdgeType, uint32_t circularCornerFlags, const
SkRRect&); | 64 CircularRRectEffect(GrPrimitiveEdgeType, uint32_t circularCornerFlags, const
SkRRect&); |
65 | 65 |
66 bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE; | 66 bool onIsEqual(const GrFragmentProcessor& other) const override; |
67 | 67 |
68 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE; | 68 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
69 | 69 |
70 SkRRect fRRect; | 70 SkRRect fRRect; |
71 GrPrimitiveEdgeType fEdgeType; | 71 GrPrimitiveEdgeType fEdgeType; |
72 uint32_t fCircularCornerFlags; | 72 uint32_t fCircularCornerFlags; |
73 | 73 |
74 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 74 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
75 | 75 |
76 typedef GrFragmentProcessor INHERITED; | 76 typedef GrFragmentProcessor INHERITED; |
77 }; | 77 }; |
78 | 78 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 class GLCircularRRectEffect : public GrGLFragmentProcessor { | 131 class GLCircularRRectEffect : public GrGLFragmentProcessor { |
132 public: | 132 public: |
133 GLCircularRRectEffect(const GrProcessor&); | 133 GLCircularRRectEffect(const GrProcessor&); |
134 | 134 |
135 virtual void emitCode(GrGLFPBuilder* builder, | 135 virtual void emitCode(GrGLFPBuilder* builder, |
136 const GrFragmentProcessor& fp, | 136 const GrFragmentProcessor& fp, |
137 const char* outputColor, | 137 const char* outputColor, |
138 const char* inputColor, | 138 const char* inputColor, |
139 const TransformedCoordsArray&, | 139 const TransformedCoordsArray&, |
140 const TextureSamplerArray&) SK_OVERRIDE; | 140 const TextureSamplerArray&) override; |
141 | 141 |
142 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder*); | 142 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder*); |
143 | 143 |
144 void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE; | 144 void setData(const GrGLProgramDataManager&, const GrProcessor&) override; |
145 | 145 |
146 private: | 146 private: |
147 GrGLProgramDataManager::UniformHandle fInnerRectUniform; | 147 GrGLProgramDataManager::UniformHandle fInnerRectUniform; |
148 GrGLProgramDataManager::UniformHandle fRadiusPlusHalfUniform; | 148 GrGLProgramDataManager::UniformHandle fRadiusPlusHalfUniform; |
149 SkRRect fPrevRRect; | 149 SkRRect fPrevRRect; |
150 typedef GrGLFragmentProcessor INHERITED; | 150 typedef GrGLFragmentProcessor INHERITED; |
151 }; | 151 }; |
152 | 152 |
153 GLCircularRRectEffect::GLCircularRRectEffect(const GrProcessor& ) { | 153 GLCircularRRectEffect::GLCircularRRectEffect(const GrProcessor& ) { |
154 fPrevRRect.setEmpty(); | 154 fPrevRRect.setEmpty(); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 } | 385 } |
386 | 386 |
387 ////////////////////////////////////////////////////////////////////////////// | 387 ////////////////////////////////////////////////////////////////////////////// |
388 | 388 |
389 class EllipticalRRectEffect : public GrFragmentProcessor { | 389 class EllipticalRRectEffect : public GrFragmentProcessor { |
390 public: | 390 public: |
391 static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkRRect&); | 391 static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkRRect&); |
392 | 392 |
393 virtual ~EllipticalRRectEffect() {}; | 393 virtual ~EllipticalRRectEffect() {}; |
394 | 394 |
395 const char* name() const SK_OVERRIDE { return "EllipticalRRect"; } | 395 const char* name() const override { return "EllipticalRRect"; } |
396 | 396 |
397 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const SK_OVE
RRIDE; | 397 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const overri
de; |
398 | 398 |
399 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; | 399 GrGLFragmentProcessor* createGLInstance() const override; |
400 | 400 |
401 const SkRRect& getRRect() const { return fRRect; } | 401 const SkRRect& getRRect() const { return fRRect; } |
402 | 402 |
403 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } | 403 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } |
404 | 404 |
405 private: | 405 private: |
406 EllipticalRRectEffect(GrPrimitiveEdgeType, const SkRRect&); | 406 EllipticalRRectEffect(GrPrimitiveEdgeType, const SkRRect&); |
407 | 407 |
408 bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE; | 408 bool onIsEqual(const GrFragmentProcessor& other) const override; |
409 | 409 |
410 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE; | 410 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
411 | 411 |
412 SkRRect fRRect; | 412 SkRRect fRRect; |
413 GrPrimitiveEdgeType fEdgeType; | 413 GrPrimitiveEdgeType fEdgeType; |
414 | 414 |
415 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 415 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
416 | 416 |
417 typedef GrFragmentProcessor INHERITED; | 417 typedef GrFragmentProcessor INHERITED; |
418 }; | 418 }; |
419 | 419 |
420 GrFragmentProcessor* | 420 GrFragmentProcessor* |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 487 |
488 class GLEllipticalRRectEffect : public GrGLFragmentProcessor { | 488 class GLEllipticalRRectEffect : public GrGLFragmentProcessor { |
489 public: | 489 public: |
490 GLEllipticalRRectEffect(const GrProcessor&); | 490 GLEllipticalRRectEffect(const GrProcessor&); |
491 | 491 |
492 virtual void emitCode(GrGLFPBuilder* builder, | 492 virtual void emitCode(GrGLFPBuilder* builder, |
493 const GrFragmentProcessor& effect, | 493 const GrFragmentProcessor& effect, |
494 const char* outputColor, | 494 const char* outputColor, |
495 const char* inputColor, | 495 const char* inputColor, |
496 const TransformedCoordsArray&, | 496 const TransformedCoordsArray&, |
497 const TextureSamplerArray&) SK_OVERRIDE; | 497 const TextureSamplerArray&) override; |
498 | 498 |
499 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder*); | 499 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder*); |
500 | 500 |
501 void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE; | 501 void setData(const GrGLProgramDataManager&, const GrProcessor&) override; |
502 | 502 |
503 private: | 503 private: |
504 GrGLProgramDataManager::UniformHandle fInnerRectUniform; | 504 GrGLProgramDataManager::UniformHandle fInnerRectUniform; |
505 GrGLProgramDataManager::UniformHandle fInvRadiiSqdUniform; | 505 GrGLProgramDataManager::UniformHandle fInvRadiiSqdUniform; |
506 SkRRect fPrevRRect; | 506 SkRRect fPrevRRect; |
507 typedef GrGLFragmentProcessor INHERITED; | 507 typedef GrGLFragmentProcessor INHERITED; |
508 }; | 508 }; |
509 | 509 |
510 GLEllipticalRRectEffect::GLEllipticalRRectEffect(const GrProcessor& effect) { | 510 GLEllipticalRRectEffect::GLEllipticalRRectEffect(const GrProcessor& effect) { |
511 fPrevRRect.setEmpty(); | 511 fPrevRRect.setEmpty(); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 if (rrect.isNinePatch()) { | 733 if (rrect.isNinePatch()) { |
734 return EllipticalRRectEffect::Create(edgeType, rrect); | 734 return EllipticalRRectEffect::Create(edgeType, rrect); |
735 } | 735 } |
736 return NULL; | 736 return NULL; |
737 } | 737 } |
738 } | 738 } |
739 } | 739 } |
740 | 740 |
741 return NULL; | 741 return NULL; |
742 } | 742 } |
OLD | NEW |