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

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

Issue 14328009: Vertex Attrib configurations now handled as pointers vs. SkSTArrays (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Added "extern const" & removed comment 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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 687
688 GrEffectRef* HairLineEdgeEffect::TestCreate(SkMWCRandom* random, 688 GrEffectRef* HairLineEdgeEffect::TestCreate(SkMWCRandom* random,
689 GrContext*, 689 GrContext*,
690 const GrDrawTargetCaps& caps, 690 const GrDrawTargetCaps& caps,
691 GrTexture*[]) { 691 GrTexture*[]) {
692 return HairLineEdgeEffect::Create(); 692 return HairLineEdgeEffect::Create();
693 } 693 }
694 694
695 /////////////////////////////////////////////////////////////////////////////// 695 ///////////////////////////////////////////////////////////////////////////////
696 696
697 namespace {
698
699 // position + edge
700 extern const GrVertexAttrib gHairlineAttribs[] = {
701 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBind ing},
702 {kVec4f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBindin g}
703 };
704
705 };
706
697 bool GrAAHairLinePathRenderer::createGeom( 707 bool GrAAHairLinePathRenderer::createGeom(
698 const SkPath& path, 708 const SkPath& path,
699 GrDrawTarget* target, 709 GrDrawTarget* target,
700 int* lineCnt, 710 int* lineCnt,
701 int* quadCnt, 711 int* quadCnt,
702 GrDrawTarget::AutoReleaseGeometry* arg) { 712 GrDrawTarget::AutoReleaseGeometry* arg) {
703 GrDrawState* drawState = target->drawState(); 713 GrDrawState* drawState = target->drawState();
704 int rtHeight = drawState->getRenderTarget()->height(); 714 int rtHeight = drawState->getRenderTarget()->height();
705 715
706 GrIRect devClipBounds; 716 GrIRect devClipBounds;
707 target->getClip()->getConservativeBounds(drawState->getRenderTarget(), 717 target->getClip()->getConservativeBounds(drawState->getRenderTarget(),
708 &devClipBounds); 718 &devClipBounds);
709 719
710 // position + edge
711 static const GrVertexAttrib kAttribs[] = {
712 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttrib Binding},
713 {kVec4f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBi nding}
714 };
715 SkMatrix viewM = drawState->getViewMatrix(); 720 SkMatrix viewM = drawState->getViewMatrix();
716 721
717 PREALLOC_PTARRAY(128) lines; 722 PREALLOC_PTARRAY(128) lines;
718 PREALLOC_PTARRAY(128) quads; 723 PREALLOC_PTARRAY(128) quads;
719 IntArray qSubdivs; 724 IntArray qSubdivs;
720 *quadCnt = generate_lines_and_quads(path, viewM, devClipBounds, 725 *quadCnt = generate_lines_and_quads(path, viewM, devClipBounds,
721 &lines, &quads, &qSubdivs); 726 &lines, &quads, &qSubdivs);
722 727
723 *lineCnt = lines.count() / 2; 728 *lineCnt = lines.count() / 2;
724 int vertCnt = kVertsPerLineSeg * *lineCnt + kVertsPerQuad * *quadCnt; 729 int vertCnt = kVertsPerLineSeg * *lineCnt + kVertsPerQuad * *quadCnt;
725 730
726 target->drawState()->setVertexAttribs(kAttribs, SK_ARRAY_COUNT(kAttribs)); 731 target->drawState()->setVertexAttribs<gHairlineAttribs>(SK_ARRAY_COUNT(gHair lineAttribs));
727 GrAssert(sizeof(Vertex) == target->getDrawState().getVertexSize()); 732 GrAssert(sizeof(Vertex) == target->getDrawState().getVertexSize());
728 733
729 if (!arg->set(target, vertCnt, 0)) { 734 if (!arg->set(target, vertCnt, 0)) {
730 return false; 735 return false;
731 } 736 }
732 737
733 Vertex* verts = reinterpret_cast<Vertex*>(arg->vertices()); 738 Vertex* verts = reinterpret_cast<Vertex*>(arg->vertices());
734 739
735 const SkMatrix* toDevice = NULL; 740 const SkMatrix* toDevice = NULL;
736 const SkMatrix* toSrc = NULL; 741 const SkMatrix* toSrc = NULL;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 4 * lineCnt + kVertsPerQuad*quads, // startV 844 4 * lineCnt + kVertsPerQuad*quads, // startV
840 0, // startI 845 0, // startI
841 kVertsPerQuad*n, // vCount 846 kVertsPerQuad*n, // vCount
842 kIdxsPerQuad*n); // iCount 847 kIdxsPerQuad*n); // iCount
843 quads += n; 848 quads += n;
844 } 849 }
845 target->resetIndexSource(); 850 target->resetIndexSource();
846 851
847 return true; 852 return true;
848 } 853 }
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