aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Jim Van Verth <jvanverth@google.com>2017-04-20 17:25:26 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-21 13:28:45 +0000
commitd952a9929b2dc826955249c755b6fed5627491c2 (patch)
treeef150bfcaea7e1779be3f6b15f13646f8650854a /src/gpu
parent2af746c1e74af30d0fb02d5c35a178e61d152965 (diff)
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>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/ops/GrOvalOpFactory.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index e00ee0b24d..71f8bb089f 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -1172,8 +1172,8 @@ public:
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 @@ std::unique_ptr<GrLegacyMeshDrawOp> GrOvalOpFactory::MakeOvalOp(GrColor color,
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));
}