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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 GrTestTarget tt; | 167 GrTestTarget tt; |
168 context->getTestTarget(&tt); | 168 context->getTestTarget(&tt); |
169 SkASSERT(tt.target()); | 169 SkASSERT(tt.target()); |
170 GrDrawState* drawState = tt.target()->drawState(); | 170 GrDrawState* drawState = tt.target()->drawState(); |
171 drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex)); | 171 drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex)); |
172 | 172 |
173 drawState->setGeometryProcessor(effect, 1); | 173 drawState->setGeometryProcessor(effect); |
174 drawState->setRenderTarget(rt); | 174 drawState->setRenderTarget(rt); |
175 drawState->setColor(0xff000000); | 175 drawState->setColor(0xff000000); |
176 | 176 |
177 tt.target()->setVertexSourceToArray(verts, 4); | 177 tt.target()->setVertexSourceToArray(verts, 4); |
178 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf
fer()); | 178 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf
fer()); |
179 tt.target()->drawIndexed(kTriangleFan_GrPrimitiveType, 0, 0,
4, 6); | 179 tt.target()->drawIndexed(kTriangleFan_GrPrimitiveType, 0, 0,
4, 6); |
180 } | 180 } |
181 ++col; | 181 ++col; |
182 if (numCols == col) { | 182 if (numCols == col) { |
183 col = 0; | 183 col = 0; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 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); |
319 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); |
320 } | 320 } |
321 | 321 |
322 GrTestTarget tt; | 322 GrTestTarget tt; |
323 context->getTestTarget(&tt); | 323 context->getTestTarget(&tt); |
324 SkASSERT(tt.target()); | 324 SkASSERT(tt.target()); |
325 GrDrawState* drawState = tt.target()->drawState(); | 325 GrDrawState* drawState = tt.target()->drawState(); |
326 drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex)); | 326 drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex)); |
327 | 327 |
328 drawState->setGeometryProcessor(effect, 1); | 328 drawState->setGeometryProcessor(effect); |
329 drawState->setRenderTarget(rt); | 329 drawState->setRenderTarget(rt); |
330 drawState->setColor(0xff000000); | 330 drawState->setColor(0xff000000); |
331 | 331 |
332 tt.target()->setVertexSourceToArray(verts, 4); | 332 tt.target()->setVertexSourceToArray(verts, 4); |
333 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf
fer()); | 333 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf
fer()); |
334 tt.target()->drawIndexed(kTriangleFan_GrPrimitiveType, 0, 0,
4, 6); | 334 tt.target()->drawIndexed(kTriangleFan_GrPrimitiveType, 0, 0,
4, 6); |
335 } | 335 } |
336 ++col; | 336 ++col; |
337 if (numCols == col) { | 337 if (numCols == col) { |
338 col = 0; | 338 col = 0; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 | 502 |
503 GrPathUtils::QuadUVMatrix DevToUV(pts); | 503 GrPathUtils::QuadUVMatrix DevToUV(pts); |
504 DevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts); | 504 DevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts); |
505 | 505 |
506 GrTestTarget tt; | 506 GrTestTarget tt; |
507 context->getTestTarget(&tt); | 507 context->getTestTarget(&tt); |
508 SkASSERT(tt.target()); | 508 SkASSERT(tt.target()); |
509 GrDrawState* drawState = tt.target()->drawState(); | 509 GrDrawState* drawState = tt.target()->drawState(); |
510 drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex)); | 510 drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex)); |
511 | 511 |
512 drawState->setGeometryProcessor(effect, 1); | 512 drawState->setGeometryProcessor(effect); |
513 drawState->setRenderTarget(rt); | 513 drawState->setRenderTarget(rt); |
514 drawState->setColor(0xff000000); | 514 drawState->setColor(0xff000000); |
515 | 515 |
516 tt.target()->setVertexSourceToArray(verts, 4); | 516 tt.target()->setVertexSourceToArray(verts, 4); |
517 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf
fer()); | 517 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf
fer()); |
518 tt.target()->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 4
, 6); | 518 tt.target()->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 4
, 6); |
519 } | 519 } |
520 ++col; | 520 ++col; |
521 if (numCols == col) { | 521 if (numCols == col) { |
522 col = 0; | 522 col = 0; |
523 ++row; | 523 ++row; |
524 } | 524 } |
525 } | 525 } |
526 } | 526 } |
527 } | 527 } |
528 | 528 |
529 private: | 529 private: |
530 typedef GM INHERITED; | 530 typedef GM INHERITED; |
531 }; | 531 }; |
532 | 532 |
533 DEF_GM( return SkNEW(BezierCubicEffects); ) | 533 DEF_GM( return SkNEW(BezierCubicEffects); ) |
534 DEF_GM( return SkNEW(BezierConicEffects); ) | 534 DEF_GM( return SkNEW(BezierConicEffects); ) |
535 DEF_GM( return SkNEW(BezierQuadEffects); ) | 535 DEF_GM( return SkNEW(BezierQuadEffects); ) |
536 | 536 |
537 } | 537 } |
538 | 538 |
539 #endif | 539 #endif |
OLD | NEW |