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); |
167 ds.setRenderTarget(rt); | 168 ds.setRenderTarget(rt); |
168 | 169 |
169 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf
fer()); | 170 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf
fer()); |
170 tt.target()->drawIndexed(&ds, gp, kTriangleFan_GrPrimitiveTy
pe, 0, 0,4,6); | 171 tt.target()->drawIndexed(&ds, kTriangleFan_GrPrimitiveType,
0, 0, 4, 6); |
171 } | 172 } |
172 ++col; | 173 ++col; |
173 if (numCols == col) { | 174 if (numCols == col) { |
174 col = 0; | 175 col = 0; |
175 ++row; | 176 ++row; |
176 } | 177 } |
177 } | 178 } |
178 } | 179 } |
179 } | 180 } |
180 | 181 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 313 |
313 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, | 314 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, |
314 bounds.fRight, bounds.fBottom, | 315 bounds.fRight, bounds.fBottom, |
315 sizeof(Vertex)); | 316 sizeof(Vertex)); |
316 for (int v = 0; v < 4; ++v) { | 317 for (int v = 0; v < 4; ++v) { |
317 verts[v].fKLM[0] = eval_line(verts[v].fPosition, klmEqs
+ 0, 1.f); | 318 verts[v].fKLM[0] = eval_line(verts[v].fPosition, klmEqs
+ 0, 1.f); |
318 verts[v].fKLM[1] = eval_line(verts[v].fPosition, klmEqs
+ 3, 1.f); | 319 verts[v].fKLM[1] = eval_line(verts[v].fPosition, klmEqs
+ 3, 1.f); |
319 verts[v].fKLM[2] = eval_line(verts[v].fPosition, klmEqs
+ 6, 1.f); | 320 verts[v].fKLM[2] = eval_line(verts[v].fPosition, klmEqs
+ 6, 1.f); |
320 } | 321 } |
321 | 322 |
| 323 ds.setGeometryProcessor(gp); |
322 ds.setRenderTarget(rt); | 324 ds.setRenderTarget(rt); |
323 | 325 |
324 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf
fer()); | 326 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf
fer()); |
325 tt.target()->drawIndexed(&ds, gp, kTriangleFan_GrPrimitiveTy
pe, 0, 0,4,6); | 327 tt.target()->drawIndexed(&ds, kTriangleFan_GrPrimitiveType,
0, 0, 4, 6); |
326 } | 328 } |
327 ++col; | 329 ++col; |
328 if (numCols == col) { | 330 if (numCols == col) { |
329 col = 0; | 331 col = 0; |
330 ++row; | 332 ++row; |
331 } | 333 } |
332 } | 334 } |
333 } | 335 } |
334 } | 336 } |
335 | 337 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 SkASSERT(gp->getVertexStride() == sizeof(Vertex)); | 498 SkASSERT(gp->getVertexStride() == sizeof(Vertex)); |
497 Vertex* verts = reinterpret_cast<Vertex*>(geo.vertices()); | 499 Vertex* verts = reinterpret_cast<Vertex*>(geo.vertices()); |
498 | 500 |
499 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, | 501 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, |
500 bounds.fRight, bounds.fBottom, | 502 bounds.fRight, bounds.fBottom, |
501 sizeof(Vertex)); | 503 sizeof(Vertex)); |
502 | 504 |
503 GrPathUtils::QuadUVMatrix DevToUV(pts); | 505 GrPathUtils::QuadUVMatrix DevToUV(pts); |
504 DevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts); | 506 DevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts); |
505 | 507 |
| 508 ds.setGeometryProcessor(gp); |
506 ds.setRenderTarget(rt); | 509 ds.setRenderTarget(rt); |
507 | 510 |
508 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf
fer()); | 511 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf
fer()); |
509 tt.target()->drawIndexed(&ds, gp, kTriangles_GrPrimitiveType
, 0, 0, 4, 6); | 512 tt.target()->drawIndexed(&ds, kTriangles_GrPrimitiveType, 0,
0, 4, 6); |
510 } | 513 } |
511 ++col; | 514 ++col; |
512 if (numCols == col) { | 515 if (numCols == col) { |
513 col = 0; | 516 col = 0; |
514 ++row; | 517 ++row; |
515 } | 518 } |
516 } | 519 } |
517 } | 520 } |
518 } | 521 } |
519 | 522 |
520 private: | 523 private: |
521 typedef GM INHERITED; | 524 typedef GM INHERITED; |
522 }; | 525 }; |
523 | 526 |
524 DEF_GM( return SkNEW(BezierCubicEffects); ) | 527 DEF_GM( return SkNEW(BezierCubicEffects); ) |
525 DEF_GM( return SkNEW(BezierConicEffects); ) | 528 DEF_GM( return SkNEW(BezierConicEffects); ) |
526 DEF_GM( return SkNEW(BezierQuadEffects); ) | 529 DEF_GM( return SkNEW(BezierQuadEffects); ) |
527 | 530 |
528 } | 531 } |
529 | 532 |
530 #endif | 533 #endif |
OLD | NEW |