OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 // This test only works with the GPU backend. | 9 // This test only works with the GPU backend. |
10 | 10 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 | 157 |
158 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, | 158 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, |
159 bounds.fRight, bounds.fBottom, | 159 bounds.fRight, bounds.fBottom, |
160 sizeof(Vertex)); | 160 sizeof(Vertex)); |
161 for (int v = 0; v < 4; ++v) { | 161 for (int v = 0; v < 4; ++v) { |
162 verts[v].fKLM[0] = eval_line(verts[v].fPosition, klmEqs + 0, klmSigns[c]); | 162 verts[v].fKLM[0] = eval_line(verts[v].fPosition, klmEqs + 0, klmSigns[c]); |
163 verts[v].fKLM[1] = eval_line(verts[v].fPosition, klmEqs + 3, klmSigns[c]); | 163 verts[v].fKLM[1] = eval_line(verts[v].fPosition, klmEqs + 3, klmSigns[c]); |
164 verts[v].fKLM[2] = eval_line(verts[v].fPosition, klmEqs + 6, 1.f); | 164 verts[v].fKLM[2] = eval_line(verts[v].fPosition, klmEqs + 6, 1.f); |
165 } | 165 } |
166 | 166 |
167 ds.setGeometryProcessor(gp); | |
168 ds.setRenderTarget(rt); | 167 ds.setRenderTarget(rt); |
169 | 168 |
170 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf fer()); | 169 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf fer()); |
171 tt.target()->drawIndexed(&ds, kTriangleFan_GrPrimitiveType, 0, 0, 4, 6); | 170 tt.target()->drawIndexed(&ds, gp.get(), kTriangleFan_GrPrimi tiveType, 0, 0,4,6); |
bsalomon
2014/12/10 15:26:59
Can't you just pass gp? I thought it would auto-ca
| |
172 } | 171 } |
173 ++col; | 172 ++col; |
174 if (numCols == col) { | 173 if (numCols == col) { |
175 col = 0; | 174 col = 0; |
176 ++row; | 175 ++row; |
177 } | 176 } |
178 } | 177 } |
179 } | 178 } |
180 } | 179 } |
181 | 180 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 | 312 |
314 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, | 313 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, |
315 bounds.fRight, bounds.fBottom, | 314 bounds.fRight, bounds.fBottom, |
316 sizeof(Vertex)); | 315 sizeof(Vertex)); |
317 for (int v = 0; v < 4; ++v) { | 316 for (int v = 0; v < 4; ++v) { |
318 verts[v].fKLM[0] = eval_line(verts[v].fPosition, klmEqs + 0, 1.f); | 317 verts[v].fKLM[0] = eval_line(verts[v].fPosition, klmEqs + 0, 1.f); |
319 verts[v].fKLM[1] = eval_line(verts[v].fPosition, klmEqs + 3, 1.f); | 318 verts[v].fKLM[1] = eval_line(verts[v].fPosition, klmEqs + 3, 1.f); |
320 verts[v].fKLM[2] = eval_line(verts[v].fPosition, klmEqs + 6, 1.f); | 319 verts[v].fKLM[2] = eval_line(verts[v].fPosition, klmEqs + 6, 1.f); |
321 } | 320 } |
322 | 321 |
323 ds.setGeometryProcessor(gp); | |
324 ds.setRenderTarget(rt); | 322 ds.setRenderTarget(rt); |
325 | 323 |
326 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf fer()); | 324 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf fer()); |
327 tt.target()->drawIndexed(&ds, kTriangleFan_GrPrimitiveType, 0, 0, 4, 6); | 325 tt.target()->drawIndexed(&ds, gp.get(), kTriangleFan_GrPrimi tiveType, 0, 0,4,6); |
328 } | 326 } |
329 ++col; | 327 ++col; |
330 if (numCols == col) { | 328 if (numCols == col) { |
331 col = 0; | 329 col = 0; |
332 ++row; | 330 ++row; |
333 } | 331 } |
334 } | 332 } |
335 } | 333 } |
336 } | 334 } |
337 | 335 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
498 SkASSERT(gp->getVertexStride() == sizeof(Vertex)); | 496 SkASSERT(gp->getVertexStride() == sizeof(Vertex)); |
499 Vertex* verts = reinterpret_cast<Vertex*>(geo.vertices()); | 497 Vertex* verts = reinterpret_cast<Vertex*>(geo.vertices()); |
500 | 498 |
501 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, | 499 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, |
502 bounds.fRight, bounds.fBottom, | 500 bounds.fRight, bounds.fBottom, |
503 sizeof(Vertex)); | 501 sizeof(Vertex)); |
504 | 502 |
505 GrPathUtils::QuadUVMatrix DevToUV(pts); | 503 GrPathUtils::QuadUVMatrix DevToUV(pts); |
506 DevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts); | 504 DevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts); |
507 | 505 |
508 ds.setGeometryProcessor(gp); | |
509 ds.setRenderTarget(rt); | 506 ds.setRenderTarget(rt); |
510 | 507 |
511 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf fer()); | 508 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf fer()); |
512 tt.target()->drawIndexed(&ds, kTriangles_GrPrimitiveType, 0, 0, 4, 6); | 509 tt.target()->drawIndexed(&ds, gp.get(), kTriangles_GrPrimiti veType, 0, 0, 4, 6); |
513 } | 510 } |
514 ++col; | 511 ++col; |
515 if (numCols == col) { | 512 if (numCols == col) { |
516 col = 0; | 513 col = 0; |
517 ++row; | 514 ++row; |
518 } | 515 } |
519 } | 516 } |
520 } | 517 } |
521 } | 518 } |
522 | 519 |
523 private: | 520 private: |
524 typedef GM INHERITED; | 521 typedef GM INHERITED; |
525 }; | 522 }; |
526 | 523 |
527 DEF_GM( return SkNEW(BezierCubicEffects); ) | 524 DEF_GM( return SkNEW(BezierCubicEffects); ) |
528 DEF_GM( return SkNEW(BezierConicEffects); ) | 525 DEF_GM( return SkNEW(BezierConicEffects); ) |
529 DEF_GM( return SkNEW(BezierQuadEffects); ) | 526 DEF_GM( return SkNEW(BezierQuadEffects); ) |
530 | 527 |
531 } | 528 } |
532 | 529 |
533 #endif | 530 #endif |
OLD | NEW |