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

Unified Diff: tests/PathOpsTestCommon.cpp

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/PathOpsTestCommon.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathOpsTestCommon.cpp
===================================================================
--- tests/PathOpsTestCommon.cpp (revision 0)
+++ tests/PathOpsTestCommon.cpp (revision 0)
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include "PathOpsTestCommon.h"
+#include "SkPathOpsCubic.h"
+
+void CubicToQuads(const SkDCubic& cubic, double precision, SkTDArray<SkDQuad>& quads) {
+ SkTDArray<double> ts;
+ cubic.toQuadraticTs(precision, &ts);
+ if (ts.count() <= 1) {
+ SkDQuad quad = cubic.toQuad();
+ *quads.append() = quad;
+ return;
+ }
+ double tStart = 0;
+ for (int i1 = 0; i1 <= ts.count(); ++i1) {
+ const double tEnd = i1 < ts.count() ? ts[i1] : 1;
+ SkDCubic part = cubic.subDivide(tStart, tEnd);
+ SkDQuad quad = part.toQuad();
+ *quads.append() = quad;
+ tStart = tEnd;
+ }
+}
+
« no previous file with comments | « tests/PathOpsTestCommon.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698