diff options
Diffstat (limited to 'src/core/SkMatrix.cpp')
-rw-r--r-- | src/core/SkMatrix.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp index 4845f59592..15d295cc27 100644 --- a/src/core/SkMatrix.cpp +++ b/src/core/SkMatrix.cpp @@ -1812,41 +1812,41 @@ bool SkTreatAsSprite(const SkMatrix& mat, const SkRect& src, if (mat.getType() & ~(SkMatrix::kScale_Mask | SkMatrix::kTranslate_Mask)) { return false; } - + // quick success check if (!subpixelBits && !(mat.getType() & ~SkMatrix::kTranslate_Mask)) { return true; } - + // mapRect supports negative scales, so we eliminate those first if (mat.getScaleX() < 0 || mat.getScaleY() < 0) { return false; } - + SkRect dst; SkIRect isrc, idst; - + mat.mapRect(&dst, src); - + { SkRect tmp = src; tmp.offset(mat.getTranslateX(), mat.getTranslateY()); tmp.round(&isrc); } - + if (subpixelBits) { isrc.fLeft <<= subpixelBits; isrc.fTop <<= subpixelBits; isrc.fRight <<= subpixelBits; isrc.fBottom <<= subpixelBits; - + const float scale = 1 << subpixelBits; dst.fLeft *= scale; dst.fTop *= scale; dst.fRight *= scale; dst.fBottom *= scale; } - + dst.round(&idst); return isrc == idst; } |