本文整理汇总了C++中SkDQuad::set方法的典型用法代码示例。如果您正苦于以下问题:C++ SkDQuad::set方法的具体用法?C++ SkDQuad::set怎么用?C++ SkDQuad::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkDQuad
的用法示例。
在下文中一共展示了SkDQuad::set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddQuad
void SkGlyphCache::AddQuad(const SkPoint pts[2], SkScalar axis, bool yAxis,
SkGlyph::Intercept* intercept) {
SkDQuad quad;
quad.set(pts);
double roots[2];
int count = yAxis ? quad.verticalIntersect(axis, roots)
: quad.horizontalIntersect(axis, roots);
while (--count >= 0) {
SkPoint pt = quad.ptAtT(roots[count]).asSkPoint();
AddInterval(*(&pt.fX + yAxis), intercept);
}
}
示例2: Quad
SkPath::Verb SkReduceOrder::Quad(const SkPoint a[3], SkPoint* reducePts) {
SkDQuad quad;
quad.set(a);
SkReduceOrder reducer;
int order = reducer.reduce(quad);
if (order == 2) { // quad became line
for (int index = 0; index < order; ++index) {
*reducePts++ = reducer.fLine[index].asSkPoint();
}
}
return SkPathOpsPointsToVerb(order - 1);
}
示例3: setup
static void setup(const SortSet* set, const size_t idx,
SkOpSegment* seg, int* ts, const SkPoint& startPt) {
SkPoint start, end;
const SkPoint* data = set[idx].ptData;
bool useIntersectPt = startPt.fX != 0 || startPt.fY != 0;
if (useIntersectPt) {
start = startPt;
end = set[idx].endPt;
}
switch(set[idx].ptCount) {
case 2: {
SkASSERT(ValidPoints(data, 2));
seg->addLine(data, false, false);
SkDLine dLine;
dLine.set(set[idx].ptData);
SkASSERT(ValidLine(dLine));
if (useIntersectPt) {
break;
}
start = dLine.ptAtT(set[idx].tStart).asSkPoint();
end = dLine.ptAtT(set[idx].tEnd).asSkPoint();
} break;
case 3: {
SkASSERT(ValidPoints(data, 3));
seg->addQuad(data, false, false);
SkDQuad dQuad;
dQuad.set(set[idx].ptData);
SkASSERT(ValidQuad(dQuad));
if (useIntersectPt) {
break;
}
start = dQuad.ptAtT(set[idx].tStart).asSkPoint();
end = dQuad.ptAtT(set[idx].tEnd).asSkPoint();
} break;
case 4: {
SkASSERT(ValidPoints(data, 4));
seg->addCubic(data, false, false);
SkDCubic dCubic;
dCubic.set(set[idx].ptData);
SkASSERT(ValidCubic(dCubic));
if (useIntersectPt) {
break;
}
start = dCubic.ptAtT(set[idx].tStart).asSkPoint();
end = dCubic.ptAtT(set[idx].tEnd).asSkPoint();
} break;
}
double tStart = set[idx].tStart;
double tEnd = set[idx].tEnd;
seg->addT(NULL, start, tStart);
seg->addT(NULL, end, tEnd);
if (tStart != 0 && tEnd != 0) {
seg->addT(NULL, set[idx].ptData[0], 0);
}
if (tStart != 1 && tEnd != 1) {
seg->addT(NULL, set[idx].ptData[set[idx].ptCount - 1], 1);
}
int tIndex = 0;
ts[0] = 0;
ts[1] = 1;
do {
if (seg->t(tIndex) == set[idx].tStart) {
ts[0] = tIndex;
}
if (seg->t(tIndex) == set[idx].tEnd) {
ts[1] = tIndex;
}
if (seg->t(tIndex) >= 1) {
break;
}
} while (++tIndex);
}