本文整理汇总了C++中SkTDArray::end方法的典型用法代码示例。如果您正苦于以下问题:C++ SkTDArray::end方法的具体用法?C++ SkTDArray::end怎么用?C++ SkTDArray::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkTDArray
的用法示例。
在下文中一共展示了SkTDArray::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: verify_query
static bool verify_query(SkIRect query, DataRect rects[],
SkTDArray<void*>& found) {
SkTDArray<void*> expected;
// manually intersect with every rectangle
for (int i = 0; i < NUM_RECTS; ++i) {
if (SkIRect::IntersectsNoEmptyCheck(query, rects[i].rect)) {
expected.push(rects[i].data);
}
}
if (expected.count() != found.count()) {
return false;
}
if (0 == expected.count()) {
return true;
}
// Just cast to long since sorting by the value of the void*'s was being problematic...
SkTQSort(reinterpret_cast<long*>(expected.begin()),
reinterpret_cast<long*>(expected.end() - 1));
SkTQSort(reinterpret_cast<long*>(found.begin()),
reinterpret_cast<long*>(found.end() - 1));
return found == expected;
}
示例2: withinActiveTrapezoid
bool ActiveTrapezoids::withinActiveTrapezoid(const SkPoint &pt,
Trapezoid **trap) {
DebugPrintf("Entering withinActiveTrapezoid()\n");
// This is where a good search data structure would be helpful.
Trapezoid **t;
for (t = fTrapezoids.begin(); t < fTrapezoids.end(); ++t) {
if ((**t).left()->compare(pt) <= 0) {
// The point is to the left of the left edge of this trapezoid.
DebugPrintf("withinActiveTrapezoid: Before a trapezoid\n");
*trap = *t; // Return the place where a new trapezoid would go.
// We have a bug with the sorting -- look through everything.
continue;
// return false; // Outside all trapezoids, since they are sorted.
}
// The point is to the right of the left edge of this trapezoid.
if ((**t).right()->compare(pt) < 0) {
// The point is to the left of the right edge.
DebugPrintf("withinActiveTrapezoid: Within an Active Trapezoid\n");
*trap = *t;
return true;
}
}
// The point is to the right of all trapezoids.
DebugPrintf("withinActiveTrapezoid: After all trapezoids\n");
*trap = NULL;
return false;
}
示例3: Delete
void SkSVGParser::Delete(SkTDArray<SkSVGElement*>& fChildren) {
SkSVGElement** ptr;
for (ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) {
Delete((*ptr)->fChildren);
delete *ptr;
}
}
示例4: operate
void operate(const SkPath& one, const SkPath& two, ShapeOp op, SkPath& result) {
result.reset();
result.setFillType(SkPath::kEvenOdd_FillType);
// turn path into list of segments
SkTArray<Op::Contour> contours;
// FIXME: add self-intersecting cubics' T values to segment
Op::EdgeBuilder builder(one, contours);
const int aXorMask = builder.xorMask();
builder.addOperand(two);
const int bXorMask = builder.xorMask();
builder.finish();
SkTDArray<Op::Contour*> contourList;
makeContourList(contours, contourList);
Op::Contour** currentPtr = contourList.begin();
if (!currentPtr) {
return;
}
Op::Contour** listEnd = contourList.end();
// find all intersections between segments
do {
Op::Contour** nextPtr = currentPtr;
Op::Contour* current = *currentPtr++;
Op::Contour* next;
do {
next = *nextPtr++;
} while (addIntersectTs(current, next) && nextPtr != listEnd);
} while (currentPtr != listEnd);
// eat through coincident edges
coincidenceCheck(contourList);
fixOtherTIndex(contourList);
// construct closed contours
Op::PathWrapper wrapper(result);
bridgeOp(contourList, op, aXorMask, bXorMask, wrapper);
}
示例5: onClick
virtual bool onClick(Click* click) {
if (Click::kUp_State == click->fState) {
if (click->isType("maker")) {
if (SkPoint::Distance(click->fOrig, click->fCurr) > SkIntToScalar(3)) {
*fList.append() = fDraw;
} else {
fDraw->unref();
}
fDraw = NULL;
}
return true;
}
if (Click::kDown_State == click->fState) {
SkPaint p = fFactory->getPaint();
p.setColor(this->randColor());
fFactory->setPaint(p);
}
if (click->isType("maker")) {
this->setDraw(fFactory->create(click->fOrig, click->fCurr))->unref();
} else if (click->isType("dragger")) {
for (Draw** iter = fList.begin(); iter < fList.end(); iter++) {
if ((*iter)->isSelected()) {
(*iter)->offset(click->fCurr.x() - click->fPrev.x(),
click->fCurr.y() - click->fPrev.y());
}
}
}
this->inval(NULL);
return true;
}
示例6: 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;
}
示例7: insert
void ActiveTrapezoids::insert(Trapezoid *t) {
Trapezoid **tp;
for (tp = fTrapezoids.begin(); tp < fTrapezoids.end(); ++tp)
if (**tp > *t)
break;
fTrapezoids.insert(tp - fTrapezoids.begin(), 1, &t);
// SHOULD VERIFY THAT ALL TRAPEZOIDS ARE PROPERLY SORTED
}
示例8: hitTestList
Draw* hitTestList(SkScalar x, SkScalar y) const {
Draw** first = fList.begin();
for (Draw** iter = fList.end(); iter > first;) {
--iter;
if ((*iter)->hitTest(x, y)) {
return *iter;
}
}
return NULL;
}
示例9: onDraw
virtual void onDraw(SkCanvas* canvas) {
this->drawBG(canvas);
for (Draw** iter = fList.begin(); iter < fList.end(); iter++) {
(*iter)->draw(canvas);
}
if (fDraw) {
fDraw->draw(canvas);
}
}
示例10: onDraw
virtual void onDraw(SkCanvas* canvas) {
this->drawBG(canvas);
test_clearonlayers(canvas); return;
// test_strokerect(canvas); return;
for (Draw** iter = fList.begin(); iter < fList.end(); iter++) {
(*iter)->draw(canvas);
}
if (fDraw) {
fDraw->draw(canvas);
}
}
示例11: remove
void ActiveTrapezoids::remove(Trapezoid *t) {
DebugPrintf("Removing a trapezoid...");
for (Trapezoid **tp = fTrapezoids.begin(); tp < fTrapezoids.end(); ++tp) {
if (*tp == t) {
fTrapezoids.remove(tp - fTrapezoids.begin());
DebugPrintf(" done.\n");
return;
}
}
DebugPrintf(" Arghh! Panic!\n");
SkASSERT(t == 0); // Cannot find t in active trapezoid list.
}
示例12: encodeFound
static void encodeFound(TestState& state) {
if (verbose()) {
if (state.fPixelWorst.count()) {
SkTDArray<SortByPixel*> worst;
for (int index = 0; index < state.fPixelWorst.count(); ++index) {
*worst.append() = &state.fPixelWorst[index];
}
SkTQSort<SortByPixel>(worst.begin(), worst.end() - 1);
for (int index = 0; index < state.fPixelWorst.count(); ++index) {
const TestResult& result = *worst[index];
SkDebugf("%d %s pixelError=%d\n", result.fDirNo, result.fFilename, result.fPixelError);
}
}
if (state.fSlowest.count()) {
SkTDArray<SortByTime*> slowest;
for (int index = 0; index < state.fSlowest.count(); ++index) {
*slowest.append() = &state.fSlowest[index];
}
if (slowest.count() > 0) {
SkTQSort<SortByTime>(slowest.begin(), slowest.end() - 1);
for (int index = 0; index < slowest.count(); ++index) {
const TestResult& result = *slowest[index];
SkDebugf("%d %s time=%d\n", result.fDirNo, result.fFilename, result.fTime);
}
}
}
}
TestRunner testRunner;
for (int index = 0; index < state.fPixelWorst.count(); ++index) {
const TestResult& result = state.fPixelWorst[index];
SkString filename(result.fFilename);
if (!filename.endsWith(".skp")) {
filename.append(".skp");
}
*testRunner.fRunnables.append() = new TestRunnableEncode(&testSkpClipEncode, result.fDirNo,
filename.c_str(), &testRunner);
}
testRunner.render();
}
示例13: SkConcaveToTriangles
bool SkConcaveToTriangles(size_t numPts,
const SkPoint pts[],
SkTDArray<SkPoint> *triangles) {
DebugPrintf("SkConcaveToTriangles()\n");
SkTDArray<Vertex> vertices;
vertices.setCount(numPts);
if (!ConvertPointsToVertices(numPts, pts, vertices.begin()))
return false;
triangles->setReserve(numPts);
triangles->setCount(0);
return Triangulate(vertices.begin(), vertices.end() - 1, triangles);
}
示例14: Simplify
// FIXME : add this as a member of SkPath
void Simplify(const SkPath& path, SkPath* result) {
#if DEBUG_SORT || DEBUG_SWAP_TOP
gDebugSortCount = gDebugSortCountDefault;
#endif
// returns 1 for evenodd, -1 for winding, regardless of inverse-ness
result->reset();
result->setFillType(SkPath::kEvenOdd_FillType);
SkPathWriter simple(*result);
// turn path into list of segments
SkTArray<SkOpContour> contours;
SkOpEdgeBuilder builder(path, contours);
builder.finish();
SkTDArray<SkOpContour*> contourList;
MakeContourList(contours, contourList, false, false);
SkOpContour** currentPtr = contourList.begin();
if (!currentPtr) {
return;
}
SkOpContour** listEnd = contourList.end();
// find all intersections between segments
do {
SkOpContour** nextPtr = currentPtr;
SkOpContour* current = *currentPtr++;
if (current->containsCubics()) {
AddSelfIntersectTs(current);
}
SkOpContour* next;
do {
next = *nextPtr++;
} while (AddIntersectTs(current, next) && nextPtr != listEnd);
} while (currentPtr != listEnd);
// eat through coincident edges
CoincidenceCheck(&contourList, 0);
FixOtherTIndex(&contourList);
SortSegments(&contourList);
#if DEBUG_ACTIVE_SPANS
DebugShowActiveSpans(contourList);
#endif
// construct closed contours
if (builder.xorMask() == kWinding_PathOpsMask ? bridgeWinding(contourList, &simple)
: !bridgeXor(contourList, &simple))
{ // if some edges could not be resolved, assemble remaining fragments
SkPath temp;
temp.setFillType(SkPath::kEvenOdd_FillType);
SkPathWriter assembled(temp);
Assemble(simple, &assembled);
*result = *assembled.nativePath();
}
}
示例15: onFindClickHandler
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {
for (Draw** iter = fList.begin(); iter < fList.end(); iter++) {
(*iter)->setSelected(false);
}
Click* c = new Click(this);
Draw* d = this->hitTestList(x, y);
if (d) {
d->setSelected(true);
c->setType("dragger");
} else {
c->setType("maker");
}
return c;
}