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
This commit is contained in:
parent
6093e65829
commit
90bf427001
@ -48,6 +48,8 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SkMatrix fMatrix, fInverse;
|
SkMatrix fMatrix, fInverse;
|
||||||
|
bool fMatrixIsInvertible;
|
||||||
|
|
||||||
// illegal
|
// illegal
|
||||||
Sk2DPathEffect(const Sk2DPathEffect&);
|
Sk2DPathEffect(const Sk2DPathEffect&);
|
||||||
Sk2DPathEffect& operator=(const Sk2DPathEffect&);
|
Sk2DPathEffect& operator=(const Sk2DPathEffect&);
|
||||||
|
@ -1365,12 +1365,10 @@ void SkCanvas::setExternalMatrix(const SkMatrix* matrix) {
|
|||||||
}
|
}
|
||||||
fUseExternalMatrix = false;
|
fUseExternalMatrix = false;
|
||||||
} else {
|
} else {
|
||||||
fUseExternalMatrix = true;
|
if (matrix->invert(&fExternalInverse)) {
|
||||||
fDeviceCMDirty = true; // |= (fExternalMatrix != *matrix)
|
fExternalMatrix = *matrix;
|
||||||
|
fUseExternalMatrix = true;
|
||||||
fExternalMatrix = *matrix;
|
fDeviceCMDirty = true; // |= (fExternalMatrix != *matrix)
|
||||||
if (!matrix->invert(&fExternalInverse)) {
|
|
||||||
fExternalInverse.reset();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,14 @@ private:
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Sk2DPathEffect::Sk2DPathEffect(const SkMatrix& mat) : fMatrix(mat) {
|
Sk2DPathEffect::Sk2DPathEffect(const SkMatrix& mat) : fMatrix(mat) {
|
||||||
if (!mat.invert(&fInverse)) {
|
fMatrixIsInvertible = mat.invert(&fInverse);
|
||||||
fInverse.reset();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sk2DPathEffect::filterPath(SkPath* dst, const SkPath& src, SkScalar* width) {
|
bool Sk2DPathEffect::filterPath(SkPath* dst, const SkPath& src, SkScalar* width) {
|
||||||
|
if (!fMatrixIsInvertible) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Sk2DPathEffectBlitter blitter(this, dst);
|
Sk2DPathEffectBlitter blitter(this, dst);
|
||||||
SkPath tmp;
|
SkPath tmp;
|
||||||
SkIRect ir;
|
SkIRect ir;
|
||||||
@ -49,6 +51,10 @@ bool Sk2DPathEffect::filterPath(SkPath* dst, const SkPath& src, SkScalar* width)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Sk2DPathEffect::nextSpan(int x, int y, int count, SkPath* path) {
|
void Sk2DPathEffect::nextSpan(int x, int y, int count, SkPath* path) {
|
||||||
|
if (!fMatrixIsInvertible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const SkMatrix& mat = this->getMatrix();
|
const SkMatrix& mat = this->getMatrix();
|
||||||
SkPoint src, dst;
|
SkPoint src, dst;
|
||||||
|
|
||||||
@ -80,9 +86,7 @@ Sk2DPathEffect::Sk2DPathEffect(SkFlattenableReadBuffer& buffer) {
|
|||||||
SkASSERT(size <= sizeof(storage));
|
SkASSERT(size <= sizeof(storage));
|
||||||
buffer.read(storage, size);
|
buffer.read(storage, size);
|
||||||
fMatrix.unflatten(storage);
|
fMatrix.unflatten(storage);
|
||||||
if (!fMatrix.invert(&fInverse)) {
|
fMatrixIsInvertible = fMatrix.invert(&fInverse);
|
||||||
fInverse.reset();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user