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

Unified Diff: src/pathops/SkPathOpsRect.cpp

Issue 1037953004: add conics to path ops (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: turn off pathops specific debuggging Created 5 years, 8 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 | « src/pathops/SkPathOpsRect.h ('k') | src/pathops/SkPathOpsSimplify.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkPathOpsRect.cpp
diff --git a/src/pathops/SkPathOpsRect.cpp b/src/pathops/SkPathOpsRect.cpp
index 5dd3d8def5d0c2d295408450d2d22aeb8f40bf48..540db16a0ee0d1f3a4ba89ed7d23000058e348ff 100644
--- a/src/pathops/SkPathOpsRect.cpp
+++ b/src/pathops/SkPathOpsRect.cpp
@@ -4,6 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkPathOpsConic.h"
#include "SkPathOpsCubic.h"
#include "SkPathOpsLine.h"
#include "SkPathOpsQuad.h"
@@ -25,6 +26,22 @@ void SkDRect::setBounds(const SkDQuad& quad) {
}
}
+void SkDRect::setBounds(const SkDConic& conic) {
+ set(conic[0]);
+ add(conic[2]);
+ double tValues[2];
+ int roots = 0;
+ if (!between(conic[0].fX, conic[1].fX, conic[2].fX)) {
+ roots = SkDConic::FindExtrema(&conic[0].fX, conic.fWeight, tValues);
+ }
+ if (!between(conic[0].fY, conic[1].fY, conic[2].fY)) {
+ roots += SkDConic::FindExtrema(&conic[0].fY, conic.fWeight, &tValues[roots]);
+ }
+ for (int x = 0; x < roots; ++x) {
+ add(conic.ptAtT(tValues[x]));
+ }
+}
+
static bool is_bounded_by_end_points(double a, double b, double c, double d) {
return between(a, b, d) && between(a, c, d);
}
« no previous file with comments | « src/pathops/SkPathOpsRect.h ('k') | src/pathops/SkPathOpsSimplify.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698