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

Side by Side Diff: src/core/SkGeometry.h

Issue 1612543003: replace arcto quads with a conic (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 | « samplecode/SampleQuadStroker.cpp ('k') | src/core/SkGeometry.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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 SkGeometry_DEFINED 8 #ifndef SkGeometry_DEFINED
9 #define SkGeometry_DEFINED 9 #define SkGeometry_DEFINED
10 10
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 */ 187 */
188 SkCubicType SkClassifyCubic(const SkPoint p[4], SkScalar inflection[3]); 188 SkCubicType SkClassifyCubic(const SkPoint p[4], SkScalar inflection[3]);
189 189
190 /////////////////////////////////////////////////////////////////////////////// 190 ///////////////////////////////////////////////////////////////////////////////
191 191
192 enum SkRotationDirection { 192 enum SkRotationDirection {
193 kCW_SkRotationDirection, 193 kCW_SkRotationDirection,
194 kCCW_SkRotationDirection 194 kCCW_SkRotationDirection
195 }; 195 };
196 196
197 #ifdef SK_SUPPORT_LEGACY_ARCTO
197 /** Maximum number of points needed in the quadPoints[] parameter for 198 /** Maximum number of points needed in the quadPoints[] parameter for
198 SkBuildQuadArc() 199 SkBuildQuadArc()
199 */ 200 */
200 #define kSkBuildQuadArcStorage 17 201 #define kSkBuildQuadArcStorage 17
201 202
202 /** Given 2 unit vectors and a rotation direction, fill out the specified 203 /** Given 2 unit vectors and a rotation direction, fill out the specified
203 array of points with quadratic segments. Return is the number of points 204 array of points with quadratic segments. Return is the number of points
204 written to, which will be { 0, 3, 5, 7, ... kSkBuildQuadArcStorage } 205 written to, which will be { 0, 3, 5, 7, ... kSkBuildQuadArcStorage }
205 206
206 matrix, if not null, is appled to the points before they are returned. 207 matrix, if not null, is appled to the points before they are returned.
207 */ 208 */
208 int SkBuildQuadArc(const SkVector& unitStart, const SkVector& unitStop, 209 int SkBuildQuadArc(const SkVector& unitStart, const SkVector& unitStop,
209 SkRotationDirection, const SkMatrix*, SkPoint quadPoints[]); 210 SkRotationDirection, const SkMatrix*, SkPoint quadPoints[]);
211 #endif
210 212
211 struct SkConic { 213 struct SkConic {
212 SkConic() {} 214 SkConic() {}
213 SkConic(const SkPoint& p0, const SkPoint& p1, const SkPoint& p2, SkScalar w) { 215 SkConic(const SkPoint& p0, const SkPoint& p1, const SkPoint& p2, SkScalar w) {
214 fPts[0] = p0; 216 fPts[0] = p0;
215 fPts[1] = p1; 217 fPts[1] = p1;
216 fPts[2] = p2; 218 fPts[2] = p2;
217 fW = w; 219 fW = w;
218 } 220 }
219 SkConic(const SkPoint pts[3], SkScalar w) { 221 SkConic(const SkPoint pts[3], SkScalar w) {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 private: 431 private:
430 enum { 432 enum {
431 kQuadCount = 8, // should handle most conics 433 kQuadCount = 8, // should handle most conics
432 kPointCount = 1 + 2 * kQuadCount, 434 kPointCount = 1 + 2 * kQuadCount,
433 }; 435 };
434 SkAutoSTMalloc<kPointCount, SkPoint> fStorage; 436 SkAutoSTMalloc<kPointCount, SkPoint> fStorage;
435 int fQuadCount; // #quads for current usage 437 int fQuadCount; // #quads for current usage
436 }; 438 };
437 439
438 #endif 440 #endif
OLDNEW
« no previous file with comments | « samplecode/SampleQuadStroker.cpp ('k') | src/core/SkGeometry.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698