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

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

Issue 12827020: Add base types for 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
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
8 #ifndef SkPathOpsQuad_DEFINED
9 #define SkPathOpsQuad_DEFINED
10
11 #include "SkPathOpsPoint.h"
12
13 struct SkDQuadPair {
14 const SkDQuad& first() const { return (const SkDQuad&) pts[0]; }
15 const SkDQuad& second() const { return (const SkDQuad&) pts[2]; }
16 SkDPoint pts[5];
17 };
18
19 struct SkDQuad {
20 SkDPoint fPts[3];
21
22 void set(const SkPoint pts[3]) {
23 fPts[0] = pts[0];
24 fPts[1] = pts[1];
25 fPts[2] = pts[2];
26 }
27
28 const SkDPoint& operator[](int n) const { return fPts[n]; }
29 SkDPoint& operator[](int n) { return fPts[n]; }
30
31 static int AddValidTs(double s[], int realRoots, double* t);
32 SkDQuadPair chopAt(double t) const;
33 SkDVector dxdyAtT(double t) const;
34 static int FindExtrema(double a, double b, double c, double tValue[1]);
35 bool isLinear(int startIndex, int endIndex) const;
36 double nearestT(const SkDPoint&) const;
37 bool pointInHull(const SkDPoint&) const;
38 static int RootsReal(double A, double B, double C, double t[2]);
39 static int RootsValidT(const double A, const double B, const double C, doubl e s[2]);
40 static void SetABC(const double* quad, double* a, double* b, double* c);
41 SkDQuad subDivide(double t1, double t2) const;
42 static SkDQuad SubDivide(const SkPoint a[3], double t1, double t2) {
43 SkDQuad quad;
44 quad.set(a);
45 return quad.subDivide(t1, t2);
46 }
47 SkDPoint subDivide(const SkDPoint& a, const SkDPoint& c, double t1, double t 2) const;
48 static SkDPoint SubDivide(const SkPoint pts[3], const SkDPoint& a, const SkD Point& c,
49 double t1, double t2) {
50 SkDQuad quad;
51 quad.set(pts);
52 return quad.subDivide(a, c, t1, t2);
53 }
54 // SkDPoint tangent(double t) const; // uncalled
55 SkDCubic toCubic() const;
56 SkDPoint top(double startT, double endT) const;
57 SkDPoint xyAtT(double t) const;
58 private:
59 // static double Tangent(const double* quadratic, double t); // uncalled
60 };
61
62 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698