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:
parent
b889f20eca
commit
50e9efe482
@ -944,14 +944,13 @@ DRAW_PATH:
|
||||
}
|
||||
|
||||
SkScalar SkDraw::ComputeResScaleForStroking(const SkMatrix& matrix) {
|
||||
if (!matrix.hasPerspective()) {
|
||||
SkScalar sx = SkPoint::Length(matrix[SkMatrix::kMScaleX], matrix[SkMatrix::kMSkewY]);
|
||||
SkScalar sy = SkPoint::Length(matrix[SkMatrix::kMSkewX], matrix[SkMatrix::kMScaleY]);
|
||||
if (SkScalarsAreFinite(sx, sy)) {
|
||||
SkScalar scale = SkTMax(sx, sy);
|
||||
if (scale > 0) {
|
||||
return scale;
|
||||
}
|
||||
// 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)) {
|
||||
SkScalar scale = SkTMax(sx, sy);
|
||||
if (scale > 0) {
|
||||
return scale;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user