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

Side by Side Diff: src/pathops/SkOpAngle.h

Issue 13094010: Add implementation of path ops (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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/pathops/SkIntersectionHelper.cpp ('k') | src/pathops/SkOpAngle.cpp » ('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 2012 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 #ifndef SkOpAngle_DEFINED
8 #define SkOpAngle_DEFINED
9
10 #include "SkLineParameters.h"
11 #include "SkPathOpsCubic.h"
12 #include "SkOpSpan.h"
13 #include "SkPath.h"
14 #include "SkTDArray.h"
15
16 // sorting angles
17 // given angles of {dx dy ddx ddy dddx dddy} sort them
18 class SkOpAngle {
19 public:
20 bool operator<(const SkOpAngle& rh) const;
21 double dx() const {
22 return fTangent1.dx();
23 }
24
25 double dy() const {
26 return fTangent1.dy();
27 }
28
29 int end() const {
30 return fEnd;
31 }
32
33 bool isHorizontal() const {
34 return dy() == 0 && fVerb == SkPath::kLine_Verb;
35 }
36
37 bool lengthen();
38 bool reverseLengthen();
39 void set(const SkPoint* orig, SkPath::Verb verb, const SkOpSegment* segment,
40 int start, int end, const SkTDArray<SkOpSpan>& spans);
41
42 void setSpans();
43 SkOpSegment* segment() const {
44 return const_cast<SkOpSegment*>(fSegment);
45 }
46
47 int sign() const {
48 return SkSign32(fStart - fEnd);
49 }
50
51 const SkTDArray<SkOpSpan>* spans() const {
52 return fSpans;
53 }
54
55 int start() const {
56 return fStart;
57 }
58
59 bool unsortable() const {
60 return fUnsortable;
61 }
62
63 #if DEBUG_ANGLE
64 const SkPoint* pts() const {
65 return fPts;
66 }
67
68 SkPath::Verb verb() const {
69 return fVerb;
70 }
71
72 void debugShow(const SkPoint& a) const {
73 SkDebugf(" d=(%1.9g,%1.9g) side=%1.9g\n", dx(), dy(), fSide);
74 }
75 #endif
76
77 private:
78 const SkPoint* fPts;
79 SkDCubic fCurvePart;
80 SkPath::Verb fVerb;
81 double fSide;
82 SkLineParameters fTangent1;
83 const SkTDArray<SkOpSpan>* fSpans;
84 const SkOpSegment* fSegment;
85 int fStart;
86 int fEnd;
87 bool fReversed;
88 mutable bool fUnsortable; // this alone is editable by the less than operato r
89 };
90
91 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkIntersectionHelper.cpp ('k') | src/pathops/SkOpAngle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698