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); |
} |