本文整理汇总了C++中SkOpSegment::nextSpan方法的典型用法代码示例。如果您正苦于以下问题:C++ SkOpSegment::nextSpan方法的具体用法?C++ SkOpSegment::nextSpan怎么用?C++ SkOpSegment::nextSpan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkOpSegment
的用法示例。
在下文中一共展示了SkOpSegment::nextSpan方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: contourRangeCheckY
static int contourRangeCheckY(const SkTArray<SkOpContour*, true>& contourList, SkOpSegment** currentPtr,
int* indexPtr, int* endIndexPtr, double* bestHit, SkScalar* bestDx,
bool* tryAgain, double* midPtr, bool opp) {
const int index = *indexPtr;
const int endIndex = *endIndexPtr;
const double mid = *midPtr;
const SkOpSegment* current = *currentPtr;
double tAtMid = current->tAtMid(index, endIndex, mid);
SkPoint basePt = current->ptAtT(tAtMid);
int contourCount = contourList.count();
SkScalar bestY = SK_ScalarMin;
SkOpSegment* bestSeg = NULL;
int bestTIndex = 0;
bool bestOpp;
bool hitSomething = false;
for (int cTest = 0; cTest < contourCount; ++cTest) {
SkOpContour* contour = contourList[cTest];
bool testOpp = contour->operand() ^ current->operand() ^ opp;
if (basePt.fY < contour->bounds().fTop) {
continue;
}
if (bestY > contour->bounds().fBottom) {
continue;
}
int segmentCount = contour->segments().count();
for (int test = 0; test < segmentCount; ++test) {
SkOpSegment* testSeg = &contour->segments()[test];
SkScalar testY = bestY;
double testHit;
int testTIndex = testSeg->crossedSpanY(basePt, &testY, &testHit, &hitSomething, tAtMid,
testOpp, testSeg == current);
if (testTIndex < 0) {
if (testTIndex == SK_MinS32) {
hitSomething = true;
bestSeg = NULL;
goto abortContours; // vertical encountered, return and try different point
}
continue;
}
if (testSeg == current && current->betweenTs(index, testHit, endIndex)) {
double baseT = current->t(index);
double endT = current->t(endIndex);
double newMid = (testHit - baseT) / (endT - baseT);
#if DEBUG_WINDING
double midT = current->tAtMid(index, endIndex, mid);
SkPoint midXY = current->xyAtT(midT);
double newMidT = current->tAtMid(index, endIndex, newMid);
SkPoint newXY = current->xyAtT(newMidT);
SkDebugf("%s [%d] mid=%1.9g->%1.9g s=%1.9g (%1.9g,%1.9g) m=%1.9g (%1.9g,%1.9g)"
" n=%1.9g (%1.9g,%1.9g) e=%1.9g (%1.9g,%1.9g)\n", __FUNCTION__,
current->debugID(), mid, newMid,
baseT, current->xAtT(index), current->yAtT(index),
baseT + mid * (endT - baseT), midXY.fX, midXY.fY,
baseT + newMid * (endT - baseT), newXY.fX, newXY.fY,
endT, current->xAtT(endIndex), current->yAtT(endIndex));
#endif
*midPtr = newMid * 2; // calling loop with divide by 2 before continuing
return SK_MinS32;
}
bestSeg = testSeg;
*bestHit = testHit;
bestOpp = testOpp;
bestTIndex = testTIndex;
bestY = testY;
}
}
abortContours:
int result;
if (!bestSeg) {
result = hitSomething ? SK_MinS32 : 0;
} else {
if (bestSeg->windSum(bestTIndex) == SK_MinS32) {
*currentPtr = bestSeg;
*indexPtr = bestTIndex;
*endIndexPtr = bestSeg->nextSpan(bestTIndex, 1);
SkASSERT(*indexPtr != *endIndexPtr && *indexPtr >= 0 && *endIndexPtr >= 0);
*tryAgain = true;
return 0;
}
result = bestSeg->windingAtT(*bestHit, bestTIndex, bestOpp, bestDx);
SkASSERT(result == SK_MinS32 || *bestDx);
}
double baseT = current->t(index);
double endT = current->t(endIndex);
*bestHit = baseT + mid * (endT - baseT);
return result;
}