aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkEdgeClipper.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-16 16:27:09 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-16 16:27:09 +0000
commita90aa534986ffa2019b6a99260bbba086a5c608e (patch)
tree928ad53e507e2801ca4b78e07f810ed8f979b113 /src/core/SkEdgeClipper.cpp
parent0dd84a399ae8903784eac1c361c08449f822307f (diff)
fix clamping when we chop a cubic
Review URL: https://codereview.appspot.com/6039048 git-svn-id: http://skia.googlecode.com/svn/trunk@3691 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkEdgeClipper.cpp')
-rw-r--r--src/core/SkEdgeClipper.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/core/SkEdgeClipper.cpp b/src/core/SkEdgeClipper.cpp
index 70da7e6405..14afce5786 100644
--- a/src/core/SkEdgeClipper.cpp
+++ b/src/core/SkEdgeClipper.cpp
@@ -286,8 +286,8 @@ static void chop_cubic_in_Y(SkPoint pts[4], const SkRect& clip) {
// 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;
- tmp[4].fY = SkMaxScalar(tmp[4].fY, clip.fTop);
- tmp[5].fY = SkMaxScalar(tmp[5].fY, tmp[4].fY);
+ clamp_ge(tmp[4].fY, clip.fTop);
+ clamp_ge(tmp[5].fY, tmp[4].fY);
pts[0] = tmp[3];
pts[1] = tmp[4];
@@ -307,9 +307,10 @@ static void chop_cubic_in_Y(SkPoint pts[4], const SkRect& clip) {
if (chopMonoCubicAtY(pts, clip.fBottom, &t)) {
SkPoint tmp[7];
SkChopCubicAt(pts, tmp, t);
- clamp_le(tmp[1].fY, clip.fBottom);
+ tmp[3].fY = clip.fBottom;
clamp_le(tmp[2].fY, clip.fBottom);
- clamp_le(tmp[3].fY, clip.fBottom);
+ clamp_le(tmp[1].fY, tmp[2].fY);
+
pts[1] = tmp[1];
pts[2] = tmp[2];
pts[3] = tmp[3];
@@ -365,8 +366,8 @@ void SkEdgeClipper::clipMonoCubic(const SkPoint src[4], const SkRect& clip) {
// still be monotonic in X. Since we can't trust the numerics of
// the chopper, we force those conditions now
tmp[3].fX = clip.fLeft;
- tmp[4].fX = SkMaxScalar(tmp[4].fX, clip.fLeft);
- tmp[5].fX = SkMaxScalar(tmp[5].fX, tmp[4].fX);
+ clamp_ge(tmp[4].fX, clip.fLeft);
+ clamp_ge(tmp[5].fX, tmp[4].fX);
pts[0] = tmp[3];
pts[1] = tmp[4];
@@ -385,9 +386,10 @@ void SkEdgeClipper::clipMonoCubic(const SkPoint src[4], const SkRect& clip) {
if (chopMonoCubicAtX(pts, clip.fRight, &t)) {
SkPoint tmp[7];
SkChopCubicAt(pts, tmp, t);
- clamp_le(tmp[1].fX, clip.fRight);
+ tmp[3].fX = clip.fRight;
clamp_le(tmp[2].fX, clip.fRight);
- clamp_le(tmp[3].fX, clip.fRight);
+ clamp_le(tmp[1].fX, tmp[2].fX);
+
this->appendCubic(tmp, reverse);
this->appendVLine(clip.fRight, tmp[3].fY, tmp[6].fY, reverse);
} else {