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

Side by Side Diff: include/core/SkPathIter.h

Issue 1126993003: experimental path-builder Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « include/core/SkPathBuilder.h ('k') | include/core/SkPathTypes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkPathIter_DEFINED
9 #define SkPathIter_DEFINED
10
11 #include "SkPathTypes.h"
12 #include "SkPoint.h"
13
14 class SkPath;
15
16 class SkPathIter {
17 public:
18 SkPathIter(const SkPoint pts[], const uint8_t verbs[], const SkScalar conicW [], int count)
19 : fCurrPts(pts)
20 , fNextPts(pts + 1)
21 , fConicW(conicW)
22 , fVerbs(verbs)
23 , fStopVerbs(verbs - count)
24 , fPrevPtsPerVerb(0)
25 {
26 if (count > 0) {
27 SkASSERT(kMove_SkPathVerb == verbs[-1]);
28 }
29 }
30
31 SkPathIter(const SkPath&);
32
33 bool done() const { return fStopVerbs == fVerbs; }
34 SkPathVerb currVerb() const { return (SkPathVerb)fVerbs[0]; }
35 const SkPoint* currPts() const { return fCurrPts; }
36 SkScalar currConicW() const { return *fConicW; }
37
38 #if 0
39 bool next() {
40 if (fStopVerbs == fVerbs) {
41 return false;
42 }
43
44 static const uint8_t gPtsPerVerb[] = {
45 1, // Move
46 1, // Line
47 2, // Quad
48 2, // Conic
49 3, // Cubic
50 0, // Close
51 };
52
53 fCurrPts += fPrevPtsPerVerb;
54 SkPathVerb verb = (SkPathVerb)(*--fVerbs);
55 fNextPts += (fPrevPtsPerVerb = gPtsPerVerb[verb]);
56 fConicW += (kConic_SkPathVerb == verb);
57 return true;
58 }
59 #else
60 bool next();
61 #endif
62
63 private:
64 const SkPoint* fCurrPts;
65 const SkPoint* fNextPts;
66 const SkScalar* fConicW;
67 const uint8_t* fVerbs;
68 const uint8_t* fStopVerbs;
69 int fPrevPtsPerVerb;
70 };
71
72 #endif
OLDNEW
« no previous file with comments | « include/core/SkPathBuilder.h ('k') | include/core/SkPathTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698