fix quickReject() to handle perspective correctly (i.e. transform forward into

dst-space, and perform the clip-test there).



git-svn-id: http://skia.googlecode.com/svn/trunk@274 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2009-07-21 01:17:02 +00:00
Родитель aa9152abbc
Коммит a380ae4a9a
1 изменённых файлов: 20 добавлений и 12 удалений

Просмотреть файл

@ -893,20 +893,28 @@ bool SkCanvas::quickReject(const SkRect& rect, EdgeType) const {
return true;
}
const SkRectCompareType& clipR = this->getLocalClipBoundsCompareType();
if (fMCRec->fMatrix->getType() & SkMatrix::kPerspective_Mask) {
SkRect dst;
fMCRec->fMatrix->mapRect(&dst, rect);
SkIRect idst;
dst.roundOut(&idst);
return !SkIRect::Intersects(idst, fMCRec->fRegion->getBounds());
} else {
const SkRectCompareType& clipR = this->getLocalClipBoundsCompareType();
// for speed, do the most likely reject compares first
SkScalarCompareType userT = SkScalarToCompareType(rect.fTop);
SkScalarCompareType userB = SkScalarToCompareType(rect.fBottom);
if (userT >= clipR.fBottom || userB <= clipR.fTop) {
return true;
// for speed, do the most likely reject compares first
SkScalarCompareType userT = SkScalarToCompareType(rect.fTop);
SkScalarCompareType userB = SkScalarToCompareType(rect.fBottom);
if (userT >= clipR.fBottom || userB <= clipR.fTop) {
return true;
}
SkScalarCompareType userL = SkScalarToCompareType(rect.fLeft);
SkScalarCompareType userR = SkScalarToCompareType(rect.fRight);
if (userL >= clipR.fRight || userR <= clipR.fLeft) {
return true;
}
return false;
}
SkScalarCompareType userL = SkScalarToCompareType(rect.fLeft);
SkScalarCompareType userR = SkScalarToCompareType(rect.fRight);
if (userL >= clipR.fRight || userR <= clipR.fLeft) {
return true;
}
return false;
}
bool SkCanvas::quickReject(const SkPath& path, EdgeType et) const {