Chromium Code Reviews| Index: src/core/SkMatrix.cpp |
| diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp |
| index 36e735309bb4739bf66ead50fd2571dd8af75cf3..0d1c6ac844b4bd77177226c0ea434ec826a870d3 100644 |
| --- a/src/core/SkMatrix.cpp |
| +++ b/src/core/SkMatrix.cpp |
| @@ -1227,6 +1227,44 @@ void SkMatrix::mapPoints(SkPoint dst[], const SkPoint src[], int count) const { |
| /////////////////////////////////////////////////////////////////////////////// |
| +void SkMatrix::Homogenous_pts(const SkMatrix& m, SkScalar dst[], |
| + const SkScalar src[], int count) { |
| + |
| + if (count > 0) { |
| + do { |
| + SkScalar sx = src[0]; |
| + SkScalar sy = src[1]; |
| + SkScalar sz = src[2]; |
|
bsalomon
2013/08/07 17:54:01
Can we call this sw?
|
| + src += 3; |
| + |
| + SkScalar x = SkScalarMul(sx, m.fMat[kMScaleX]) + |
| + SkScalarMul(sy, m.fMat[kMSkewX]) + |
| + SkScalarMul(sz, m.fMat[kMTransX]); |
| + SkScalar y = SkScalarMul(sx, m.fMat[kMSkewY]) + |
| + SkScalarMul(sy, m.fMat[kMScaleY]) + |
| + SkScalarMul(sz, m.fMat[kMTransY]); |
| + SkScalar z = SkScalarMul(sx, m.fMat[kMPersp0]) + |
|
bsalomon
2013/08/07 17:54:01
w?
|
| + SkScalarMul(sy, m.fMat[kMPersp1]) + |
| + SkScalarMul(sz, m.fMat[kMPersp2]); |
| + |
| + dst[0] = x; |
| + dst[1] = y; |
| + dst[2] = z; |
| + dst += 3; |
| + } while (--count); |
| + } |
| +} |
| + |
| +void SkMatrix::mapHomogenousPoints(SkScalar dst[], const SkScalar src[], int count) const { |
| + SkASSERT((dst && src && count > 0) || count == 0); |
| + // no partial overlap |
| + SkASSERT(src == dst || SkAbs32((int32_t)(src - dst)) >= 3*count); |
| + |
| + SkMatrix::Homogenous_pts(*this, dst, src, count); |
| +} |
| + |
| +/////////////////////////////////////////////////////////////////////////////// |
| + |
| void SkMatrix::mapVectors(SkPoint dst[], const SkPoint src[], int count) const { |
| if (this->hasPerspective()) { |
| SkPoint origin; |