LineQuadraticIntersections(const SkDQuad& q) : fQuad(q) SkDEBUGPARAMS(fLine(nullptr)) SkDEBUGPARAMS(fIntersections(nullptr)) SkDEBUGPARAMS(fAllowNear(false)) { } void allowNear(bool allow) { fAllowNear = allow; } void checkCoincident() { int last = fIntersections->used() - 1; for (int index = 0; index < last; ) { double quadMidT = ((*fIntersections)[0][index] + (*fIntersections)[0][index + 1]) / 2; SkDPoint quadMidPt = fQuad.ptAtT(quadMidT); double t = fLine->nearPoint(quadMidPt, nullptr); if (t < 0) { ++index; continue; } if (fIntersections->isCoincident(index)) { fIntersections->removeOne(index); --last; } else if (fIntersections->isCoincident(index + 1)) { fIntersections->removeOne(index + 1); --last; } else { fIntersections->setCoincident(index++); } fIntersections->setCoincident(index); } }
void drawMeshf(float *mesh_POINT, int *mesh_LINE, int *mesh_COLOR, int *mesh_LINEDATSZ, int mesh_MESHCNT, int bgColor, struct rendrInfo rI) { int sidesNum; int pt1, pt2; int pt3, pt4; int color; int colorCnt = 0; int lineCnt = 0; while (lineCnt < mesh_LINEDATSZ[mesh_MESHCNT-1]) { sidesNum = mesh_LINE[lineCnt]; color = mesh_COLOR[colorCnt]; if (sidesNum == 2) { pt1 = mesh_LINE[lineCnt+1] * 3; pt2 = mesh_LINE[lineCnt+2] * 3; fLine(mesh_POINT[pt1], mesh_POINT[pt1+1], mesh_POINT[pt1+2], mesh_POINT[pt2], mesh_POINT[pt2+1], mesh_POINT[pt2+2], color, bgColor, rI); lineCnt = lineCnt + 3; colorCnt++; } if (sidesNum == 3) { pt1 = mesh_LINE[lineCnt+1] * 3; pt2 = mesh_LINE[lineCnt+2] * 3; pt3 = mesh_LINE[lineCnt+3] * 3; fLine(mesh_POINT[pt1], mesh_POINT[pt1+1], mesh_POINT[pt1+2], mesh_POINT[pt2], mesh_POINT[pt2+1], mesh_POINT[pt2+2], color, bgColor, rI); fLine(mesh_POINT[pt2], mesh_POINT[pt2+1], mesh_POINT[pt2+2], mesh_POINT[pt3], mesh_POINT[pt3+1], mesh_POINT[pt3+2], color, bgColor, rI); fLine(mesh_POINT[pt3], mesh_POINT[pt3+1], mesh_POINT[pt3+2], mesh_POINT[pt1], mesh_POINT[pt1+1], mesh_POINT[pt1+2], color, bgColor, rI); lineCnt = lineCnt + 4; colorCnt++; } if (sidesNum == 4) { pt1 = mesh_LINE[lineCnt+1] * 3; pt2 = mesh_LINE[lineCnt+2] * 3; pt3 = mesh_LINE[lineCnt+3] * 3; pt4 = mesh_LINE[lineCnt+4] * 3; fLine(mesh_POINT[pt1], mesh_POINT[pt1+1], mesh_POINT[pt1+2], mesh_POINT[pt2], mesh_POINT[pt2+1], mesh_POINT[pt2+2], color, bgColor, rI); fLine(mesh_POINT[pt2], mesh_POINT[pt2+1], mesh_POINT[pt2+2], mesh_POINT[pt3], mesh_POINT[pt3+1], mesh_POINT[pt3+2], color, bgColor, rI); fLine(mesh_POINT[pt3], mesh_POINT[pt3+1], mesh_POINT[pt3+2], mesh_POINT[pt4], mesh_POINT[pt4+1], mesh_POINT[pt4+2], color, bgColor, rI); fLine(mesh_POINT[pt4], mesh_POINT[pt4+1], mesh_POINT[pt4+2], mesh_POINT[pt1], mesh_POINT[pt1+1], mesh_POINT[pt1+2], color, bgColor, rI); lineCnt = lineCnt + 5; colorCnt++; } } }