Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: gm/beziereffects.cpp

Issue 511593004: Make setVertexAttribs in GrDrawState take a stride parameter. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Release Fix Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gm/convexpolyeffect.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 GrTestTarget tt; 167 GrTestTarget tt;
168 context->getTestTarget(&tt); 168 context->getTestTarget(&tt);
169 SkASSERT(NULL != tt.target()); 169 SkASSERT(NULL != tt.target());
170 GrDrawState* drawState = tt.target()->drawState(); 170 GrDrawState* drawState = tt.target()->drawState();
171 drawState->setVertexAttribs<kAttribs>(2); 171 drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex));
172 172
173 drawState->addCoverageEffect(effect, 1); 173 drawState->addCoverageEffect(effect, 1);
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;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 for (int v = 0; v < 4; ++v) { 316 for (int v = 0; v < 4; ++v) {
317 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);
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(NULL != tt.target()); 324 SkASSERT(NULL != tt.target());
325 GrDrawState* drawState = tt.target()->drawState(); 325 GrDrawState* drawState = tt.target()->drawState();
326 drawState->setVertexAttribs<kAttribs>(2); 326 drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex));
327 327
328 drawState->addCoverageEffect(effect, 1); 328 drawState->addCoverageEffect(effect, 1);
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;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 bounds.fRight, bounds.fBottom, 500 bounds.fRight, bounds.fBottom,
501 sizeof(Vertex)); 501 sizeof(Vertex));
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(NULL != tt.target()); 508 SkASSERT(NULL != tt.target());
509 GrDrawState* drawState = tt.target()->drawState(); 509 GrDrawState* drawState = tt.target()->drawState();
510 drawState->setVertexAttribs<kAttribs>(2); 510 drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex));
511 511
512 drawState->addCoverageEffect(effect, 1); 512 drawState->addCoverageEffect(effect, 1);
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
OLDNEW
« no previous file with comments | « no previous file | gm/convexpolyeffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698