// for that we'll transform (0,1) and (1,0), and check that the resulting dot-prod
// is nearly one
static bool map_radius(const SkMatrix& matrix, SkScalar* value) {
- if (matrix.getType() & SkMatrix::kPerspective_Mask) {
+ if (matrix.hasPerspective()) {
return false;
}
SkVector src[2], dst[2];
}
if (/*paint.isLinearText() ||*/
- (fMatrix->getType() & SkMatrix::kPerspective_Mask)) {
+ (fMatrix->hasPerspective())) {
this->drawText_asPaths(text, byteLength, x, y, paint);
handle_aftertext(this, paint, underlineWidth, underlineStart);
return;
}
if (/*paint.isLinearText() ||*/
- (fMatrix->getType() & SkMatrix::kPerspective_Mask)) {
+ (fMatrix->hasPerspective())) {
// TODO !!!!
// this->drawText_asPaths(text, byteLength, x, y, paint);
return;
this->setTypeMask(kIdentity_Mask | kRectStaysRect_Mask);
}
-static inline int has_perspective(const SkMatrix& matrix) {
- return matrix.getType() & SkMatrix::kPerspective_Mask;
-}
-
// this guy aligns with the masks, so we can compute a mask from a varaible 0/1
enum {
kTranslate_Shift,
}
bool SkMatrix::preTranslate(SkScalar dx, SkScalar dy) {
- if (has_perspective(*this)) {
+ if (this->hasPerspective()) {
SkMatrix m;
m.setTranslate(dx, dy);
return this->preConcat(m);
}
bool SkMatrix::postTranslate(SkScalar dx, SkScalar dy) {
- if (has_perspective(*this)) {
+ if (this->hasPerspective()) {
SkMatrix m;
m.setTranslate(dx, dy);
return this->postConcat(m);
SkMatrix identity;
const SkMatrix* use = this;
bool ret = true;
- if (has_perspective(*this)) {
+ if (this->hasPerspective()) {
identity.reset();
use = &identity;
ret = false;
}
bool SkMatrix::invert(SkMatrix* inv) const {
- int isPersp = has_perspective(*this);
+ int isPersp = this->hasPerspective();
int shift;
SkDetScalar scale = sk_inv_determinant(fMat, isPersp, &shift);
void SkMatrix::RotTrans_pts(const SkMatrix& m, SkPoint dst[],
const SkPoint src[], int count) {
- SkASSERT((m.getType() & kPerspective_Mask) == 0);
+ SkASSERT(!m.hasPerspective());
if (count > 0) {
SkScalar mx = m.fMat[kMScaleX];
void SkMatrix::Persp_pts(const SkMatrix& m, SkPoint dst[],
const SkPoint src[], int count) {
- SkASSERT(m.getType() & kPerspective_Mask);
+ SkASSERT(m.hasPerspective());
#ifdef SK_SCALAR_IS_FIXED
SkFixed persp2 = SkFractToFixed(m.fMat[kMPersp2]);
///////////////////////////////////////////////////////////////////////////////
void SkMatrix::mapVectors(SkPoint dst[], const SkPoint src[], int count) const {
- if (this->getType() & kPerspective_Mask) {
+ if (this->hasPerspective()) {
SkPoint origin;
MapXYProc proc = this->getMapXYProc();
void SkMatrix::Persp_xy(const SkMatrix& m, SkScalar sx, SkScalar sy,
SkPoint* pt) {
- SkASSERT(m.getType() & kPerspective_Mask);
+ SkASSERT(m.hasPerspective());
SkScalar x = SkScalarMul(sx, m.fMat[kMScaleX]) +
SkScalarMul(sy, m.fMat[kMSkewX]) + m.fMat[kMTransX];