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

Side by Side Diff: src/gpu/GrAAConvexPathRenderer.cpp

Issue 13296005: Revise attribute binding interface (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Fix fExperimentalGS in GrGLProgramDesc Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « include/gpu/GrTypesPriv.h ('k') | src/gpu/GrAAHairLinePathRenderer.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 2012 Google Inc. 3 * Copyright 2012 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 #include "GrAAConvexPathRenderer.h" 9 #include "GrAAConvexPathRenderer.h"
10 10
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 }; 478 };
479 SkSTArray<kPreallocSegmentCnt, Segment, true> segments; 479 SkSTArray<kPreallocSegmentCnt, Segment, true> segments;
480 SkPoint fanPt; 480 SkPoint fanPt;
481 481
482 if (!get_segments(*path, *vm, &segments, &fanPt, &vCount, &iCount)) { 482 if (!get_segments(*path, *vm, &segments, &fanPt, &vCount, &iCount)) {
483 return false; 483 return false;
484 } 484 }
485 485
486 // position + edge 486 // position + edge
487 static const GrVertexAttrib kAttribs[] = { 487 static const GrVertexAttrib kAttribs[] = {
488 {kVec2f_GrVertexAttribType, 0}, 488 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBin ding},
489 {kVec4f_GrVertexAttribType, sizeof(GrPoint)} 489 {kVec4f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBindi ng}
490 }; 490 };
491
492 drawState->setVertexAttribs(kAttribs, SK_ARRAY_COUNT(kAttribs)); 491 drawState->setVertexAttribs(kAttribs, SK_ARRAY_COUNT(kAttribs));
493 drawState->setAttribIndex(GrDrawState::kPosition_AttribIndex, 0);
494 drawState->setAttribBindings(GrDrawState::kDefault_AttribBindings);
495 492
496 enum { 493 enum {
497 // the edge effects share this stage with glyph rendering 494 // the edge effects share this stage with glyph rendering
498 // (kGlyphMaskStage in GrTextContext) && SW path rendering 495 // (kGlyphMaskStage in GrTextContext) && SW path rendering
499 // (kPathMaskStage in GrSWMaskHelper) 496 // (kPathMaskStage in GrSWMaskHelper)
500 kEdgeEffectStage = GrPaint::kTotalStages, 497 kEdgeEffectStage = GrPaint::kTotalStages,
501 }; 498 };
502 static const int kEdgeAttrIndex = 1; 499 static const int kEdgeAttrIndex = 1;
503 GrEffectRef* quadEffect = GrEdgeEffect::Create(GrEdgeEffect::kQuad_EdgeType) ; 500 GrEffectRef* quadEffect = GrEdgeEffect::Create(GrEdgeEffect::kQuad_EdgeType) ;
504 drawState->setEffect(kEdgeEffectStage, quadEffect, kEdgeAttrIndex)->unref(); 501 drawState->setEffect(kEdgeEffectStage, quadEffect, kEdgeAttrIndex)->unref();
505 502
506 GrDrawTarget::AutoReleaseGeometry arg(target, vCount, iCount); 503 GrDrawTarget::AutoReleaseGeometry arg(target, vCount, iCount);
507 if (!arg.succeeded()) { 504 if (!arg.succeeded()) {
508 return false; 505 return false;
509 } 506 }
510 GrAssert(sizeof(QuadVertex) == drawState->getVertexSize()); 507 GrAssert(sizeof(QuadVertex) == drawState->getVertexSize());
511 verts = reinterpret_cast<QuadVertex*>(arg.vertices()); 508 verts = reinterpret_cast<QuadVertex*>(arg.vertices());
512 idxs = reinterpret_cast<uint16_t*>(arg.indices()); 509 idxs = reinterpret_cast<uint16_t*>(arg.indices());
513 510
514 create_vertices(segments, fanPt, verts, idxs); 511 create_vertices(segments, fanPt, verts, idxs);
515 512
516 target->drawIndexed(kTriangles_GrPrimitiveType, 513 target->drawIndexed(kTriangles_GrPrimitiveType,
517 0, // start vertex 514 0, // start vertex
518 0, // start index 515 0, // start index
519 vCount, 516 vCount,
520 iCount); 517 iCount);
521 518
522 return true; 519 return true;
523 } 520 }
OLDNEW
« no previous file with comments | « include/gpu/GrTypesPriv.h ('k') | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698