proper handling if SkMatrix::invert failes, addresses hack fix in rev. 3657
git-svn-id: http://skia.googlecode.com/svn/trunk@3679 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/effects/Sk2DPathEffect.cpp b/src/effects/Sk2DPathEffect.cpp
index dd067be..8693157 100644
--- a/src/effects/Sk2DPathEffect.cpp
+++ b/src/effects/Sk2DPathEffect.cpp
@@ -28,12 +28,14 @@
///////////////////////////////////////////////////////////////////////////////
Sk2DPathEffect::Sk2DPathEffect(const SkMatrix& mat) : fMatrix(mat) {
- if (!mat.invert(&fInverse)) {
- fInverse.reset();
- }
+ fMatrixIsInvertible = mat.invert(&fInverse);
}
bool Sk2DPathEffect::filterPath(SkPath* dst, const SkPath& src, SkScalar* width) {
+ if (!fMatrixIsInvertible) {
+ return false;
+ }
+
Sk2DPathEffectBlitter blitter(this, dst);
SkPath tmp;
SkIRect ir;
@@ -49,6 +51,10 @@
}
void Sk2DPathEffect::nextSpan(int x, int y, int count, SkPath* path) {
+ if (!fMatrixIsInvertible) {
+ return;
+ }
+
const SkMatrix& mat = this->getMatrix();
SkPoint src, dst;
@@ -80,9 +86,7 @@
SkASSERT(size <= sizeof(storage));
buffer.read(storage, size);
fMatrix.unflatten(storage);
- if (!fMatrix.invert(&fInverse)) {
- fInverse.reset();
- }
+ fMatrixIsInvertible = fMatrix.invert(&fInverse);
}
///////////////////////////////////////////////////////////////////////////////