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

Side by Side Diff: src/gpu/GrAAConvexTessellator.h

Issue 1158803002: Added GrAAFlatteningConvexPathRenderer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebased Created 5 years, 6 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
« no previous file with comments | « gyp/gpu.gypi ('k') | src/gpu/GrAAConvexTessellator.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 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 #ifndef GrAAConvexTessellator_DEFINED 8 #ifndef GrAAConvexTessellator_DEFINED
9 #define GrAAConvexTessellator_DEFINED 9 #define GrAAConvexTessellator_DEFINED
10 10
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 }; 158 };
159 159
160 SkTDArray<PointData> fPts; 160 SkTDArray<PointData> fPts;
161 }; 161 };
162 162
163 bool movable(int index) const { return fMovable[index]; } 163 bool movable(int index) const { return fMovable[index]; }
164 164
165 // Movable points are those that can be slid along their bisector. 165 // Movable points are those that can be slid along their bisector.
166 // Basically, a point is immovable if it is part of the original 166 // Basically, a point is immovable if it is part of the original
167 // polygon or it results from the fusing of two bisectors. 167 // polygon or it results from the fusing of two bisectors.
168 int addPt(const SkPoint& pt, SkScalar depth, bool movable); 168 int addPt(const SkPoint& pt, SkScalar depth, bool movable, bool isCurve);
169 void popLastPt(); 169 void popLastPt();
170 void popFirstPtShuffle(); 170 void popFirstPtShuffle();
171 171
172 void updatePt(int index, const SkPoint& pt, SkScalar depth); 172 void updatePt(int index, const SkPoint& pt, SkScalar depth);
173 173
174 void addTri(int i0, int i1, int i2); 174 void addTri(int i0, int i1, int i2);
175 175
176 void reservePts(int count) { 176 void reservePts(int count) {
177 fPts.setReserve(count); 177 fPts.setReserve(count);
178 fDepths.setReserve(count); 178 fDepths.setReserve(count);
179 fMovable.setReserve(count); 179 fMovable.setReserve(count);
180 } 180 }
181 181
182 SkScalar computeDepthFromEdge(int edgeIdx, const SkPoint& p) const; 182 SkScalar computeDepthFromEdge(int edgeIdx, const SkPoint& p) const;
183 183
184 bool computePtAlongBisector(int startIdx, const SkPoint& bisector, 184 bool computePtAlongBisector(int startIdx, const SkPoint& bisector,
185 int edgeIdx, SkScalar desiredDepth, 185 int edgeIdx, SkScalar desiredDepth,
186 SkPoint* result) const; 186 SkPoint* result) const;
187 187
188 void lineTo(const SkMatrix& m, SkPoint p, bool isCurve);
189
190 void quadTo(const SkMatrix& m, SkPoint pts[3]);
191
192 void cubicTo(const SkMatrix& m, SkPoint pts[4]);
193
194 void conicTo(const SkMatrix& m, SkPoint pts[3], SkScalar w);
195
188 void terminate(const Ring& lastRing); 196 void terminate(const Ring& lastRing);
189 197
190 // return false on failure/degenerate path 198 // return false on failure/degenerate path
191 bool extractFromPath(const SkMatrix& m, const SkPath& path); 199 bool extractFromPath(const SkMatrix& m, const SkPath& path);
192 void computeBisectors(); 200 void computeBisectors();
193 201
194 void fanRing(const Ring& ring); 202 void fanRing(const Ring& ring);
195 void createOuterRing(); 203 void createOuterRing();
196 204
197 Ring* getNextRing(Ring* lastRing); 205 Ring* getNextRing(Ring* lastRing);
(...skipping 12 matching lines...) Expand all
210 SkTDArray<SkPoint> fPts; 218 SkTDArray<SkPoint> fPts;
211 SkTDArray<SkScalar> fDepths; 219 SkTDArray<SkScalar> fDepths;
212 // movable points are those that can be slid further along their bisector 220 // movable points are those that can be slid further along their bisector
213 SkTDArray<bool> fMovable; 221 SkTDArray<bool> fMovable;
214 222
215 // The outward facing normals for the original polygon 223 // The outward facing normals for the original polygon
216 SkTDArray<SkVector> fNorms; 224 SkTDArray<SkVector> fNorms;
217 // The inward facing bisector at each point in the original polygon. Only 225 // The inward facing bisector at each point in the original polygon. Only
218 // needed for exterior ring creation and then handed off to the initial ring . 226 // needed for exterior ring creation and then handed off to the initial ring .
219 SkTDArray<SkVector> fBisectors; 227 SkTDArray<SkVector> fBisectors;
228
229 // Tracks whether a given point is interior to a curve. Such points are
230 // assumed to have shallow curvature.
231 SkTDArray<bool> fIsCurve;
232
220 SkPoint::Side fSide; // winding of the original polygon 233 SkPoint::Side fSide; // winding of the original polygon
221 234
222 // The triangulation of the points 235 // The triangulation of the points
223 SkTDArray<int> fIndices; 236 SkTDArray<int> fIndices;
224 237
225 Ring fInitialRing; 238 Ring fInitialRing;
226 #if GR_AA_CONVEX_TESSELLATOR_VIZ 239 #if GR_AA_CONVEX_TESSELLATOR_VIZ
227 // When visualizing save all the rings 240 // When visualizing save all the rings
228 SkTDArray<Ring*> fRings; 241 SkTDArray<Ring*> fRings;
229 #else 242 #else
230 Ring fRings[2]; 243 Ring fRings[2];
231 #endif 244 #endif
232 CandidateVerts fCandidateVerts; 245 CandidateVerts fCandidateVerts;
233 246
234 SkScalar fTargetDepth; 247 SkScalar fTargetDepth;
235 248
249 SkTDArray<SkPoint> fPointBuffer;
250
236 // If some goes wrong with the inset computation the tessellator will 251 // If some goes wrong with the inset computation the tessellator will
237 // truncate the creation of the inset polygon. In this case the depth 252 // truncate the creation of the inset polygon. In this case the depth
238 // check will complain. 253 // check will complain.
239 SkDEBUGCODE(bool fShouldCheckDepths;) 254 SkDEBUGCODE(bool fShouldCheckDepths;)
255
256 SkDEBUGCODE(SkScalar fMinCross;)
257
258 SkDEBUGCODE(SkScalar fMaxCross;)
240 }; 259 };
241 260
242 261
243 #endif 262 #endif
244 263
OLDNEW
« no previous file with comments | « gyp/gpu.gypi ('k') | src/gpu/GrAAConvexTessellator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698