return SkMax32(SkAbs32(oneThird), SkAbs32(twoThird));
}
-int SkCubicEdge::setCubic(const SkPoint pts[4], const SkIRect* clip, int shift)
-{
+int SkCubicEdge::setCubic(const SkPoint pts[4], int shift) {
SkFDot6 x0, y0, x1, y1, x2, y2, x3, y3;
{
if (top == bot)
return 0;
- // are we completely above or below the clip?
- if (clip && (top >= clip->fBottom || bot <= clip->fTop))
- return 0;
-
// compute number of steps needed (1 << shift)
{
// Can't use (center of curve - center of baseline), since center-of-curve
fCLastX = SkFDot6ToFixed(x3);
fCLastY = SkFDot6ToFixed(y3);
- if (clip)
- {
- do {
- if (!this->updateCubic()) {
- return 0;
- }
- } while (!this->intersectsClip(*clip));
- this->chopLineWithClip(*clip);
- return 1;
- }
return this->updateCubic();
}
uint8_t fCubicDShift; // applied to fCDx and fCDy only in cubic
int8_t fWinding; // 1 or -1
- int setLine(const SkPoint& p0, const SkPoint& p1, const SkIRect* clip,
- int shiftUp);
+ int setLine(const SkPoint& p0, const SkPoint& p1, const SkIRect* clip, int shiftUp);
// call this version if you know you don't have a clip
inline int setLine(const SkPoint& p0, const SkPoint& p1, int shiftUp);
inline int updateLine(SkFixed ax, SkFixed ay, SkFixed bx, SkFixed by);
SkFixed fCDDDx, fCDDDy;
SkFixed fCLastX, fCLastY;
- int setCubic(const SkPoint pts[4], const SkIRect* clip, int shiftUp);
+ int setCubic(const SkPoint pts[4], int shiftUp);
int updateCubic();
};
void SkEdgeBuilder::addCubic(const SkPoint pts[]) {
SkCubicEdge* edge = typedAllocThrow<SkCubicEdge>(fAlloc);
- if (edge->setCubic(pts, NULL, fShiftUp)) {
+ if (edge->setCubic(pts, fShiftUp)) {
fList.push(edge);
} else {
// TODO: unallocate edge from storage...