aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar turk@google.com <turk@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-03-04 01:33:35 +0000
committerGravatar turk@google.com <turk@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-03-04 01:33:35 +0000
commit7d3a58a5e442e0aba239616a4e996e64866ffbd0 (patch)
tree0735382a338294fc59b841182805651946369bbc /src/core
parentef772ddb86e9ab5e7e2811c67ed75a24f3ce0e5e (diff)
Format more consistently with the rest of Skia.
git-svn-id: http://skia.googlecode.com/svn/trunk@106 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkCubicClipper.cpp12
-rw-r--r--src/core/SkCubicClipper.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/src/core/SkCubicClipper.cpp b/src/core/SkCubicClipper.cpp
index d11eb9922f..6e47513fc3 100644
--- a/src/core/SkCubicClipper.cpp
+++ b/src/core/SkCubicClipper.cpp
@@ -77,7 +77,7 @@ static bool chopMonoCubicAtY(SkPoint pts[4], SkScalar y, SkScalar* t) {
#else // BISECTION // Linear convergence, typically 16 iterations.
// Check that the endpoints straddle zero.
- SkScalar tNeg, tPos; // Parameter where the function is negative and positive, respectively.
+ SkScalar tNeg, tPos; // Negative and positive function parameters.
if (ycrv[0] < 0) {
if (ycrv[3] < 0)
return false;
@@ -92,7 +92,7 @@ static bool chopMonoCubicAtY(SkPoint pts[4], SkScalar y, SkScalar* t) {
*t = 0;
return true;
}
-
+
const SkScalar tol = SK_Scalar1 / 65536; // 1 for fixed, 1e-5 for float.
int iters = 0;
do {
@@ -139,10 +139,10 @@ bool SkCubicClipper::clipCubic(const SkPoint srcPts[4], SkPoint dst[4]) {
if (dst[3].fY <= ctop || dst[0].fY >= cbot) {
return false;
}
-
+
SkScalar t;
SkPoint tmp[7]; // for SkChopCubicAt
-
+
// are we partially above
if (dst[0].fY < ctop && chopMonoCubicAtY(dst, ctop, &t)) {
SkChopCubicAt(dst, tmp, t);
@@ -150,7 +150,7 @@ bool SkCubicClipper::clipCubic(const SkPoint srcPts[4], SkPoint dst[4]) {
dst[1] = tmp[4];
dst[2] = tmp[5];
}
-
+
// are we partially below
if (dst[3].fY > cbot && chopMonoCubicAtY(dst, cbot, &t)) {
SkChopCubicAt(dst, tmp, t);
@@ -158,7 +158,7 @@ bool SkCubicClipper::clipCubic(const SkPoint srcPts[4], SkPoint dst[4]) {
dst[2] = tmp[2];
dst[3] = tmp[3];
}
-
+
if (reverse) {
SkTSwap<SkPoint>(dst[0], dst[3]);
SkTSwap<SkPoint>(dst[1], dst[2]);
diff --git a/src/core/SkCubicClipper.h b/src/core/SkCubicClipper.h
index 546abae8d4..9a45b3171d 100644
--- a/src/core/SkCubicClipper.h
+++ b/src/core/SkCubicClipper.h
@@ -22,14 +22,14 @@
/** This class is initialized with a clip rectangle, and then can be fed cubics,
which must already be monotonic in Y.
-
+
In the future, it might return a series of segments, allowing it to clip
also in X, to ensure that all segments fit in a finite coordinate system.
*/
class SkCubicClipper {
public:
SkCubicClipper();
-
+
void setClip(const SkIRect& clip);
bool clipCubic(const SkPoint src[4], SkPoint dst[4]);