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

Unified Diff: src/pathops/SkPathOpsLine.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 side-by-side diff with in-line comments
Download patch
Index: src/pathops/SkPathOpsLine.h
===================================================================
--- src/pathops/SkPathOpsLine.h (revision 0)
+++ src/pathops/SkPathOpsLine.h (revision 0)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef SkPathOpsLine_DEFINED
+#define SkPathOpsLine_DEFINED
+
+#include "SkPathOpsPoint.h"
+
+struct SkDLine {
+ SkDPoint fPts[2];
+
+ void set(const SkPoint pts[2]) {
+ fPts[0] = pts[0];
+ fPts[1] = pts[1];
+ }
+
+ const SkDPoint& operator[](int n) const { return fPts[n]; }
+ SkDPoint& operator[](int n) { return fPts[n]; }
+
+// bool implicitLine(double* slope, double* axisIntercept) const; // uncalled
+// int reduceOrder(SkDLine* reduced) const; // uncalled
+ double isLeft(const SkDPoint& pt) const;
+ SkDLine subDivide(double t1, double t2) const;
+ static SkDLine SubDivide(const SkPoint a[2], double t1, double t2) {
+ SkDLine line;
+ line.set(a);
+ return line.subDivide(t1, t2);
+ }
+// double tAt(const SkDPoint& ) const; // uncalled
+ SkDPoint xyAtT(double t) const;
+private:
+ SkDVector tangent() const { return fPts[0] - fPts[1]; }
+};
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698