diff --git a/gfx/2d/DrawCommand.h b/gfx/2d/DrawCommand.h index 83bbad8c1f96..ab8cc2073a4c 100644 --- a/gfx/2d/DrawCommand.h +++ b/gfx/2d/DrawCommand.h @@ -372,6 +372,11 @@ PathExtentsToMaxStrokeExtents(const StrokeOptions &aStrokeOptions, double dx = styleExpansionFactor * hypot(aTransform._11, aTransform._21); double dy = styleExpansionFactor * hypot(aTransform._22, aTransform._12); + // Even if the stroke only partially covers a pixel, it must still render to + // full pixels. Round up to compensate for this. + dx = ceil(dx); + dy = ceil(dy); + Rect result = aRect; result.Inflate(dx, dy); return result; diff --git a/gfx/2d/PathHelpers.cpp b/gfx/2d/PathHelpers.cpp index e76954497b04..864281c40876 100644 --- a/gfx/2d/PathHelpers.cpp +++ b/gfx/2d/PathHelpers.cpp @@ -270,6 +270,12 @@ MaxStrokeExtents(const StrokeOptions& aStrokeOptions, double dx = styleExpansionFactor * hypot(aTransform._11, aTransform._21); double dy = styleExpansionFactor * hypot(aTransform._22, aTransform._12); + + // Even if the stroke only partially covers a pixel, it must still render to + // full pixels. Round up to compensate for this. + dx = ceil(dx); + dy = ceil(dy); + return Margin(dy, dx, dy, dx); }