本文整理汇总了C++中SkOpContour::count方法的典型用法代码示例。如果您正苦于以下问题:C++ SkOpContour::count方法的具体用法?C++ SkOpContour::count怎么用?C++ SkOpContour::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkOpContour
的用法示例。
在下文中一共展示了SkOpContour::count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SortContourList
bool SortContourList(SkOpContourHead** contourList, bool evenOdd, bool oppEvenOdd) {
SkTDArray<SkOpContour* > list;
SkOpContour* contour = *contourList;
do {
if (contour->count()) {
contour->setOppXor(contour->operand() ? evenOdd : oppEvenOdd);
*list.append() = contour;
}
} while ((contour = contour->next()));
int count = list.count();
if (!count) {
return false;
}
if (count > 1) {
SkTQSort<SkOpContour>(list.begin(), list.end() - 1);
}
contour = list[0];
SkOpContourHead* contourHead = static_cast<SkOpContourHead*>(contour);
contour->globalState()->setContourHead(contourHead);
*contourList = contourHead;
for (int index = 1; index < count; ++index) {
SkOpContour* next = list[index];
contour->setNext(next);
contour = next;
}
contour->setNext(nullptr);
return true;
}
示例2: finish
bool SkOpEdgeBuilder::finish() {
fOperand = false;
if (fUnparseable || !walk()) {
return false;
}
complete();
SkOpContour* contour = fContourBuilder.contour();
if (contour && !contour->count()) {
fContoursHead->remove(contour);
}
return true;
}
示例3: walk
bool SkOpEdgeBuilder::walk() {
uint8_t* verbPtr = fPathVerbs.begin();
uint8_t* endOfFirstHalf = &verbPtr[fSecondHalf];
SkPoint* pointsPtr = fPathPts.begin() - 1;
SkScalar* weightPtr = fWeights.begin();
SkPath::Verb verb;
SkOpContour* contour = fContourBuilder.contour();
while ((verb = (SkPath::Verb) *verbPtr) != SkPath::kDone_Verb) {
if (verbPtr == endOfFirstHalf) {
fOperand = true;
}
verbPtr++;
switch (verb) {
case SkPath::kMove_Verb:
if (contour && contour->count()) {
if (fAllowOpenContours) {
complete();
} else if (!close()) {
return false;
}
}
if (!contour) {
fContourBuilder.setContour(contour = fContoursHead->appendContour());
}
contour->init(fGlobalState, fOperand,
fXorMask[fOperand] == kEvenOdd_PathOpsMask);
pointsPtr += 1;
continue;
case SkPath::kLine_Verb:
fContourBuilder.addLine(pointsPtr);
break;
case SkPath::kQuad_Verb:
{
SkVector v1 = pointsPtr[1] - pointsPtr[0];
SkVector v2 = pointsPtr[2] - pointsPtr[1];
if (v1.dot(v2) < 0) {
SkPoint pair[5];
if (SkChopQuadAtMaxCurvature(pointsPtr, pair) == 1) {
goto addOneQuad;
}
if (!SkScalarsAreFinite(&pair[0].fX, SK_ARRAY_COUNT(pair) * 2)) {
return false;
}
for (unsigned index = 0; index < SK_ARRAY_COUNT(pair); ++index) {
force_small_to_zero(&pair[index]);
}
SkPoint cStorage[2][2];
SkPath::Verb v1 = SkReduceOrder::Quad(&pair[0], cStorage[0]);
SkPath::Verb v2 = SkReduceOrder::Quad(&pair[2], cStorage[1]);
SkPoint* curve1 = v1 != SkPath::kLine_Verb ? &pair[0] : cStorage[0];
SkPoint* curve2 = v2 != SkPath::kLine_Verb ? &pair[2] : cStorage[1];
if (can_add_curve(v1, curve1) && can_add_curve(v2, curve2)) {
fContourBuilder.addCurve(v1, curve1);
fContourBuilder.addCurve(v2, curve2);
break;
}
}
}
addOneQuad:
fContourBuilder.addQuad(pointsPtr);
break;
case SkPath::kConic_Verb: {
SkVector v1 = pointsPtr[1] - pointsPtr[0];
SkVector v2 = pointsPtr[2] - pointsPtr[1];
SkScalar weight = *weightPtr++;
if (v1.dot(v2) < 0) {
// FIXME: max curvature for conics hasn't been implemented; use placeholder
SkScalar maxCurvature = SkFindQuadMaxCurvature(pointsPtr);
if (maxCurvature > 0) {
SkConic conic(pointsPtr, weight);
SkConic pair[2];
if (!conic.chopAt(maxCurvature, pair)) {
// if result can't be computed, use original
fContourBuilder.addConic(pointsPtr, weight);
break;
}
SkPoint cStorage[2][3];
SkPath::Verb v1 = SkReduceOrder::Conic(pair[0], cStorage[0]);
SkPath::Verb v2 = SkReduceOrder::Conic(pair[1], cStorage[1]);
SkPoint* curve1 = v1 != SkPath::kLine_Verb ? pair[0].fPts : cStorage[0];
SkPoint* curve2 = v2 != SkPath::kLine_Verb ? pair[1].fPts : cStorage[1];
if (can_add_curve(v1, curve1) && can_add_curve(v2, curve2)) {
fContourBuilder.addCurve(v1, curve1, pair[0].fW);
fContourBuilder.addCurve(v2, curve2, pair[1].fW);
break;
}
}
}
fContourBuilder.addConic(pointsPtr, weight);
} break;
case SkPath::kCubic_Verb:
{
// Split complex cubics (such as self-intersecting curves or
// ones with difficult curvature) in two before proceeding.
// This can be required for intersection to succeed.
SkScalar splitT[3];
int breaks = SkDCubic::ComplexBreak(pointsPtr, splitT);
if (!breaks) {
fContourBuilder.addCubic(pointsPtr);
break;
//.........这里部分代码省略.........