try to help res-scaling in perspective

Perspective is really hard. Perhaps if we could change the API to pass in
the bounds of the shape in question, we could do a better job. As it is we
are just looking at the gradient around the origin.

Bug: skia:
Change-Id: I0542dfef8dfcc9b598048729b5fc65b745f800ed
Reviewed-on: https://skia-review.googlesource.com/147818
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2018-08-17 15:28:53 -04:00 committed by Skia Commit-Bot
parent b889f20eca
commit 50e9efe482

View File

@ -944,7 +944,7 @@ DRAW_PATH:
}
SkScalar SkDraw::ComputeResScaleForStroking(const SkMatrix& matrix) {
if (!matrix.hasPerspective()) {
// Not sure how to handle perspective differently, so we just don't try (yet)
SkScalar sx = SkPoint::Length(matrix[SkMatrix::kMScaleX], matrix[SkMatrix::kMSkewY]);
SkScalar sy = SkPoint::Length(matrix[SkMatrix::kMSkewX], matrix[SkMatrix::kMScaleY]);
if (SkScalarsAreFinite(sx, sy)) {
@ -953,7 +953,6 @@ SkScalar SkDraw::ComputeResScaleForStroking(const SkMatrix& matrix) {
return scale;
}
}
}
return 1;
}