OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkTwoPointConicalGradient_gpu.h" | 9 #include "SkTwoPointConicalGradient_gpu.h" |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 class GLEdge2PtConicalEffect; | 57 class GLEdge2PtConicalEffect; |
58 | 58 |
59 class Edge2PtConicalEffect : public GrGradientEffect { | 59 class Edge2PtConicalEffect : public GrGradientEffect { |
60 public: | 60 public: |
61 | 61 |
62 static GrEffectRef* Create(GrContext* ctx, | 62 static GrEffectRef* Create(GrContext* ctx, |
63 const SkTwoPointConicalGradient& shader, | 63 const SkTwoPointConicalGradient& shader, |
64 const SkMatrix& matrix, | 64 const SkMatrix& matrix, |
65 SkShader::TileMode tm) { | 65 SkShader::TileMode tm) { |
66 AutoEffectUnref effect(SkNEW_ARGS(Edge2PtConicalEffect, (ctx, shader, ma
trix, tm))); | 66 return SkNEW_ARGS(Edge2PtConicalEffect, (ctx, shader, matrix, tm)); |
67 return CreateEffectRef(effect); | |
68 } | 67 } |
69 | 68 |
70 virtual ~Edge2PtConicalEffect() {} | 69 virtual ~Edge2PtConicalEffect() {} |
71 | 70 |
72 static const char* Name() { return "Two-Point Conical Gradient Edge Touching
"; } | 71 static const char* Name() { return "Two-Point Conical Gradient Edge Touching
"; } |
73 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; | 72 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; |
74 | 73 |
75 // The radial gradient parameters can collapse to a linear (instead of quadr
atic) equation. | 74 // The radial gradient parameters can collapse to a linear (instead of quadr
atic) equation. |
76 SkScalar center() const { return fCenterX1; } | 75 SkScalar center() const { return fCenterX1; } |
77 SkScalar diffRadius() const { return fDiffRadius; } | 76 SkScalar diffRadius() const { return fDiffRadius; } |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 class GLFocalOutside2PtConicalEffect; | 363 class GLFocalOutside2PtConicalEffect; |
365 | 364 |
366 class FocalOutside2PtConicalEffect : public GrGradientEffect { | 365 class FocalOutside2PtConicalEffect : public GrGradientEffect { |
367 public: | 366 public: |
368 | 367 |
369 static GrEffectRef* Create(GrContext* ctx, | 368 static GrEffectRef* Create(GrContext* ctx, |
370 const SkTwoPointConicalGradient& shader, | 369 const SkTwoPointConicalGradient& shader, |
371 const SkMatrix& matrix, | 370 const SkMatrix& matrix, |
372 SkShader::TileMode tm, | 371 SkShader::TileMode tm, |
373 SkScalar focalX) { | 372 SkScalar focalX) { |
374 AutoEffectUnref effect(SkNEW_ARGS(FocalOutside2PtConicalEffect, (ctx, sh
ader, matrix, tm, focalX))); | 373 return SkNEW_ARGS(FocalOutside2PtConicalEffect, (ctx, shader, matrix, tm
, focalX)); |
375 return CreateEffectRef(effect); | |
376 } | 374 } |
377 | 375 |
378 virtual ~FocalOutside2PtConicalEffect() { } | 376 virtual ~FocalOutside2PtConicalEffect() { } |
379 | 377 |
380 static const char* Name() { return "Two-Point Conical Gradient Focal Outside
"; } | 378 static const char* Name() { return "Two-Point Conical Gradient Focal Outside
"; } |
381 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; | 379 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; |
382 | 380 |
383 bool isFlipped() const { return fIsFlipped; } | 381 bool isFlipped() const { return fIsFlipped; } |
384 SkScalar focal() const { return fFocalX; } | 382 SkScalar focal() const { return fFocalX; } |
385 | 383 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 class GLFocalInside2PtConicalEffect; | 577 class GLFocalInside2PtConicalEffect; |
580 | 578 |
581 class FocalInside2PtConicalEffect : public GrGradientEffect { | 579 class FocalInside2PtConicalEffect : public GrGradientEffect { |
582 public: | 580 public: |
583 | 581 |
584 static GrEffectRef* Create(GrContext* ctx, | 582 static GrEffectRef* Create(GrContext* ctx, |
585 const SkTwoPointConicalGradient& shader, | 583 const SkTwoPointConicalGradient& shader, |
586 const SkMatrix& matrix, | 584 const SkMatrix& matrix, |
587 SkShader::TileMode tm, | 585 SkShader::TileMode tm, |
588 SkScalar focalX) { | 586 SkScalar focalX) { |
589 AutoEffectUnref effect(SkNEW_ARGS(FocalInside2PtConicalEffect, (ctx, sha
der, matrix, tm, focalX))); | 587 return SkNEW_ARGS(FocalInside2PtConicalEffect, (ctx, shader, matrix, tm,
focalX)); |
590 return CreateEffectRef(effect); | |
591 } | 588 } |
592 | 589 |
593 virtual ~FocalInside2PtConicalEffect() {} | 590 virtual ~FocalInside2PtConicalEffect() {} |
594 | 591 |
595 static const char* Name() { return "Two-Point Conical Gradient Focal Inside"
; } | 592 static const char* Name() { return "Two-Point Conical Gradient Focal Inside"
; } |
596 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; | 593 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; |
597 | 594 |
598 SkScalar focal() const { return fFocalX; } | 595 SkScalar focal() const { return fFocalX; } |
599 | 596 |
600 typedef GLFocalInside2PtConicalEffect GLEffect; | 597 typedef GLFocalInside2PtConicalEffect GLEffect; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 class GLCircleInside2PtConicalEffect; | 810 class GLCircleInside2PtConicalEffect; |
814 | 811 |
815 class CircleInside2PtConicalEffect : public GrGradientEffect { | 812 class CircleInside2PtConicalEffect : public GrGradientEffect { |
816 public: | 813 public: |
817 | 814 |
818 static GrEffectRef* Create(GrContext* ctx, | 815 static GrEffectRef* Create(GrContext* ctx, |
819 const SkTwoPointConicalGradient& shader, | 816 const SkTwoPointConicalGradient& shader, |
820 const SkMatrix& matrix, | 817 const SkMatrix& matrix, |
821 SkShader::TileMode tm, | 818 SkShader::TileMode tm, |
822 const CircleConicalInfo& info) { | 819 const CircleConicalInfo& info) { |
823 AutoEffectUnref effect(SkNEW_ARGS(CircleInside2PtConicalEffect, (ctx, sh
ader, matrix, tm, info))); | 820 return SkNEW_ARGS(CircleInside2PtConicalEffect, (ctx, shader, matrix, tm
, info)); |
824 return CreateEffectRef(effect); | |
825 } | 821 } |
826 | 822 |
827 virtual ~CircleInside2PtConicalEffect() {} | 823 virtual ~CircleInside2PtConicalEffect() {} |
828 | 824 |
829 static const char* Name() { return "Two-Point Conical Gradient Inside"; } | 825 static const char* Name() { return "Two-Point Conical Gradient Inside"; } |
830 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; | 826 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; |
831 | 827 |
832 SkScalar centerX() const { return fInfo.fCenterEnd.fX; } | 828 SkScalar centerX() const { return fInfo.fCenterEnd.fX; } |
833 SkScalar centerY() const { return fInfo.fCenterEnd.fY; } | 829 SkScalar centerY() const { return fInfo.fCenterEnd.fY; } |
834 SkScalar A() const { return fInfo.fA; } | 830 SkScalar A() const { return fInfo.fA; } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 class GLCircleOutside2PtConicalEffect; | 1022 class GLCircleOutside2PtConicalEffect; |
1027 | 1023 |
1028 class CircleOutside2PtConicalEffect : public GrGradientEffect { | 1024 class CircleOutside2PtConicalEffect : public GrGradientEffect { |
1029 public: | 1025 public: |
1030 | 1026 |
1031 static GrEffectRef* Create(GrContext* ctx, | 1027 static GrEffectRef* Create(GrContext* ctx, |
1032 const SkTwoPointConicalGradient& shader, | 1028 const SkTwoPointConicalGradient& shader, |
1033 const SkMatrix& matrix, | 1029 const SkMatrix& matrix, |
1034 SkShader::TileMode tm, | 1030 SkShader::TileMode tm, |
1035 const CircleConicalInfo& info) { | 1031 const CircleConicalInfo& info) { |
1036 AutoEffectUnref effect(SkNEW_ARGS(CircleOutside2PtConicalEffect, (ctx, s
hader, matrix, tm, info))); | 1032 return SkNEW_ARGS(CircleOutside2PtConicalEffect, (ctx, shader, matrix, t
m, info)); |
1037 return CreateEffectRef(effect); | |
1038 } | 1033 } |
1039 | 1034 |
1040 virtual ~CircleOutside2PtConicalEffect() {} | 1035 virtual ~CircleOutside2PtConicalEffect() {} |
1041 | 1036 |
1042 static const char* Name() { return "Two-Point Conical Gradient Outside"; } | 1037 static const char* Name() { return "Two-Point Conical Gradient Outside"; } |
1043 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; | 1038 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; |
1044 | 1039 |
1045 SkScalar centerX() const { return fInfo.fCenterEnd.fX; } | 1040 SkScalar centerX() const { return fInfo.fCenterEnd.fX; } |
1046 SkScalar centerY() const { return fInfo.fCenterEnd.fY; } | 1041 SkScalar centerY() const { return fInfo.fCenterEnd.fY; } |
1047 SkScalar A() const { return fInfo.fA; } | 1042 SkScalar A() const { return fInfo.fA; } |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, inf
o); | 1316 return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, inf
o); |
1322 } else if (type == kEdge_ConicalType) { | 1317 } else if (type == kEdge_ConicalType) { |
1323 set_matrix_edge_conical(shader, &matrix); | 1318 set_matrix_edge_conical(shader, &matrix); |
1324 return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm); | 1319 return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm); |
1325 } else { | 1320 } else { |
1326 return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, in
fo); | 1321 return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, in
fo); |
1327 } | 1322 } |
1328 } | 1323 } |
1329 | 1324 |
1330 #endif | 1325 #endif |
OLD | NEW |