SkMatrix inverse;
drawingSize.set(SkIntToScalar(contentSize.fWidth),
SkIntToScalar(contentSize.fHeight));
- initialTransform->invert(&inverse);
+ if (!initialTransform->invert(&inverse)) {
+ inverse.reset();
+ }
inverse.mapVectors(&drawingSize, 1);
SkISize size = SkSize::Make(drawingSize.fX, drawingSize.fY).toRound();
bitmap.setConfig(SkBitmap::kNo_Config, abs(size.fWidth),
SkMatrix totalTransform = fInitialTransform;
totalTransform.preConcat(contentEntry->fState.fMatrix);
SkMatrix inverse;
- inverse.reset();
- totalTransform.invert(&inverse);
+ if (!totalTransform.invert(&inverse)) {
+ inverse.reset();
+ }
inverse.mapRect(&bbox);
SkPDFUtils::AppendRectangle(bbox, &contentEntry->fContent);
// embedded in things like shaders and images.
if (!device->initialTransform().isIdentity()) {
SkMatrix inverse;
- inverse.reset();
- device->initialTransform().invert(&inverse);
+ if (!device->initialTransform().invert(&inverse)) {
+ inverse.reset();
+ }
insert("Matrix", SkPDFUtils::MatrixToArray(inverse))->unref();
}
static void transformBBox(const SkMatrix& matrix, SkRect* bbox) {
SkMatrix inverse;
- inverse.reset();
- matrix.invert(&inverse);
+ if (!matrix.invert(&inverse)) {
+ inverse.reset();
+ }
inverse.mapRect(bbox);
}
if (fState.get()->fType == SkShader::kRadial2_GradientType) {
SkShader::GradientInfo twoPointRadialInfo = *info;
SkMatrix inverseMapperMatrix;
- mapperMatrix.invert(&inverseMapperMatrix);
+ if (!mapperMatrix.invert(&inverseMapperMatrix)) {
+ inverseMapperMatrix.reset();
+ }
inverseMapperMatrix.mapPoints(twoPointRadialInfo.fPoint, 2);
twoPointRadialInfo.fRadius[0] =
inverseMapperMatrix.mapRadius(info->fRadius[0]);