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

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

Issue 511593004: Make setVertexAttribs in GrDrawState take a stride parameter. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
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 "gl/builders/GrGLProgramBuilder.h" 9 #include "gl/builders/GrGLProgramBuilder.h"
10 #include "GrAAConvexPathRenderer.h" 10 #include "GrAAConvexPathRenderer.h"
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 // We can't simply use the path bounds because we may degenerate cubics to q uads which produces 667 // We can't simply use the path bounds because we may degenerate cubics to q uads which produces
668 // new control points outside the original convex hull. 668 // new control points outside the original convex hull.
669 SkRect devBounds; 669 SkRect devBounds;
670 if (!get_segments(*path, viewMatrix, &segments, &fanPt, &vCount, &iCount, &d evBounds)) { 670 if (!get_segments(*path, viewMatrix, &segments, &fanPt, &vCount, &iCount, &d evBounds)) {
671 return false; 671 return false;
672 } 672 }
673 673
674 // Our computed verts should all be within one pixel of the segment control points. 674 // Our computed verts should all be within one pixel of the segment control points.
675 devBounds.outset(SK_Scalar1, SK_Scalar1); 675 devBounds.outset(SK_Scalar1, SK_Scalar1);
676 676
677 drawState->setVertexAttribs<gPathAttribs>(SK_ARRAY_COUNT(gPathAttribs)); 677 drawState->setVertexAttribs<gPathAttribs>(SK_ARRAY_COUNT(gPathAttribs), size of(QuadVertex));
678 678
679 static const int kEdgeAttrIndex = 1; 679 static const int kEdgeAttrIndex = 1;
680 GrEffect* quadEffect = QuadEdgeEffect::Create(); 680 GrEffect* quadEffect = QuadEdgeEffect::Create();
681 drawState->addCoverageEffect(quadEffect, kEdgeAttrIndex)->unref(); 681 drawState->addCoverageEffect(quadEffect, kEdgeAttrIndex)->unref();
682 682
683 GrDrawTarget::AutoReleaseGeometry arg(target, vCount, iCount); 683 GrDrawTarget::AutoReleaseGeometry arg(target, vCount, iCount);
684 if (!arg.succeeded()) { 684 if (!arg.succeeded()) {
685 return false; 685 return false;
686 } 686 }
687 SkASSERT(sizeof(QuadVertex) == drawState->getVertexSize());
688 verts = reinterpret_cast<QuadVertex*>(arg.vertices()); 687 verts = reinterpret_cast<QuadVertex*>(arg.vertices());
689 idxs = reinterpret_cast<uint16_t*>(arg.indices()); 688 idxs = reinterpret_cast<uint16_t*>(arg.indices());
690 689
691 SkSTArray<kPreallocDrawCnt, Draw, true> draws; 690 SkSTArray<kPreallocDrawCnt, Draw, true> draws;
692 create_vertices(segments, fanPt, &draws, verts, idxs); 691 create_vertices(segments, fanPt, &draws, verts, idxs);
693 692
694 // Check devBounds 693 // Check devBounds
695 #ifdef SK_DEBUG 694 #ifdef SK_DEBUG
696 SkRect tolDevBounds = devBounds; 695 SkRect tolDevBounds = devBounds;
697 tolDevBounds.outset(SK_Scalar1 / 10000, SK_Scalar1 / 10000); 696 tolDevBounds.outset(SK_Scalar1 / 10000, SK_Scalar1 / 10000);
(...skipping 12 matching lines...) Expand all
710 vOffset, // start vertex 709 vOffset, // start vertex
711 0, // start index 710 0, // start index
712 draw.fVertexCnt, 711 draw.fVertexCnt,
713 draw.fIndexCnt, 712 draw.fIndexCnt,
714 &devBounds); 713 &devBounds);
715 vOffset += draw.fVertexCnt; 714 vOffset += draw.fVertexCnt;
716 } 715 }
717 716
718 return true; 717 return true;
719 } 718 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698