/** * Our antialiasing currently has a granularity of 1/4 of a pixel along each * axis. Thus we can treat an axis coordinate as an integer if it differs * from its nearest int by < half of that value (1/8 in this case).
*/ staticbool nearly_integral(SkScalar x) { staticconst SkScalar domain = SK_Scalar1 / 4; staticconst SkScalar halfDomain = domain / 2;
x += halfDomain; return x - SkScalarFloorToScalar(x) < domain;
}
SkRect devRect = matrix.mapRect(localRect); if (fIsBW && doAA) { // check that the rect really needs aa, or is it close enought to // integer boundaries that we can just treat it as a BW rect? if (nearly_integral(devRect.fLeft) && nearly_integral(devRect.fTop) &&
nearly_integral(devRect.fRight) && nearly_integral(devRect.fBottom)) {
doAA = false;
}
}
// Since op is either intersect or difference, the clip is always shrinking; that means we can // always use our current bounds as the limiting factor for region/aaclip operations. if (this->isRect() && op == SkClipOp::kIntersect) { // However, in the relatively common case of intersecting a new path with a rectangular // clip, it's faster to convert the path into a region/aa-mask in place than evaluate the // actual intersection. See skbug.com/12398 if (doAA && fIsBW) {
this->convertToAA();
} if (fIsBW) {
fBW.setPath(devPath, SkRegion(this->getBounds()));
} else {
fAA.setPath(devPath, this->getBounds(), doAA);
} return this->updateCacheAndReturnNonEmpty();
} else { return this->op(SkRasterClip(devPath, this->getBounds(), doAA), op);
}
}
// since we are being explicitly asked to convert-to-aa, we pass false so we don't "optimize" // ourselves back to BW.
(void)this->updateCacheAndReturnNonEmpty(false);
}
#ifdef SK_DEBUG void SkRasterClip::validate() const { // can't ever assert that fBW is empty, since we may have called forceGetBW if (fIsBW) {
SkASSERT(fAA.isEmpty());
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.