Don't draw device-independent ellipses with degenerate matrix

Bug: oss-fuzz:9012
Change-Id: I93242447e20d0dda7740a31ad330e0fccdb56fc8
Reviewed-on: https://skia-review.googlesource.com/156800
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Jim Van Verth 2018-09-25 10:49:52 -04:00 committed by Skia Commit-Bot
parent d892a9d0b3
commit a925bb07ad

View File

@ -3196,7 +3196,15 @@ std::unique_ptr<GrDrawOp> GrOvalOpFactory::MakeOvalOp(GrContext* context,
// Otherwise, if we have shader derivative support, render as device-independent
if (shaderCaps->shaderDerivativeSupport()) {
return DIEllipseOp::Make(context, std::move(paint), viewMatrix, oval, style.strokeRec());
SkScalar a = viewMatrix[SkMatrix::kMScaleX];
SkScalar b = viewMatrix[SkMatrix::kMSkewX];
SkScalar c = viewMatrix[SkMatrix::kMSkewY];
SkScalar d = viewMatrix[SkMatrix::kMScaleY];
// Check for near-degenerate matrix
if (a*a + c*c > SK_ScalarNearlyZero && b*b + d*d > SK_ScalarNearlyZero) {
return DIEllipseOp::Make(context, std::move(paint), viewMatrix, oval,
style.strokeRec());
}
}
return nullptr;