diff --git a/gfx/2d/PathSkia.cpp b/gfx/2d/PathSkia.cpp index 5c7895ac6b8b..a25f0c3a20e5 100644 --- a/gfx/2d/PathSkia.cpp +++ b/gfx/2d/PathSkia.cpp @@ -10,6 +10,7 @@ #include "Logging.h" #include "HelpersSkia.h" #include "PathHelpers.h" +#include "skia/src/core/SkDraw.h" namespace mozilla::gfx { @@ -138,8 +139,11 @@ bool PathSkia::StrokeContainsPoint(const StrokeOptions& aStrokeOptions, return false; } + SkMatrix skiaMatrix; + GfxMatrixToSkiaMatrix(aTransform, skiaMatrix); SkPath strokePath; - paint.getFillPath(mPath, &strokePath); + paint.getFillPath(mPath, &strokePath, nullptr, + SkDraw::ComputeResScaleForStroking(skiaMatrix)); return SkPathContainsPoint(strokePath, aPoint, aTransform); } diff --git a/gfx/skia/skia/src/core/SkDraw.cpp b/gfx/skia/skia/src/core/SkDraw.cpp index 20ddd31baaf1..5ef63948a1f3 100644 --- a/gfx/skia/skia/src/core/SkDraw.cpp +++ b/gfx/skia/skia/src/core/SkDraw.cpp @@ -802,7 +802,7 @@ DRAW_PATH: this->drawPath(path, paint, nullptr, true); } -SkScalar SkDraw::ComputeResScaleForStroking(const SkMatrix& matrix, SkScalar* overscale) { +SkScalar SkDraw::ComputeResScaleForStroking(const SkMatrix& matrix) { // 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]); @@ -810,11 +810,7 @@ SkScalar SkDraw::ComputeResScaleForStroking(const SkMatrix& matrix, SkScalar* ov SkScalar scale = SkTMax(sx, sy); if (scale > 0) { static const SkScalar kMaxStrokeScale = 1e5f; - if (overscale && scale > kMaxStrokeScale) { - *overscale = scale / kMaxStrokeScale; - scale = kMaxStrokeScale; - } - return scale; + return SkTMin(scale, kMaxStrokeScale); } } return 1; @@ -953,17 +949,9 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint, if (this->computeConservativeLocalClipBounds(&cullRect)) { cullRectPtr = &cullRect; } - SkScalar overscale = SK_Scalar1; doFill = paint->getFillPath(*pathPtr, tmpPath, cullRectPtr, - ComputeResScaleForStroking(*fMatrix, &overscale)); + ComputeResScaleForStroking(*fMatrix)); pathPtr = tmpPath; - if (overscale != SK_Scalar1) { - if (matrix != &tmpMatrix) { - tmpMatrix = *matrix; - matrix = &tmpMatrix; - } - tmpMatrix.postScale(overscale, overscale); - } } // avoid possibly allocating a new path in transform if we can diff --git a/gfx/skia/skia/src/core/SkDraw.h b/gfx/skia/skia/src/core/SkDraw.h index b291071ce7c4..69149f30da68 100644 --- a/gfx/skia/skia/src/core/SkDraw.h +++ b/gfx/skia/skia/src/core/SkDraw.h @@ -124,7 +124,7 @@ public: static RectType ComputeRectType(const SkPaint&, const SkMatrix&, SkPoint* strokeSize); - static SkScalar ComputeResScaleForStroking(const SkMatrix& matrix, SkScalar* overscale = nullptr); + static SkScalar ComputeResScaleForStroking(const SkMatrix& matrix); private: void drawBitmapAsMask(const SkBitmap&, const SkPaint&) const; diff --git a/testing/web-platform/meta/html/canvas/element/path-objects/2d.path.isPointInStroke.scaleddashes.html.ini b/testing/web-platform/meta/html/canvas/element/path-objects/2d.path.isPointInStroke.scaleddashes.html.ini deleted file mode 100644 index ac14179868aa..000000000000 --- a/testing/web-platform/meta/html/canvas/element/path-objects/2d.path.isPointInStroke.scaleddashes.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[2d.path.isPointInStroke.scaleddashes.html] - [isPointInStroke() should return correct results on dashed paths at high scale factors] - expected: - if not early_beta_or_earlier and (os == "win") and webrender and not debug: ["FAIL", "PASS"] - FAIL