Bug 1462682 - Skia path bounds rounding fix. r=rhunt, a=jcristau FENNEC_60_0_2_BUILD1 FENNEC_60_0_2_RELEASE FIREFOX_60_0_2_BUILD1 FIREFOX_60_0_2_RELEASE
authorLee Salzman <lsalzman@mozilla.com>
Fri, 25 May 2018 00:57:45 -0400
changeset 812322 a0b222c551f586904f51228c49149d9b6b7e2a81
parent 812321 760e1b2d9adc001ab96e8579aabee0cddbfef80c
child 812323 46ca4895d7a6a5a5b81ed9b9d93d4eb9a13c87fe
push id114530
push userbmo:imadueme@mozilla.com
push dateFri, 29 Jun 2018 05:41:04 +0000
reviewersrhunt, jcristau
Bug 1462682 - Skia path bounds rounding fix. r=rhunt, a=jcristau MozReview-Commit-ID: Lm0XhyLLCCV
--- a/gfx/skia/skia/src/core/SkScan_Path.cpp
+++ b/gfx/skia/skia/src/core/SkScan_Path.cpp
@@ -559,17 +559,22 @@ static bool clip_to_limit(const SkRegion
     reduced->op(orig, limitR, SkRegion::kIntersect_Op);
     return true;
 // 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 + 0.5 / SK_FDot6One;
+// This value has been determined trial and error: pick the smallest value (after the 0.5) that
+// fixes any problematic cases (e.g. crbug.com/844457)
+// NOTE: cubics appear to be the main reason for needing this slop. If we could (perhaps) have a
+// more accurate walker for cubics, we may be able to reduce this fudge factor.
+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,
  *  and corresponds to the way the scan converter treats the top and left edges.
  *  It has a slight bias to make the "rounded" int smaller than a normal round, to create a more
  *  conservative int-bounds (larger) from a float rect.
 static inline int round_down_to_int(SkScalar x) {