diff options
author | Lee Salzman <lsalzman@mozilla.com> | 2018-05-25 15:43:12 -0400 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-06-07 06:18:58 +0200 |
commit | e810c8a5c0b116d7214c786186f0478a7f70ff64 (patch) | |
tree | fbb86fde6e1faa81bf642f12bdbafe4b6dfc073f | |
parent | cd96ca11cd5beefb13820ab076439d2051ffe1fb (diff) | |
download | UXP-e810c8a5c0b116d7214c786186f0478a7f70ff64.tar UXP-e810c8a5c0b116d7214c786186f0478a7f70ff64.tar.gz UXP-e810c8a5c0b116d7214c786186f0478a7f70ff64.tar.lz UXP-e810c8a5c0b116d7214c786186f0478a7f70ff64.tar.xz UXP-e810c8a5c0b116d7214c786186f0478a7f70ff64.zip |
Bug 1462682 - Skia path bounds rounding fix. r=rhunt, a=RyanVM
-rw-r--r-- | gfx/skia/skia/src/core/SkScan_Path.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/gfx/skia/skia/src/core/SkScan_Path.cpp b/gfx/skia/skia/src/core/SkScan_Path.cpp index 5b80492cf..d15d2d54b 100644 --- a/gfx/skia/skia/src/core/SkScan_Path.cpp +++ b/gfx/skia/skia/src/core/SkScan_Path.cpp @@ -591,16 +591,10 @@ static bool clip_to_limit(const SkRegion& orig, SkRegion* reduced) { return true; } -/** - * Variants of SkScalarRoundToInt, identical to SkDScalarRoundToInt except when the input fraction - * is 0.5. When SK_RASTERIZE_EVEN_ROUNDING is enabled, we must bias the result before rounding to - * account for potential FDot6 rounding edge-cases. - */ -#ifdef SK_RASTERIZE_EVEN_ROUNDING -static const double kRoundBias = 0.5 / SK_FDot6One; -#else -static const double kRoundBias = 0.0; -#endif +// Bias used for conservative rounding of float rects to int rects, to nudge the irects a little +// larger, so we don't "think" a path's bounds are inside a clip, when (due to numeric drift in +// the scan-converter) we might walk beyond the predicted limits. +static const double kConservativeRoundBias = 0.5 + 1.5 / SK_FDot6One; /** * Round the value down. This is used to round the top and left of a rectangle, @@ -608,8 +602,8 @@ static const double kRoundBias = 0.0; */ static inline int round_down_to_int(SkScalar x) { double xx = x; - xx -= 0.5 + kRoundBias; - return (int)ceil(xx); + xx -= kConservativeRoundBias; + return pin_double_to_int(ceil(xx)); } /** @@ -618,8 +612,8 @@ static inline int round_down_to_int(SkScalar x) { */ static inline int round_up_to_int(SkScalar x) { double xx = x; - xx += 0.5 + kRoundBias; - return (int)floor(xx); + xx += kConservativeRoundBias; + return pin_double_to_int(floor(xx)); } /** |