Fix reflected ovals.
Addresses an issue with ovals transformed by a matrix with a reflection.
Also adds a further check for circles to ensure that teeny tiny ovals
(sizes < SK_ScalarNearlyZero) aren't treated as circles.
Change-Id: Ie50e4a98365eba7c23e53e68886ebac981ed1def
Reviewed-on: https://skia-review.googlesource.com/13989
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index e00ee0b..71f8bb0 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -1172,8 +1172,8 @@
SkScalar ellipseXRadius = SkScalarHalf(ellipse.width());
SkScalar ellipseYRadius = SkScalarHalf(ellipse.height());
SkScalar xRadius = SkScalarAbs(viewMatrix[SkMatrix::kMScaleX] * ellipseXRadius +
- viewMatrix[SkMatrix::kMSkewY] * ellipseYRadius);
- SkScalar yRadius = SkScalarAbs(viewMatrix[SkMatrix::kMSkewX] * ellipseXRadius +
+ viewMatrix[SkMatrix::kMSkewX] * ellipseYRadius);
+ SkScalar yRadius = SkScalarAbs(viewMatrix[SkMatrix::kMSkewY] * ellipseXRadius +
viewMatrix[SkMatrix::kMScaleY] * ellipseYRadius);
// do (potentially) anisotropic mapping of stroke
@@ -2385,7 +2385,8 @@
const GrShaderCaps* shaderCaps) {
// we can draw circles
SkScalar width = oval.width();
- if (SkScalarNearlyEqual(width, oval.height()) && circle_stays_circle(viewMatrix)) {
+ if (width > SK_ScalarNearlyZero && SkScalarNearlyEqual(width, oval.height()) &&
+ circle_stays_circle(viewMatrix)) {
SkPoint center = {oval.centerX(), oval.centerY()};
return CircleOp::Make(color, viewMatrix, center, width / 2.f, GrStyle(stroke, nullptr));
}