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

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

Issue 142543007: Revert of r13384 (Stateful PathRenderer implementation) (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 10 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.h ('k') | src/gpu/GrAAHairLinePathRenderer.h » ('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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 GrEffectRef* QuadEdgeEffect::TestCreate(SkRandom* random, 598 GrEffectRef* QuadEdgeEffect::TestCreate(SkRandom* random,
599 GrContext*, 599 GrContext*,
600 const GrDrawTargetCaps& caps, 600 const GrDrawTargetCaps& caps,
601 GrTexture*[]) { 601 GrTexture*[]) {
602 // Doesn't work without derivative instructions. 602 // Doesn't work without derivative instructions.
603 return caps.shaderDerivativeSupport() ? QuadEdgeEffect::Create() : NULL; 603 return caps.shaderDerivativeSupport() ? QuadEdgeEffect::Create() : NULL;
604 } 604 }
605 605
606 /////////////////////////////////////////////////////////////////////////////// 606 ///////////////////////////////////////////////////////////////////////////////
607 607
608 bool GrAAConvexPathRenderer::canDrawPath(const SkStrokeRec& stroke, 608 bool GrAAConvexPathRenderer::canDrawPath(const SkPath& path,
609 const SkStrokeRec& stroke,
609 const GrDrawTarget* target, 610 const GrDrawTarget* target,
610 bool antiAlias) const { 611 bool antiAlias) const {
611 return (target->caps()->shaderDerivativeSupport() && antiAlias && 612 return (target->caps()->shaderDerivativeSupport() && antiAlias &&
612 stroke.isFillStyle() && !this->path().isInverseFillType() && this->p ath().isConvex()); 613 stroke.isFillStyle() && !path.isInverseFillType() && path.isConvex() );
613 } 614 }
614 615
615 namespace { 616 namespace {
616 617
617 // position + edge 618 // position + edge
618 extern const GrVertexAttrib gPathAttribs[] = { 619 extern const GrVertexAttrib gPathAttribs[] = {
619 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding }, 620 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding },
620 {kVec4f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBinding} 621 {kVec4f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBinding}
621 }; 622 };
622 623
623 }; 624 };
624 625
625 bool GrAAConvexPathRenderer::onDrawPath(const SkStrokeRec&, 626 bool GrAAConvexPathRenderer::onDrawPath(const SkPath& origPath,
627 const SkStrokeRec&,
626 GrDrawTarget* target, 628 GrDrawTarget* target,
627 bool antiAlias) { 629 bool antiAlias) {
628 630
629 const SkPath* path = &this->path(); 631 const SkPath* path = &origPath;
630 if (path->isEmpty()) { 632 if (path->isEmpty()) {
631 return true; 633 return true;
632 } 634 }
633 635
634 SkMatrix viewMatrix = target->getDrawState().getViewMatrix(); 636 SkMatrix viewMatrix = target->getDrawState().getViewMatrix();
635 GrDrawTarget::AutoStateRestore asr; 637 GrDrawTarget::AutoStateRestore asr;
636 if (!asr.setIdentity(target, GrDrawTarget::kPreserve_ASRInit)) { 638 if (!asr.setIdentity(target, GrDrawTarget::kPreserve_ASRInit)) {
637 return false; 639 return false;
638 } 640 }
639 GrDrawState* drawState = target->drawState(); 641 GrDrawState* drawState = target->drawState();
640 642
641 // We use the fact that SkPath::transform path does subdivision based on 643 // We use the fact that SkPath::transform path does subdivision based on
642 // perspective. Otherwise, we apply the view matrix when copying to the 644 // perspective. Otherwise, we apply the view matrix when copying to the
643 // segment representation. 645 // segment representation.
644 SkPath tmpPath; 646 SkPath tmpPath;
645 if (viewMatrix.hasPerspective()) { 647 if (viewMatrix.hasPerspective()) {
646 this->path().transform(viewMatrix, &tmpPath); 648 origPath.transform(viewMatrix, &tmpPath);
647 path = &tmpPath; 649 path = &tmpPath;
648 viewMatrix = SkMatrix::I(); 650 viewMatrix = SkMatrix::I();
649 } 651 }
650 652
651 QuadVertex *verts; 653 QuadVertex *verts;
652 uint16_t* idxs; 654 uint16_t* idxs;
653 655
654 int vCount; 656 int vCount;
655 int iCount; 657 int iCount;
656 enum { 658 enum {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 vOffset, // start vertex 708 vOffset, // start vertex
707 0, // start index 709 0, // start index
708 draw.fVertexCnt, 710 draw.fVertexCnt,
709 draw.fIndexCnt, 711 draw.fIndexCnt,
710 &devBounds); 712 &devBounds);
711 vOffset += draw.fVertexCnt; 713 vOffset += draw.fVertexCnt;
712 } 714 }
713 715
714 return true; 716 return true;
715 } 717 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.h ('k') | src/gpu/GrAAHairLinePathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698