OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrPLSPathRenderer.h" | 8 #include "GrPLSPathRenderer.h" |
9 | 9 |
10 #include "SkChunkAlloc.h" | 10 #include "SkChunkAlloc.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 varyingHandler->addVarying("delta2", &delta2, kHigh_GrSLPrecision); | 321 varyingHandler->addVarying("delta2", &delta2, kHigh_GrSLPrecision); |
322 vsBuilder->codeAppendf("%s = vec2(%s.x - %s.x, %s.y - %s.y) * 0.5;",
| 322 vsBuilder->codeAppendf("%s = vec2(%s.x - %s.x, %s.y - %s.y) * 0.5;",
|
323 delta2.vsOut(), v2.vsOut(), v3.vsOut(), v3.vs
Out(), v2.vsOut()); | 323 delta2.vsOut(), v2.vsOut(), v3.vsOut(), v3.vs
Out(), v2.vsOut()); |
324 | 324 |
325 GrGLSLVertToFrag delta3(kVec2f_GrSLType); | 325 GrGLSLVertToFrag delta3(kVec2f_GrSLType); |
326 varyingHandler->addVarying("delta3", &delta3, kHigh_GrSLPrecision); | 326 varyingHandler->addVarying("delta3", &delta3, kHigh_GrSLPrecision); |
327 vsBuilder->codeAppendf("%s = vec2(%s.x - %s.x, %s.y - %s.y) * 0.5;",
| 327 vsBuilder->codeAppendf("%s = vec2(%s.x - %s.x, %s.y - %s.y) * 0.5;",
|
328 delta3.vsOut(), v3.vsOut(), v1.vsOut(), v1.vs
Out(), v3.vsOut()); | 328 delta3.vsOut(), v3.vsOut(), v1.vsOut(), v1.vs
Out(), v3.vsOut()); |
329 | 329 |
330 GrGLSLVertToFrag windings(kInt_GrSLType); | 330 GrGLSLVertToFrag windings(kInt_GrSLType); |
331 varyingHandler->addVarying("windings", &windings, kLow_GrSLPrecision
); | 331 varyingHandler->addFlatVarying("windings", &windings, kLow_GrSLPreci
sion); |
332 vsBuilder->codeAppendf("%s = %s;", | 332 vsBuilder->codeAppendf("%s = %s;", |
333 windings.vsOut(), te.inWindings()->fName); | 333 windings.vsOut(), te.inWindings()->fName); |
334 | 334 |
335 // emit transforms | 335 // emit transforms |
336 this->emitTransforms(vsBuilder, varyingHandler, uniformHandler, gpAr
gs->fPositionVar, | 336 this->emitTransforms(vsBuilder, varyingHandler, uniformHandler, gpAr
gs->fPositionVar, |
337 te.inPosition()->fName, te.localMatrix(), args.
fTransformsIn, | 337 te.inPosition()->fName, te.localMatrix(), args.
fTransformsIn, |
338 args.fTransformsOut); | 338 args.fTransformsOut); |
339 | 339 |
340 GrGLSLFragmentBuilder* fsBuilder = args.fFragBuilder; | 340 GrGLSLFragmentBuilder* fsBuilder = args.fFragBuilder; |
341 SkAssertResult(fsBuilder->enableFeature( | 341 SkAssertResult(fsBuilder->enableFeature( |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 vsBuilder->codeAppendf("%s = vec2(%s.x, %s.y);", ep2.vsOut(), | 506 vsBuilder->codeAppendf("%s = vec2(%s.x, %s.y);", ep2.vsOut(), |
507 qe.inEndpoint2()->fName, qe.inEndpoint2()->fNa
me); | 507 qe.inEndpoint2()->fName, qe.inEndpoint2()->fNa
me); |
508 | 508 |
509 GrGLSLVertToFrag delta(kVec2f_GrSLType); | 509 GrGLSLVertToFrag delta(kVec2f_GrSLType); |
510 varyingHandler->addVarying("delta", &delta, kHigh_GrSLPrecision); | 510 varyingHandler->addVarying("delta", &delta, kHigh_GrSLPrecision); |
511 vsBuilder->codeAppendf("%s = vec2(%s.x - %s.x, %s.y - %s.y) * 0.5;",
| 511 vsBuilder->codeAppendf("%s = vec2(%s.x - %s.x, %s.y - %s.y) * 0.5;",
|
512 delta.vsOut(), ep1.vsOut(), ep2.vsOut(), ep2.
vsOut(), | 512 delta.vsOut(), ep1.vsOut(), ep2.vsOut(), ep2.
vsOut(), |
513 ep1.vsOut()); | 513 ep1.vsOut()); |
514 | 514 |
515 GrGLSLVertToFrag windings(kInt_GrSLType); | 515 GrGLSLVertToFrag windings(kInt_GrSLType); |
516 varyingHandler->addVarying("windings", &windings, kLow_GrSLPrecision
); | 516 varyingHandler->addFlatVarying("windings", &windings, kLow_GrSLPreci
sion); |
517 vsBuilder->codeAppendf("%s = %s;", | 517 vsBuilder->codeAppendf("%s = %s;", |
518 windings.vsOut(), qe.inWindings()->fName); | 518 windings.vsOut(), qe.inWindings()->fName); |
519 | 519 |
520 // Setup position | 520 // Setup position |
521 this->setupPosition(vsBuilder, gpArgs, qe.inPosition()->fName); | 521 this->setupPosition(vsBuilder, gpArgs, qe.inPosition()->fName); |
522 | 522 |
523 // emit transforms | 523 // emit transforms |
524 this->emitTransforms(vsBuilder, varyingHandler, uniformHandler, gpAr
gs->fPositionVar, | 524 this->emitTransforms(vsBuilder, varyingHandler, uniformHandler, gpAr
gs->fPositionVar, |
525 qe.inPosition()->fName, qe.localMatrix(), args.
fTransformsIn, | 525 qe.inPosition()->fName, qe.localMatrix(), args.
fTransformsIn, |
526 args.fTransformsOut); | 526 args.fTransformsOut); |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 DRAW_BATCH_TEST_DEFINE(PLSPathBatch) { | 1003 DRAW_BATCH_TEST_DEFINE(PLSPathBatch) { |
1004 PLSPathBatch::Geometry geometry; | 1004 PLSPathBatch::Geometry geometry; |
1005 geometry.fColor = GrRandomColor(random); | 1005 geometry.fColor = GrRandomColor(random); |
1006 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); | 1006 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); |
1007 geometry.fPath = GrTest::TestPathConvex(random); | 1007 geometry.fPath = GrTest::TestPathConvex(random); |
1008 | 1008 |
1009 return PLSPathBatch::Create(geometry); | 1009 return PLSPathBatch::Create(geometry); |
1010 } | 1010 } |
1011 | 1011 |
1012 #endif | 1012 #endif |
OLD | NEW |