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

Unified Diff: src/core/SkEdgeClipper.cpp

Issue 1113963002: use pathops utils to improve precision of cubic chopping in scan converter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 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/SkGeometry.h » ('j') | src/core/SkGeometry.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkEdgeClipper.cpp
diff --git a/src/core/SkEdgeClipper.cpp b/src/core/SkEdgeClipper.cpp
index 32277bcf8e3cc89064dc834a07add63efc6558f0..2b3bf073b174129a78050e70bc63714baabf16db 100644
--- a/src/core/SkEdgeClipper.cpp
+++ b/src/core/SkEdgeClipper.cpp
@@ -267,9 +267,11 @@ static bool chopMonoCubicAt(SkScalar c0, SkScalar c1, SkScalar c2, SkScalar c3,
return true;
}
+#if 0
static bool chopMonoCubicAtY(SkPoint pts[4], SkScalar y, SkScalar* t) {
return chopMonoCubicAt(pts[0].fY, pts[1].fY, pts[2].fY, pts[3].fY, y, t);
}
+#endif
static bool chopMonoCubicAtX(SkPoint pts[4], SkScalar x, SkScalar* t) {
return chopMonoCubicAt(pts[0].fX, pts[1].fX, pts[2].fX, pts[3].fX, x, t);
@@ -280,17 +282,20 @@ static void chop_cubic_in_Y(SkPoint pts[4], const SkRect& clip) {
// are we partially above
if (pts[0].fY < clip.fTop) {
+ SkPoint tmp[7];
+#if 0
SkScalar t;
if (chopMonoCubicAtY(pts, clip.fTop, &t)) {
- SkPoint tmp[7];
SkChopCubicAt(pts, tmp, t);
-
+#else
+ if (SkChopMonoCubicAtY(pts, clip.fTop, tmp)) {
+#endif
// tmp[3, 4, 5].fY should all be to the below clip.fTop.
// Since we can't trust the numerics of
// the chopper, we force those conditions now
tmp[3].fY = clip.fTop;
clamp_ge(tmp[4].fY, clip.fTop);
- clamp_ge(tmp[5].fY, clip.fTop);
+ // clamp_ge(tmp[5].fY, clip.fTop);
pts[0] = tmp[3];
pts[1] = tmp[4];
@@ -306,10 +311,14 @@ static void chop_cubic_in_Y(SkPoint pts[4], const SkRect& clip) {
// are we partially below
if (pts[3].fY > clip.fBottom) {
+ SkPoint tmp[7];
+#if 0
SkScalar t;
if (chopMonoCubicAtY(pts, clip.fBottom, &t)) {
- SkPoint tmp[7];
SkChopCubicAt(pts, tmp, t);
+#else
+ if (SkChopMonoCubicAtY(pts, clip.fBottom, tmp)) {
+#endif
tmp[3].fY = clip.fBottom;
clamp_le(tmp[2].fY, clip.fBottom);
« no previous file with comments | « no previous file | src/core/SkGeometry.h » ('j') | src/core/SkGeometry.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698