Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Unified Diff: src/core/SkScan_Path.cpp

Issue 267003002: add rounding-using-doubles methods on SkScalar and SkRect (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix spelling in comment Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkScalar.h ('k') | tests/PathTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkScan_Path.cpp
diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp
index 66e9507678db5d3bb3410f4329dacff4c78495a4..b32d68e7341ab447b116df5ee89e490614565b9d 100644
--- a/src/core/SkScan_Path.cpp
+++ b/src/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);
« no previous file with comments | « include/core/SkScalar.h ('k') | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698