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 "SkTwoPointConicalGradient_gpu.h" | 8 #include "SkTwoPointConicalGradient_gpu.h" |
9 | 9 |
10 #include "SkTwoPointConicalGradient.h" | 10 #include "SkTwoPointConicalGradient.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 fragBuilder->codeAppendf("\tif (%s * %s + %s > 0.0) {\n", tName.c_str(), | 271 fragBuilder->codeAppendf("\tif (%s * %s + %s > 0.0) {\n", tName.c_str(), |
272 p2.c_str(), p0.c_str()); | 272 p2.c_str(), p0.c_str()); |
273 fragBuilder->codeAppend("\t"); | 273 fragBuilder->codeAppend("\t"); |
274 this->emitColor(fragBuilder, | 274 this->emitColor(fragBuilder, |
275 uniformHandler, | 275 uniformHandler, |
276 args.fGLSLCaps, | 276 args.fGLSLCaps, |
277 ge, | 277 ge, |
278 tName.c_str(), | 278 tName.c_str(), |
279 args.fOutputColor, | 279 args.fOutputColor, |
280 args.fInputColor, | 280 args.fInputColor, |
281 args.fSamplers); | 281 args.fTexSamplers); |
282 fragBuilder->codeAppend("\t}\n"); | 282 fragBuilder->codeAppend("\t}\n"); |
283 } | 283 } |
284 | 284 |
285 void GLEdge2PtConicalEffect::onSetData(const GrGLSLProgramDataManager& pdman, | 285 void GLEdge2PtConicalEffect::onSetData(const GrGLSLProgramDataManager& pdman, |
286 const GrProcessor& processor) { | 286 const GrProcessor& processor) { |
287 INHERITED::onSetData(pdman, processor); | 287 INHERITED::onSetData(pdman, processor); |
288 const Edge2PtConicalEffect& data = processor.cast<Edge2PtConicalEffect>(); | 288 const Edge2PtConicalEffect& data = processor.cast<Edge2PtConicalEffect>(); |
289 SkScalar radius0 = data.radius(); | 289 SkScalar radius0 = data.radius(); |
290 SkScalar diffRadius = data.diffRadius(); | 290 SkScalar diffRadius = data.diffRadius(); |
291 | 291 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 | 538 |
539 fragBuilder->codeAppendf("\tif (%s >= 0.0 && d >= 0.0) {\n", tName.c_str()); | 539 fragBuilder->codeAppendf("\tif (%s >= 0.0 && d >= 0.0) {\n", tName.c_str()); |
540 fragBuilder->codeAppend("\t\t"); | 540 fragBuilder->codeAppend("\t\t"); |
541 this->emitColor(fragBuilder, | 541 this->emitColor(fragBuilder, |
542 uniformHandler, | 542 uniformHandler, |
543 args.fGLSLCaps, | 543 args.fGLSLCaps, |
544 ge, | 544 ge, |
545 tName.c_str(), | 545 tName.c_str(), |
546 args.fOutputColor, | 546 args.fOutputColor, |
547 args.fInputColor, | 547 args.fInputColor, |
548 args.fSamplers); | 548 args.fTexSamplers); |
549 fragBuilder->codeAppend("\t}\n"); | 549 fragBuilder->codeAppend("\t}\n"); |
550 } | 550 } |
551 | 551 |
552 void GLFocalOutside2PtConicalEffect::onSetData(const GrGLSLProgramDataManager& p
dman, | 552 void GLFocalOutside2PtConicalEffect::onSetData(const GrGLSLProgramDataManager& p
dman, |
553 const GrProcessor& processor) { | 553 const GrProcessor& processor) { |
554 INHERITED::onSetData(pdman, processor); | 554 INHERITED::onSetData(pdman, processor); |
555 const FocalOutside2PtConicalEffect& data = processor.cast<FocalOutside2PtCon
icalEffect>(); | 555 const FocalOutside2PtConicalEffect& data = processor.cast<FocalOutside2PtCon
icalEffect>(); |
556 SkASSERT(data.isFlipped() == fIsFlipped); | 556 SkASSERT(data.isFlipped() == fIsFlipped); |
557 SkScalar focal = data.focal(); | 557 SkScalar focal = data.focal(); |
558 | 558 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 fragBuilder->codeAppendf("\tfloat %s = %s.x * %s + length(%s);\n", tName.c_
str(), | 722 fragBuilder->codeAppendf("\tfloat %s = %s.x * %s + length(%s);\n", tName.c_
str(), |
723 coords2D, focal.c_str(), coords2D); | 723 coords2D, focal.c_str(), coords2D); |
724 | 724 |
725 this->emitColor(fragBuilder, | 725 this->emitColor(fragBuilder, |
726 uniformHandler, | 726 uniformHandler, |
727 args.fGLSLCaps, | 727 args.fGLSLCaps, |
728 ge, | 728 ge, |
729 tName.c_str(), | 729 tName.c_str(), |
730 args.fOutputColor, | 730 args.fOutputColor, |
731 args.fInputColor, | 731 args.fInputColor, |
732 args.fSamplers); | 732 args.fTexSamplers); |
733 } | 733 } |
734 | 734 |
735 void GLFocalInside2PtConicalEffect::onSetData(const GrGLSLProgramDataManager& pd
man, | 735 void GLFocalInside2PtConicalEffect::onSetData(const GrGLSLProgramDataManager& pd
man, |
736 const GrProcessor& processor) { | 736 const GrProcessor& processor) { |
737 INHERITED::onSetData(pdman, processor); | 737 INHERITED::onSetData(pdman, processor); |
738 const FocalInside2PtConicalEffect& data = processor.cast<FocalInside2PtConic
alEffect>(); | 738 const FocalInside2PtConicalEffect& data = processor.cast<FocalInside2PtConic
alEffect>(); |
739 SkScalar focal = data.focal(); | 739 SkScalar focal = data.focal(); |
740 | 740 |
741 if (fCachedFocal != focal) { | 741 if (fCachedFocal != focal) { |
742 pdman.set1f(fFocalUni, SkScalarToFloat(focal)); | 742 pdman.set1f(fFocalUni, SkScalarToFloat(focal)); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 fragBuilder->codeAppendf("\tfloat %s = d + sqrt(d * d - %s.x * pDotp + %s.z)
;\n", | 987 fragBuilder->codeAppendf("\tfloat %s = d + sqrt(d * d - %s.x * pDotp + %s.z)
;\n", |
988 tName.c_str(), params.c_str(), params.c_str()); | 988 tName.c_str(), params.c_str(), params.c_str()); |
989 | 989 |
990 this->emitColor(fragBuilder, | 990 this->emitColor(fragBuilder, |
991 uniformHandler, | 991 uniformHandler, |
992 args.fGLSLCaps, | 992 args.fGLSLCaps, |
993 ge, | 993 ge, |
994 tName.c_str(), | 994 tName.c_str(), |
995 args.fOutputColor, | 995 args.fOutputColor, |
996 args.fInputColor, | 996 args.fInputColor, |
997 args.fSamplers); | 997 args.fTexSamplers); |
998 } | 998 } |
999 | 999 |
1000 void GLCircleInside2PtConicalEffect::onSetData(const GrGLSLProgramDataManager& p
dman, | 1000 void GLCircleInside2PtConicalEffect::onSetData(const GrGLSLProgramDataManager& p
dman, |
1001 const GrProcessor& processor) { | 1001 const GrProcessor& processor) { |
1002 INHERITED::onSetData(pdman, processor); | 1002 INHERITED::onSetData(pdman, processor); |
1003 const CircleInside2PtConicalEffect& data = processor.cast<CircleInside2PtCon
icalEffect>(); | 1003 const CircleInside2PtConicalEffect& data = processor.cast<CircleInside2PtCon
icalEffect>(); |
1004 SkScalar centerX = data.centerX(); | 1004 SkScalar centerX = data.centerX(); |
1005 SkScalar centerY = data.centerY(); | 1005 SkScalar centerY = data.centerY(); |
1006 SkScalar A = data.A(); | 1006 SkScalar A = data.A(); |
1007 SkScalar B = data.B(); | 1007 SkScalar B = data.B(); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 fragBuilder->codeAppendf("\tif (%s >= %s.w && deter >= 0.0) {\n", | 1238 fragBuilder->codeAppendf("\tif (%s >= %s.w && deter >= 0.0) {\n", |
1239 tName.c_str(), params.c_str()); | 1239 tName.c_str(), params.c_str()); |
1240 fragBuilder->codeAppend("\t\t"); | 1240 fragBuilder->codeAppend("\t\t"); |
1241 this->emitColor(fragBuilder, | 1241 this->emitColor(fragBuilder, |
1242 uniformHandler, | 1242 uniformHandler, |
1243 args.fGLSLCaps, | 1243 args.fGLSLCaps, |
1244 ge, | 1244 ge, |
1245 tName.c_str(), | 1245 tName.c_str(), |
1246 args.fOutputColor, | 1246 args.fOutputColor, |
1247 args.fInputColor, | 1247 args.fInputColor, |
1248 args.fSamplers); | 1248 args.fTexSamplers); |
1249 fragBuilder->codeAppend("\t}\n"); | 1249 fragBuilder->codeAppend("\t}\n"); |
1250 } | 1250 } |
1251 | 1251 |
1252 void GLCircleOutside2PtConicalEffect::onSetData(const GrGLSLProgramDataManager&
pdman, | 1252 void GLCircleOutside2PtConicalEffect::onSetData(const GrGLSLProgramDataManager&
pdman, |
1253 const GrProcessor& processor) { | 1253 const GrProcessor& processor) { |
1254 INHERITED::onSetData(pdman, processor); | 1254 INHERITED::onSetData(pdman, processor); |
1255 const CircleOutside2PtConicalEffect& data = processor.cast<CircleOutside2PtC
onicalEffect>(); | 1255 const CircleOutside2PtConicalEffect& data = processor.cast<CircleOutside2PtC
onicalEffect>(); |
1256 SkASSERT(data.isFlipped() == fIsFlipped); | 1256 SkASSERT(data.isFlipped() == fIsFlipped); |
1257 SkScalar centerX = data.centerX(); | 1257 SkScalar centerX = data.centerX(); |
1258 SkScalar centerY = data.centerY(); | 1258 SkScalar centerY = data.centerY(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, inf
o); | 1322 return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, inf
o); |
1323 } else if (type == kEdge_ConicalType) { | 1323 } else if (type == kEdge_ConicalType) { |
1324 set_matrix_edge_conical(shader, &matrix); | 1324 set_matrix_edge_conical(shader, &matrix); |
1325 return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm); | 1325 return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm); |
1326 } else { | 1326 } else { |
1327 return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, in
fo); | 1327 return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, in
fo); |
1328 } | 1328 } |
1329 } | 1329 } |
1330 | 1330 |
1331 #endif | 1331 #endif |
OLD | NEW |