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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 SkColor colors[kMaxRandomGradientColors]; | 196 SkColor colors[kMaxRandomGradientColors]; |
197 SkScalar stopsArray[kMaxRandomGradientColors]; | 197 SkScalar stopsArray[kMaxRandomGradientColors]; |
198 SkScalar* stops = stopsArray; | 198 SkScalar* stops = stopsArray; |
199 SkShader::TileMode tm; | 199 SkShader::TileMode tm; |
200 int colorCount = RandomGradientParams(random, colors, &stops, &tm); | 200 int colorCount = RandomGradientParams(random, colors, &stops, &tm); |
201 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, | 201 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, |
202 center
2, radius2, | 202 center
2, radius2, |
203 colors
, stops, colorCount, | 203 colors
, stops, colorCount, |
204 tm)); | 204 tm)); |
205 SkPaint paint; | 205 SkPaint paint; |
206 return shader->asNewEffect(context, paint, NULL); | 206 GrEffectRef* effect; |
| 207 GrColor grColor; |
| 208 shader->asNewEffect(context, paint, NULL, &grColor, &effect); |
| 209 return effect; |
207 } | 210 } |
208 | 211 |
209 GLEdge2PtConicalEffect::GLEdge2PtConicalEffect(const GrBackendEffectFactory& fac
tory, | 212 GLEdge2PtConicalEffect::GLEdge2PtConicalEffect(const GrBackendEffectFactory& fac
tory, |
210 const GrDrawEffect& drawEffect) | 213 const GrDrawEffect& drawEffect) |
211 : INHERITED(factory) | 214 : INHERITED(factory) |
212 , fVSVaryingName(NULL) | 215 , fVSVaryingName(NULL) |
213 , fFSVaryingName(NULL) | 216 , fFSVaryingName(NULL) |
214 , fCachedRadius(-SK_ScalarMax) | 217 , fCachedRadius(-SK_ScalarMax) |
215 , fCachedDiffRadius(-SK_ScalarMax) {} | 218 , fCachedDiffRadius(-SK_ScalarMax) {} |
216 | 219 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 SkColor colors[kMaxRandomGradientColors]; | 470 SkColor colors[kMaxRandomGradientColors]; |
468 SkScalar stopsArray[kMaxRandomGradientColors]; | 471 SkScalar stopsArray[kMaxRandomGradientColors]; |
469 SkScalar* stops = stopsArray; | 472 SkScalar* stops = stopsArray; |
470 SkShader::TileMode tm; | 473 SkShader::TileMode tm; |
471 int colorCount = RandomGradientParams(random, colors, &stops, &tm); | 474 int colorCount = RandomGradientParams(random, colors, &stops, &tm); |
472 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, | 475 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, |
473 center
2, radius2, | 476 center
2, radius2, |
474 colors
, stops, colorCount, | 477 colors
, stops, colorCount, |
475 tm)); | 478 tm)); |
476 SkPaint paint; | 479 SkPaint paint; |
477 return shader->asNewEffect(context, paint, NULL); | 480 GrEffectRef* effect; |
| 481 GrColor grColor; |
| 482 shader->asNewEffect(context, paint, NULL, &grColor, &effect); |
| 483 return effect; |
478 } | 484 } |
479 | 485 |
480 GLFocalOutside2PtConicalEffect::GLFocalOutside2PtConicalEffect(const GrBackendEf
fectFactory& factory, | 486 GLFocalOutside2PtConicalEffect::GLFocalOutside2PtConicalEffect(const GrBackendEf
fectFactory& factory, |
481 const GrDrawEffec
t& drawEffect) | 487 const GrDrawEffec
t& drawEffect) |
482 : INHERITED(factory) | 488 : INHERITED(factory) |
483 , fVSVaryingName(NULL) | 489 , fVSVaryingName(NULL) |
484 , fFSVaryingName(NULL) | 490 , fFSVaryingName(NULL) |
485 , fCachedFocal(SK_ScalarMax) { | 491 , fCachedFocal(SK_ScalarMax) { |
486 const FocalOutside2PtConicalEffect& data = drawEffect.castEffect<FocalOutsid
e2PtConicalEffect>(); | 492 const FocalOutside2PtConicalEffect& data = drawEffect.castEffect<FocalOutsid
e2PtConicalEffect>(); |
487 fIsFlipped = data.isFlipped(); | 493 fIsFlipped = data.isFlipped(); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 SkColor colors[kMaxRandomGradientColors]; | 682 SkColor colors[kMaxRandomGradientColors]; |
677 SkScalar stopsArray[kMaxRandomGradientColors]; | 683 SkScalar stopsArray[kMaxRandomGradientColors]; |
678 SkScalar* stops = stopsArray; | 684 SkScalar* stops = stopsArray; |
679 SkShader::TileMode tm; | 685 SkShader::TileMode tm; |
680 int colorCount = RandomGradientParams(random, colors, &stops, &tm); | 686 int colorCount = RandomGradientParams(random, colors, &stops, &tm); |
681 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, | 687 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, |
682 center
2, radius2, | 688 center
2, radius2, |
683 colors
, stops, colorCount, | 689 colors
, stops, colorCount, |
684 tm)); | 690 tm)); |
685 SkPaint paint; | 691 SkPaint paint; |
686 return shader->asNewEffect(context, paint, NULL); | 692 GrColor grColor; |
| 693 GrEffectRef* grEffect; |
| 694 shader->asNewEffect(context, paint, NULL, &grColor, &grEffect); |
| 695 return grEffect; |
687 } | 696 } |
688 | 697 |
689 GLFocalInside2PtConicalEffect::GLFocalInside2PtConicalEffect(const GrBackendEffe
ctFactory& factory, | 698 GLFocalInside2PtConicalEffect::GLFocalInside2PtConicalEffect(const GrBackendEffe
ctFactory& factory, |
690 const GrDrawEffect&
drawEffect) | 699 const GrDrawEffect&
drawEffect) |
691 : INHERITED(factory) | 700 : INHERITED(factory) |
692 , fVSVaryingName(NULL) | 701 , fVSVaryingName(NULL) |
693 , fFSVaryingName(NULL) | 702 , fFSVaryingName(NULL) |
694 , fCachedFocal(SK_ScalarMax) {} | 703 , fCachedFocal(SK_ScalarMax) {} |
695 | 704 |
696 void GLFocalInside2PtConicalEffect::emitCode(GrGLShaderBuilder* builder, | 705 void GLFocalInside2PtConicalEffect::emitCode(GrGLShaderBuilder* builder, |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 SkColor colors[kMaxRandomGradientColors]; | 927 SkColor colors[kMaxRandomGradientColors]; |
919 SkScalar stopsArray[kMaxRandomGradientColors]; | 928 SkScalar stopsArray[kMaxRandomGradientColors]; |
920 SkScalar* stops = stopsArray; | 929 SkScalar* stops = stopsArray; |
921 SkShader::TileMode tm; | 930 SkShader::TileMode tm; |
922 int colorCount = RandomGradientParams(random, colors, &stops, &tm); | 931 int colorCount = RandomGradientParams(random, colors, &stops, &tm); |
923 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, | 932 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, |
924 center
2, radius2, | 933 center
2, radius2, |
925 colors
, stops, colorCount, | 934 colors
, stops, colorCount, |
926 tm)); | 935 tm)); |
927 SkPaint paint; | 936 SkPaint paint; |
928 return shader->asNewEffect(context, paint, NULL); | 937 GrColor grColor; |
| 938 GrEffectRef* grEffect; |
| 939 shader->asNewEffect(context, paint, NULL, &grColor, &grEffect); |
| 940 return grEffect; |
929 } | 941 } |
930 | 942 |
931 GLCircleInside2PtConicalEffect::GLCircleInside2PtConicalEffect(const GrBackendEf
fectFactory& factory, | 943 GLCircleInside2PtConicalEffect::GLCircleInside2PtConicalEffect(const GrBackendEf
fectFactory& factory, |
932 const GrDrawEffec
t& drawEffect) | 944 const GrDrawEffec
t& drawEffect) |
933 : INHERITED(factory) | 945 : INHERITED(factory) |
934 , fVSVaryingName(NULL) | 946 , fVSVaryingName(NULL) |
935 , fFSVaryingName(NULL) | 947 , fFSVaryingName(NULL) |
936 , fCachedCenterX(SK_ScalarMax) | 948 , fCachedCenterX(SK_ScalarMax) |
937 , fCachedCenterY(SK_ScalarMax) | 949 , fCachedCenterY(SK_ScalarMax) |
938 , fCachedA(SK_ScalarMax) | 950 , fCachedA(SK_ScalarMax) |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 SkColor colors[kMaxRandomGradientColors]; | 1158 SkColor colors[kMaxRandomGradientColors]; |
1147 SkScalar stopsArray[kMaxRandomGradientColors]; | 1159 SkScalar stopsArray[kMaxRandomGradientColors]; |
1148 SkScalar* stops = stopsArray; | 1160 SkScalar* stops = stopsArray; |
1149 SkShader::TileMode tm; | 1161 SkShader::TileMode tm; |
1150 int colorCount = RandomGradientParams(random, colors, &stops, &tm); | 1162 int colorCount = RandomGradientParams(random, colors, &stops, &tm); |
1151 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, | 1163 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, |
1152 center
2, radius2, | 1164 center
2, radius2, |
1153 colors
, stops, colorCount, | 1165 colors
, stops, colorCount, |
1154 tm)); | 1166 tm)); |
1155 SkPaint paint; | 1167 SkPaint paint; |
1156 return shader->asNewEffect(context, paint, NULL); | 1168 GrColor grColor; |
| 1169 GrEffectRef* grEffect; |
| 1170 shader->asNewEffect(context, paint, NULL, &grColor, &grEffect); |
| 1171 return grEffect; |
1157 } | 1172 } |
1158 | 1173 |
1159 GLCircleOutside2PtConicalEffect::GLCircleOutside2PtConicalEffect(const GrBackend
EffectFactory& factory, | 1174 GLCircleOutside2PtConicalEffect::GLCircleOutside2PtConicalEffect(const GrBackend
EffectFactory& factory, |
1160 const GrDrawEff
ect& drawEffect) | 1175 const GrDrawEff
ect& drawEffect) |
1161 : INHERITED(factory) | 1176 : INHERITED(factory) |
1162 , fVSVaryingName(NULL) | 1177 , fVSVaryingName(NULL) |
1163 , fFSVaryingName(NULL) | 1178 , fFSVaryingName(NULL) |
1164 , fCachedCenterX(SK_ScalarMax) | 1179 , fCachedCenterX(SK_ScalarMax) |
1165 , fCachedCenterY(SK_ScalarMax) | 1180 , fCachedCenterY(SK_ScalarMax) |
1166 , fCachedA(SK_ScalarMax) | 1181 , fCachedA(SK_ScalarMax) |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, inf
o); | 1321 return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, inf
o); |
1307 } else if (type == kEdge_ConicalType) { | 1322 } else if (type == kEdge_ConicalType) { |
1308 set_matrix_edge_conical(shader, &matrix); | 1323 set_matrix_edge_conical(shader, &matrix); |
1309 return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm); | 1324 return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm); |
1310 } else { | 1325 } else { |
1311 return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, in
fo); | 1326 return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, in
fo); |
1312 } | 1327 } |
1313 } | 1328 } |
1314 | 1329 |
1315 #endif | 1330 #endif |
OLD | NEW |