本文整理汇总了C++中SkOpContour::setReverse方法的典型用法代码示例。如果您正苦于以下问题:C++ SkOpContour::setReverse方法的具体用法?C++ SkOpContour::setReverse怎么用?C++ SkOpContour::setReverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkOpContour
的用法示例。
在下文中一共展示了SkOpContour::setReverse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FixWinding
void FixWinding(SkPath* path) {
SkPath::FillType fillType = path->getFillType();
if (fillType == SkPath::kInverseEvenOdd_FillType) {
fillType = SkPath::kInverseWinding_FillType;
} else if (fillType == SkPath::kEvenOdd_FillType) {
fillType = SkPath::kWinding_FillType;
}
SkPathPriv::FirstDirection dir;
if (one_contour(*path) && SkPathPriv::CheapComputeFirstDirection(*path, &dir)) {
if (dir != SkPathPriv::kCCW_FirstDirection) {
SkPath temp;
temp.reverseAddPath(*path);
*path = temp;
}
path->setFillType(fillType);
return;
}
SkChunkAlloc allocator(4096);
SkOpContourHead contourHead;
SkOpGlobalState globalState(nullptr, &contourHead SkDEBUGPARAMS(nullptr));
SkOpEdgeBuilder builder(*path, &contourHead, &allocator, &globalState);
builder.finish(&allocator);
SkASSERT(contourHead.next());
contourHead.resetReverse();
bool writePath = false;
SkOpSpan* topSpan;
globalState.setPhase(SkOpGlobalState::kFixWinding);
while ((topSpan = FindSortableTop(&contourHead))) {
SkOpSegment* topSegment = topSpan->segment();
SkOpContour* topContour = topSegment->contour();
SkASSERT(topContour->isCcw() >= 0);
#if DEBUG_WINDING
SkDebugf("%s id=%d nested=%d ccw=%d\n", __FUNCTION__,
topSegment->debugID(), globalState.nested(), topContour->isCcw());
#endif
if ((globalState.nested() & 1) != SkToBool(topContour->isCcw())) {
topContour->setReverse();
writePath = true;
}
topContour->markDone();
globalState.clearNested();
}
if (!writePath) {
path->setFillType(fillType);
return;
}
SkPath empty;
SkPathWriter woundPath(empty);
SkOpContour* test = &contourHead;
do {
if (test->reversed()) {
test->toReversePath(&woundPath);
} else {
test->toPath(&woundPath);
}
} while ((test = test->next()));
*path = *woundPath.nativePath();
path->setFillType(fillType);
}