本文整理汇总了C++中GrMatrix::mapPoints方法的典型用法代码示例。如果您正苦于以下问题:C++ GrMatrix::mapPoints方法的具体用法?C++ GrMatrix::mapPoints怎么用?C++ GrMatrix::mapPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrMatrix
的用法示例。
在下文中一共展示了GrMatrix::mapPoints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeEdgesAndIntersect
static size_t computeEdgesAndIntersect(const GrMatrix& matrix,
const GrMatrix& inverse,
GrPoint* vertices,
size_t numVertices,
GrEdgeArray* edges,
float sign) {
if (numVertices < 3) {
return 0;
}
matrix.mapPoints(vertices, numVertices);
if (sign == 0.0f) {
sign = isCCW(vertices, numVertices) ? -1.0f : 1.0f;
}
GrPoint p = sanitizePoint(vertices[numVertices - 1]);
for (size_t i = 0; i < numVertices; ++i) {
GrPoint q = sanitizePoint(vertices[i]);
if (p == q) {
continue;
}
GrDrawState::Edge edge = computeEdge(p, q, sign);
edge.fZ += 0.5f; // Offset by half a pixel along the tangent.
*edges->append() = edge;
p = q;
}
int count = edges->count();
if (count == 0) {
return 0;
}
GrDrawState::Edge prev_edge = edges->at(0);
for (int i = 0; i < count; ++i) {
GrDrawState::Edge edge = edges->at(i < count - 1 ? i + 1 : 0);
if (parallel(edge, prev_edge)) {
// 3 points are collinear; offset by half the tangent instead
vertices[i].fX -= edge.fX * 0.5f;
vertices[i].fY -= edge.fY * 0.5f;
} else {
vertices[i] = prev_edge.intersect(edge);
}
inverse.mapPoints(&vertices[i], 1);
prev_edge = edge;
}
return edges->count();
}