add compute-bounds for conics
git-svn-id: http://skia.googlecode.com/svn/trunk@8713 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
0c5c3867bd
commit
5c082a14ac
@ -227,6 +227,9 @@ struct SkRationalQuad {
|
||||
bool findYExtrema(SkScalar* t) const;
|
||||
bool chopAtXExtrema(SkRationalQuad dst[2]) const;
|
||||
bool chopAtYExtrema(SkRationalQuad dst[2]) const;
|
||||
|
||||
void computeTightBounds(SkRect* bounds) const;
|
||||
void computeFastBounds(SkRect* bounds) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user