aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-17 02:25:33 +0000
committerGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-17 02:25:33 +0000
commit5c082a14acbb70eec2fd6dc5a4c134799f3d8535 (patch)
tree2103c6d41565d55f1669ab3eeec1c24734b235e6 /src
parent0c5c3867bdbde1005a7bbb9de9df93cc10e27782 (diff)
add compute-bounds for conics
git-svn-id: http://skia.googlecode.com/svn/trunk@8713 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/core/SkGeometry.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp
index cdea29aceb..4454065e0a 100644
--- a/src/core/SkGeometry.cpp
+++ b/src/core/SkGeometry.cpp
@@ -1635,3 +1635,22 @@ bool SkRationalQuad::chopAtYExtrema(SkRationalQuad dst[2]) const {
return false;
}
+void SkRationalQuad::computeTightBounds(SkRect* bounds) const {
+ SkPoint pts[4];
+ pts[0] = fPts[0];
+ pts[1] = fPts[2];
+ int count = 2;
+
+ SkScalar t;
+ if (this->findXExtrema(&t)) {
+ this->evalAt(t, &pts[count++]);
+ }
+ if (this->findYExtrema(&t)) {
+ this->evalAt(t, &pts[count++]);
+ }
+ bounds->set(pts, count);
+}
+
+void SkRationalQuad::computeFastBounds(SkRect* bounds) const {
+ bounds->set(fPts, 3);
+}