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

Side by Side Diff: src/gpu/GrAAHairLinePathRenderer.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/GrAAHairLinePathRenderer.h ('k') | src/gpu/GrClipMaskManager.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 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrAAHairLinePathRenderer.h" 8 #include "GrAAHairLinePathRenderer.h"
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 add_quads(&quads[3*i], qSubdivs[i], toDevice, toSrc, &verts, devBounds); 819 add_quads(&quads[3*i], qSubdivs[i], toDevice, toSrc, &verts, devBounds);
820 } 820 }
821 821
822 // Start Conics 822 // Start Conics
823 for (int i = 0; i < conicCnt; ++i) { 823 for (int i = 0; i < conicCnt; ++i) {
824 add_conics(&conics[3*i], cWeights[i], toDevice, toSrc, &verts, devBounds ); 824 add_conics(&conics[3*i], cWeights[i], toDevice, toSrc, &verts, devBounds );
825 } 825 }
826 return true; 826 return true;
827 } 827 }
828 828
829 bool GrAAHairLinePathRenderer::canDrawPath(const SkStrokeRec& stroke, 829 bool GrAAHairLinePathRenderer::canDrawPath(const SkPath& path,
830 const SkStrokeRec& stroke,
830 const GrDrawTarget* target, 831 const GrDrawTarget* target,
831 bool antiAlias) const { 832 bool antiAlias) const {
832 if (!antiAlias) { 833 if (!antiAlias) {
833 return false; 834 return false;
834 } 835 }
835 836
836 if (!IsStrokeHairlineOrEquivalent(stroke, 837 if (!IsStrokeHairlineOrEquivalent(stroke,
837 target->getDrawState().getViewMatrix(), 838 target->getDrawState().getViewMatrix(),
838 NULL)) { 839 NULL)) {
839 return false; 840 return false;
840 } 841 }
841 842
842 if (SkPath::kLine_SegmentMask == this->path().getSegmentMasks() || 843 if (SkPath::kLine_SegmentMask == path.getSegmentMasks() ||
843 target->caps()->shaderDerivativeSupport()) { 844 target->caps()->shaderDerivativeSupport()) {
844 return true; 845 return true;
845 } 846 }
846 return false; 847 return false;
847 } 848 }
848 849
849 template <class VertexType> 850 template <class VertexType>
850 bool check_bounds(GrDrawState* drawState, const SkRect& devBounds, void* vertice s, int vCount) 851 bool check_bounds(GrDrawState* drawState, const SkRect& devBounds, void* vertice s, int vCount)
851 { 852 {
852 SkRect tolDevBounds = devBounds; 853 SkRect tolDevBounds = devBounds;
(...skipping 23 matching lines...) Expand all
876 actualBounds.growToInclude(pos.fX, pos.fY); 877 actualBounds.growToInclude(pos.fX, pos.fY);
877 } 878 }
878 } 879 }
879 if (!first) { 880 if (!first) {
880 return tolDevBounds.contains(actualBounds); 881 return tolDevBounds.contains(actualBounds);
881 } 882 }
882 883
883 return true; 884 return true;
884 } 885 }
885 886
886 bool GrAAHairLinePathRenderer::onDrawPath(const SkStrokeRec& stroke, 887 bool GrAAHairLinePathRenderer::onDrawPath(const SkPath& path,
888 const SkStrokeRec& stroke,
887 GrDrawTarget* target, 889 GrDrawTarget* target,
888 bool antiAlias) { 890 bool antiAlias) {
889 GrDrawState* drawState = target->drawState(); 891 GrDrawState* drawState = target->drawState();
890 892
891 SkScalar hairlineCoverage; 893 SkScalar hairlineCoverage;
892 if (IsStrokeHairlineOrEquivalent(stroke, 894 if (IsStrokeHairlineOrEquivalent(stroke,
893 target->getDrawState().getViewMatrix(), 895 target->getDrawState().getViewMatrix(),
894 &hairlineCoverage)) { 896 &hairlineCoverage)) {
895 uint8_t newCoverage = SkScalarRoundToInt(hairlineCoverage * 897 uint8_t newCoverage = SkScalarRoundToInt(hairlineCoverage *
896 target->getDrawState().getCover age()); 898 target->getDrawState().getCover age());
897 target->drawState()->setCoverage(newCoverage); 899 target->drawState()->setCoverage(newCoverage);
898 } 900 }
899 901
900 SkIRect devClipBounds; 902 SkIRect devClipBounds;
901 target->getClip()->getConservativeBounds(drawState->getRenderTarget(), &devC lipBounds); 903 target->getClip()->getConservativeBounds(drawState->getRenderTarget(), &devC lipBounds);
902 904
903 int lineCnt; 905 int lineCnt;
904 int quadCnt; 906 int quadCnt;
905 int conicCnt; 907 int conicCnt;
906 PREALLOC_PTARRAY(128) lines; 908 PREALLOC_PTARRAY(128) lines;
907 PREALLOC_PTARRAY(128) quads; 909 PREALLOC_PTARRAY(128) quads;
908 PREALLOC_PTARRAY(128) conics; 910 PREALLOC_PTARRAY(128) conics;
909 IntArray qSubdivs; 911 IntArray qSubdivs;
910 FloatArray cWeights; 912 FloatArray cWeights;
911 quadCnt = generate_lines_and_quads(this->path(), drawState->getViewMatrix(), devClipBounds, 913 quadCnt = generate_lines_and_quads(path, drawState->getViewMatrix(), devClip Bounds,
912 &lines, &quads, &conics, &qSubdivs, &cWei ghts); 914 &lines, &quads, &conics, &qSubdivs, &cWei ghts);
913 lineCnt = lines.count() / 2; 915 lineCnt = lines.count() / 2;
914 conicCnt = conics.count() / 3; 916 conicCnt = conics.count() / 3;
915 917
916 // do lines first 918 // do lines first
917 if (lineCnt) { 919 if (lineCnt) {
918 GrDrawTarget::AutoReleaseGeometry arg; 920 GrDrawTarget::AutoReleaseGeometry arg;
919 SkRect devBounds; 921 SkRect devBounds;
920 922
921 if (!this->createLineGeom(this->path(), 923 if (!this->createLineGeom(path,
922 target, 924 target,
923 lines, 925 lines,
924 lineCnt, 926 lineCnt,
925 &arg, 927 &arg,
926 &devBounds)) { 928 &devBounds)) {
927 return false; 929 return false;
928 } 930 }
929 931
930 GrDrawTarget::AutoStateRestore asr; 932 GrDrawTarget::AutoStateRestore asr;
931 933
(...skipping 25 matching lines...) Expand all
957 lines += n; 959 lines += n;
958 } 960 }
959 } 961 }
960 } 962 }
961 963
962 // then quadratics/conics 964 // then quadratics/conics
963 if (quadCnt || conicCnt) { 965 if (quadCnt || conicCnt) {
964 GrDrawTarget::AutoReleaseGeometry arg; 966 GrDrawTarget::AutoReleaseGeometry arg;
965 SkRect devBounds; 967 SkRect devBounds;
966 968
967 if (!this->createBezierGeom(this->path(), 969 if (!this->createBezierGeom(path,
968 target, 970 target,
969 quads, 971 quads,
970 quadCnt, 972 quadCnt,
971 conics, 973 conics,
972 conicCnt, 974 conicCnt,
973 qSubdivs, 975 qSubdivs,
974 cWeights, 976 cWeights,
975 &arg, 977 &arg,
976 &devBounds)) { 978 &devBounds)) {
977 return false; 979 return false;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 &devBounds); 1033 &devBounds);
1032 conics += n; 1034 conics += n;
1033 } 1035 }
1034 } 1036 }
1035 } 1037 }
1036 1038
1037 target->resetIndexSource(); 1039 target->resetIndexSource();
1038 1040
1039 return true; 1041 return true;
1040 } 1042 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.h ('k') | src/gpu/GrClipMaskManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698