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

Side by Side Diff: gm/beziereffects.cpp

Issue 858343002: Rename GrOptDrawState to GrPipeline and GrDrawState to GrPipelineBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more nits Created 5 years, 11 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 SkPaint boundsPaint; 143 SkPaint boundsPaint;
144 boundsPaint.setColor(0xff808080); 144 boundsPaint.setColor(0xff808080);
145 boundsPaint.setStrokeWidth(0); 145 boundsPaint.setStrokeWidth(0);
146 boundsPaint.setStyle(SkPaint::kStroke_Style); 146 boundsPaint.setStyle(SkPaint::kStroke_Style);
147 canvas->drawRect(bounds, boundsPaint); 147 canvas->drawRect(bounds, boundsPaint);
148 148
149 GrTestTarget tt; 149 GrTestTarget tt;
150 context->getTestTarget(&tt); 150 context->getTestTarget(&tt);
151 SkASSERT(tt.target()); 151 SkASSERT(tt.target());
152 152
153 GrDrawState ds; 153 GrPipelineBuilder pipelineBuilder;
154 154
155 GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->ge tVertexStride(), 0); 155 GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->ge tVertexStride(), 0);
156 SkASSERT(gp->getVertexStride() == sizeof(Vertex)); 156 SkASSERT(gp->getVertexStride() == sizeof(Vertex));
157 Vertex* verts = reinterpret_cast<Vertex*>(geo.vertices()); 157 Vertex* verts = reinterpret_cast<Vertex*>(geo.vertices());
158 158
159 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, 159 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop,
160 bounds.fRight, bounds.fBottom, 160 bounds.fRight, bounds.fBottom,
161 sizeof(Vertex)); 161 sizeof(Vertex));
162 for (int v = 0; v < 4; ++v) { 162 for (int v = 0; v < 4; ++v) {
163 verts[v].fKLM[0] = eval_line(verts[v].fPosition, klmEqs + 0, klmSigns[c]); 163 verts[v].fKLM[0] = eval_line(verts[v].fPosition, klmEqs + 0, klmSigns[c]);
164 verts[v].fKLM[1] = eval_line(verts[v].fPosition, klmEqs + 3, klmSigns[c]); 164 verts[v].fKLM[1] = eval_line(verts[v].fPosition, klmEqs + 3, klmSigns[c]);
165 verts[v].fKLM[2] = eval_line(verts[v].fPosition, klmEqs + 6, 1.f); 165 verts[v].fKLM[2] = eval_line(verts[v].fPosition, klmEqs + 6, 1.f);
166 } 166 }
167 167
168 ds.setRenderTarget(rt); 168 pipelineBuilder.setRenderTarget(rt);
169 169
170 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf fer()); 170 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf fer());
171 tt.target()->drawIndexed(&ds, gp, kTriangleFan_GrPrimitiveTy pe, 0, 0,4,6); 171 tt.target()->drawIndexed(&pipelineBuilder, gp, kTriangleFan_ GrPrimitiveType,
172 0, 0,4,6);
172 } 173 }
173 ++col; 174 ++col;
174 if (numCols == col) { 175 if (numCols == col) {
175 col = 0; 176 col = 0;
176 ++row; 177 ++row;
177 } 178 }
178 } 179 }
179 } 180 }
180 } 181 }
181 182
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 SkPaint boundsPaint; 300 SkPaint boundsPaint;
300 boundsPaint.setColor(0xff808080); 301 boundsPaint.setColor(0xff808080);
301 boundsPaint.setStrokeWidth(0); 302 boundsPaint.setStrokeWidth(0);
302 boundsPaint.setStyle(SkPaint::kStroke_Style); 303 boundsPaint.setStyle(SkPaint::kStroke_Style);
303 canvas->drawRect(bounds, boundsPaint); 304 canvas->drawRect(bounds, boundsPaint);
304 305
305 GrTestTarget tt; 306 GrTestTarget tt;
306 context->getTestTarget(&tt); 307 context->getTestTarget(&tt);
307 SkASSERT(tt.target()); 308 SkASSERT(tt.target());
308 309
309 GrDrawState ds; 310 GrPipelineBuilder pipelineBuilder;
310 311
311 GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->ge tVertexStride(), 0); 312 GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->ge tVertexStride(), 0);
312 SkASSERT(gp->getVertexStride() == sizeof(Vertex)); 313 SkASSERT(gp->getVertexStride() == sizeof(Vertex));
313 Vertex* verts = reinterpret_cast<Vertex*>(geo.vertices()); 314 Vertex* verts = reinterpret_cast<Vertex*>(geo.vertices());
314 315
315 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, 316 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop,
316 bounds.fRight, bounds.fBottom, 317 bounds.fRight, bounds.fBottom,
317 sizeof(Vertex)); 318 sizeof(Vertex));
318 for (int v = 0; v < 4; ++v) { 319 for (int v = 0; v < 4; ++v) {
319 verts[v].fKLM[0] = eval_line(verts[v].fPosition, klmEqs + 0, 1.f); 320 verts[v].fKLM[0] = eval_line(verts[v].fPosition, klmEqs + 0, 1.f);
320 verts[v].fKLM[1] = eval_line(verts[v].fPosition, klmEqs + 3, 1.f); 321 verts[v].fKLM[1] = eval_line(verts[v].fPosition, klmEqs + 3, 1.f);
321 verts[v].fKLM[2] = eval_line(verts[v].fPosition, klmEqs + 6, 1.f); 322 verts[v].fKLM[2] = eval_line(verts[v].fPosition, klmEqs + 6, 1.f);
322 } 323 }
323 324
324 ds.setRenderTarget(rt); 325 pipelineBuilder.setRenderTarget(rt);
325 326
326 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf fer()); 327 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf fer());
327 tt.target()->drawIndexed(&ds, gp, kTriangleFan_GrPrimitiveTy pe, 0, 0,4,6); 328 tt.target()->drawIndexed(&pipelineBuilder, gp, kTriangleFan_ GrPrimitiveType,
329 0, 0,4,6);
328 } 330 }
329 ++col; 331 ++col;
330 if (numCols == col) { 332 if (numCols == col) {
331 col = 0; 333 col = 0;
332 ++row; 334 ++row;
333 } 335 }
334 } 336 }
335 } 337 }
336 } 338 }
337 339
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 SkPaint boundsPaint; 488 SkPaint boundsPaint;
487 boundsPaint.setColor(0xff808080); 489 boundsPaint.setColor(0xff808080);
488 boundsPaint.setStrokeWidth(0); 490 boundsPaint.setStrokeWidth(0);
489 boundsPaint.setStyle(SkPaint::kStroke_Style); 491 boundsPaint.setStyle(SkPaint::kStroke_Style);
490 canvas->drawRect(bounds, boundsPaint); 492 canvas->drawRect(bounds, boundsPaint);
491 493
492 GrTestTarget tt; 494 GrTestTarget tt;
493 context->getTestTarget(&tt); 495 context->getTestTarget(&tt);
494 SkASSERT(tt.target()); 496 SkASSERT(tt.target());
495 497
496 GrDrawState ds; 498 GrPipelineBuilder pipelineBuilder;
497 499
498 GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->ge tVertexStride(), 0); 500 GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->ge tVertexStride(), 0);
499 SkASSERT(gp->getVertexStride() == sizeof(Vertex)); 501 SkASSERT(gp->getVertexStride() == sizeof(Vertex));
500 Vertex* verts = reinterpret_cast<Vertex*>(geo.vertices()); 502 Vertex* verts = reinterpret_cast<Vertex*>(geo.vertices());
501 503
502 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, 504 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop,
503 bounds.fRight, bounds.fBottom, 505 bounds.fRight, bounds.fBottom,
504 sizeof(Vertex)); 506 sizeof(Vertex));
505 507
506 GrPathUtils::QuadUVMatrix DevToUV(pts); 508 GrPathUtils::QuadUVMatrix DevToUV(pts);
507 DevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts); 509 DevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts);
508 510
509 ds.setRenderTarget(rt); 511 pipelineBuilder.setRenderTarget(rt);
510 512
511 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf fer()); 513 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuf fer());
512 tt.target()->drawIndexed(&ds, gp, kTriangles_GrPrimitiveType , 0, 0, 4, 6); 514 tt.target()->drawIndexed(&pipelineBuilder, gp, kTriangles_Gr PrimitiveType,
515 0, 0, 4, 6);
513 } 516 }
514 ++col; 517 ++col;
515 if (numCols == col) { 518 if (numCols == col) {
516 col = 0; 519 col = 0;
517 ++row; 520 ++row;
518 } 521 }
519 } 522 }
520 } 523 }
521 } 524 }
522 525
523 private: 526 private:
524 typedef GM INHERITED; 527 typedef GM INHERITED;
525 }; 528 };
526 529
527 DEF_GM( return SkNEW(BezierCubicEffects); ) 530 DEF_GM( return SkNEW(BezierCubicEffects); )
528 DEF_GM( return SkNEW(BezierConicEffects); ) 531 DEF_GM( return SkNEW(BezierConicEffects); )
529 DEF_GM( return SkNEW(BezierQuadEffects); ) 532 DEF_GM( return SkNEW(BezierQuadEffects); )
530 533
531 } 534 }
532 535
533 #endif 536 #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