summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-05 16:04:42 +0000
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-05 16:04:42 +0000
commitd8fd8c7718508a11547505b00b1dbb324d461767 (patch)
treeeca4e485dc9e2bfae192a8db644b7f72a614888a
parent71562589f319f2e9d58481f8bafe1c90506c328a (diff)
downloadsrc-d8fd8c7718508a11547505b00b1dbb324d461767.tar.gz
add rounding-using-doubles methods on SkScalar and SkRect
Inspired by the excellent repro case for https://crbug.com/364224 patch from issue 265933010 BUG=skia: R=bungeman@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/267003002 git-svn-id: http://skia.googlecode.com/svn/trunk/src@14566 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--core/SkScan_Path.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/SkScan_Path.cpp b/core/SkScan_Path.cpp
index 66e95076..b32d68e7 100644
--- a/core/SkScan_Path.cpp
+++ b/core/SkScan_Path.cpp
@@ -602,7 +602,11 @@ void SkScan::FillPath(const SkPath& path, const SkRegion& origClip,
// don't reference "origClip" any more, just use clipPtr
SkIRect ir;
- path.getBounds().round(&ir);
+ // We deliberately call dround() instead of round(), since we can't afford to generate a
+ // bounds that is tighter than the corresponding SkEdges. The edge code basically converts
+ // the floats to fixed, and then "rounds". If we called round() instead of dround() here,
+ // we could generate the wrong ir for values like 0.4999997.
+ path.getBounds().dround(&ir);
if (ir.isEmpty()) {
if (path.isInverseFillType()) {
blitter->blitRegion(*clipPtr);