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

Unified Diff: src/core/SkEdge.h

Issue 270263005: Use even rounding for better results when converting from scalar to fdot6 (Closed) Base URL: https://skia.googlesource.com/skia.git@neon
Patch Set: Protect behind an ifdef Created 6 years, 4 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 | « no previous file | src/core/SkEdge.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkEdge.h
diff --git a/src/core/SkEdge.h b/src/core/SkEdge.h
index 091223631fed4b4058a6ed93d59a5de638701999..67a0ee78760476948a33ae757019d423ef4cc4b8 100644
--- a/src/core/SkEdge.h
+++ b/src/core/SkEdge.h
@@ -89,11 +89,18 @@ int SkEdge::setLine(const SkPoint& p0, const SkPoint& p1, int shift) {
SkFDot6 x0, y0, x1, y1;
{
+#ifdef SK_RASTERIZE_EVEN_ROUNDING
+ x0 = SkScalarRoundToFDot6(p0.fX, shift);
+ y0 = SkScalarRoundToFDot6(p0.fY, shift);
+ x1 = SkScalarRoundToFDot6(p1.fX, shift);
+ y1 = SkScalarRoundToFDot6(p1.fY, shift);
+#else
float scale = float(1 << (shift + 6));
x0 = int(p0.fX * scale);
y0 = int(p0.fY * scale);
x1 = int(p1.fX * scale);
y1 = int(p1.fY * scale);
+#endif
}
int winding = 1;
« no previous file with comments | « no previous file | src/core/SkEdge.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698