aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkEdgeClipper.cpp
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-03-08 17:44:42 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-03-08 17:44:42 +0000
commit15161620bee33efcb706685486c9ce0fb51a72bb (patch)
tree83cdab84f4ca81c00d1556b03fafde162d237ebb /src/core/SkEdgeClipper.cpp
parenta6efe069040970a4d3b05e88484de4f82141f6e0 (diff)
handle NaN in curve choppers and edgeclipper
git-svn-id: http://skia.googlecode.com/svn/trunk@522 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkEdgeClipper.cpp')
-rw-r--r--src/core/SkEdgeClipper.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/SkEdgeClipper.cpp b/src/core/SkEdgeClipper.cpp
index d41291d4b7..a265d9f53d 100644
--- a/src/core/SkEdgeClipper.cpp
+++ b/src/core/SkEdgeClipper.cpp
@@ -280,7 +280,11 @@ static void chop_cubic_in_Y(SkPoint pts[4], const SkRect& clip) {
if (pts[0].fY < clip.fTop) {
if (chopMonoCubicAtY(pts, clip.fTop, &t)) {
SkChopCubicAt(pts, tmp, t);
- clamp_ge(tmp[3].fY, clip.fTop);
+ // given the imprecision of computing t, we just slam our Y coord
+ // to the top of the clip. This also saves us in the bad case where
+ // the t was soooo bad that the entire segment could have been
+ // below fBottom
+ tmp[3].fY = clip.fTop;
clamp_ge(tmp[4].fY, clip.fTop);
clamp_ge(tmp[5].fY, clip.fTop);
pts[0] = tmp[3];
@@ -324,10 +328,10 @@ void SkEdgeClipper::clipMonoCubic(const SkPoint src[4], const SkRect& clip) {
if (pts[3].fY <= clip.fTop || pts[0].fY >= clip.fBottom) {
return;
}
-
+
// Now chop so that pts is contained within clip in Y
chop_cubic_in_Y(pts, clip);
-
+
if (pts[0].fX > pts[3].fX) {
SkTSwap<SkPoint>(pts[0], pts[3]);
SkTSwap<SkPoint>(pts[1], pts[2]);