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

Side by Side Diff: src/gpu/GrAAHairLinePathRenderer.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 | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrAARectRenderer.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 2011 Google Inc. 3 * Copyright 2011 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 "GrAAHairLinePathRenderer.h" 9 #include "GrAAHairLinePathRenderer.h"
10 10
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 GrDrawTarget::AutoReleaseGeometry* arg) { 500 GrDrawTarget::AutoReleaseGeometry* arg) {
501 GrDrawState* drawState = target->drawState(); 501 GrDrawState* drawState = target->drawState();
502 int rtHeight = drawState->getRenderTarget()->height(); 502 int rtHeight = drawState->getRenderTarget()->height();
503 503
504 GrIRect devClipBounds; 504 GrIRect devClipBounds;
505 target->getClip()->getConservativeBounds(drawState->getRenderTarget(), 505 target->getClip()->getConservativeBounds(drawState->getRenderTarget(),
506 &devClipBounds); 506 &devClipBounds);
507 507
508 // position + edge 508 // position + edge
509 static const GrVertexAttrib kAttribs[] = { 509 static const GrVertexAttrib kAttribs[] = {
510 {kVec2f_GrVertexAttribType, 0}, 510 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttrib Binding},
511 {kVec4f_GrVertexAttribType, sizeof(GrPoint)} 511 {kVec4f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBi nding}
512 }; 512 };
513 SkMatrix viewM = drawState->getViewMatrix(); 513 SkMatrix viewM = drawState->getViewMatrix();
514 514
515 PREALLOC_PTARRAY(128) lines; 515 PREALLOC_PTARRAY(128) lines;
516 PREALLOC_PTARRAY(128) quads; 516 PREALLOC_PTARRAY(128) quads;
517 IntArray qSubdivs; 517 IntArray qSubdivs;
518 *quadCnt = generate_lines_and_quads(path, viewM, devClipBounds, 518 *quadCnt = generate_lines_and_quads(path, viewM, devClipBounds,
519 &lines, &quads, &qSubdivs); 519 &lines, &quads, &qSubdivs);
520 520
521 *lineCnt = lines.count() / 2; 521 *lineCnt = lines.count() / 2;
522 int vertCnt = kVertsPerLineSeg * *lineCnt + kVertsPerQuad * *quadCnt; 522 int vertCnt = kVertsPerLineSeg * *lineCnt + kVertsPerQuad * *quadCnt;
523 523
524 target->drawState()->setVertexAttribs(kAttribs, SK_ARRAY_COUNT(kAttribs)); 524 target->drawState()->setVertexAttribs(kAttribs, SK_ARRAY_COUNT(kAttribs));
525 target->drawState()->setAttribIndex(GrDrawState::kPosition_AttribIndex, 0);
526 target->drawState()->setAttribBindings(GrDrawState::kDefault_AttribBindings) ;
527 GrAssert(sizeof(Vertex) == target->getDrawState().getVertexSize()); 525 GrAssert(sizeof(Vertex) == target->getDrawState().getVertexSize());
528 526
529 if (!arg->set(target, vertCnt, 0)) { 527 if (!arg->set(target, vertCnt, 0)) {
530 return false; 528 return false;
531 } 529 }
532 530
533 Vertex* verts = reinterpret_cast<Vertex*>(arg->vertices()); 531 Vertex* verts = reinterpret_cast<Vertex*>(arg->vertices());
534 532
535 const SkMatrix* toDevice = NULL; 533 const SkMatrix* toDevice = NULL;
536 const SkMatrix* toSrc = NULL; 534 const SkMatrix* toSrc = NULL;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 target->drawIndexed(kTriangles_GrPrimitiveType, 636 target->drawIndexed(kTriangles_GrPrimitiveType,
639 4 * lineCnt + kVertsPerQuad*quads, // startV 637 4 * lineCnt + kVertsPerQuad*quads, // startV
640 0, // startI 638 0, // startI
641 kVertsPerQuad*n, // vCount 639 kVertsPerQuad*n, // vCount
642 kIdxsPerQuad*n); // iCount 640 kIdxsPerQuad*n); // iCount
643 quads += n; 641 quads += n;
644 } 642 }
645 643
646 return true; 644 return true;
647 } 645 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698