aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkEdgeClipper.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-15 15:51:59 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-15 15:51:59 +0000
commit848148ec109172f9eef9a26fa23a520cf9072b5c (patch)
tree71324822a4ba84ae4d1106d9c6e8bf191a4d9235 /src/core/SkEdgeClipper.cpp
parent96b17aa461068bc9c222cb4b235231ed9c2d275c (diff)
Fix bug in cubic-clipper (SkEdgeClipper). When we chop the cubic on Top/Bottom
of the cliprect, we (correctly) clamp the Y coordinate of the control-point right next to the on-curve point that was chopped (this ensures we don't go slightly outside of the clip-rect due to imperfect T value calculation). However, the code was also clamping the other control-point as well, resulting in warping the cubic, which could sometimes force it outside of the clip. The fix is to just remove the line of code that clampped the 2nd control-point. unittest added to reproduce a test cubic that triggered an assert, due to the cubic being outside of the cliprect. The test (w/o the fix) will assert in a SK_DEBUG build. Review URL: https://codereview.appspot.com/7100056 git-svn-id: http://skia.googlecode.com/svn/trunk@7184 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkEdgeClipper.cpp')
-rw-r--r--src/core/SkEdgeClipper.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/core/SkEdgeClipper.cpp b/src/core/SkEdgeClipper.cpp
index 9fd6a0e1cb..84d6e9b6c2 100644
--- a/src/core/SkEdgeClipper.cpp
+++ b/src/core/SkEdgeClipper.cpp
@@ -282,12 +282,11 @@ static void chop_cubic_in_Y(SkPoint pts[4], const SkRect& clip) {
SkPoint tmp[7];
SkChopCubicAt(pts, tmp, t);
- // tmp[3, 4, 5].fY should all be to the below clip.fTop, and
+ // tmp[3, 4].fY should all be to the below clip.fTop, and
// still be monotonic in Y. 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, tmp[4].fY);
pts[0] = tmp[3];
pts[1] = tmp[4];
@@ -309,7 +308,6 @@ static void chop_cubic_in_Y(SkPoint pts[4], const SkRect& clip) {
SkChopCubicAt(pts, tmp, t);
tmp[3].fY = clip.fBottom;
clamp_le(tmp[2].fY, clip.fBottom);
- clamp_le(tmp[1].fY, tmp[2].fY);
pts[1] = tmp[1];
pts[2] = tmp[2];