| 186 | } |
| 187 | |
| 188 | void generatePSDF_legacy(BitmapSection<float, 1> output, const Shape &shape, Range range, const Vector2 &scale, const Vector2 &translate) { |
| 189 | DistanceMapping distanceMapping(range); |
| 190 | output.reorient(shape.getYAxisOrientation()); |
| 191 | #ifdef MSDFGEN_USE_OPENMP |
| 192 | #pragma omp parallel for |
| 193 | #endif |
| 194 | for (int y = 0; y < output.height; ++y) { |
| 195 | for (int x = 0; x < output.width; ++x) { |
| 196 | Point2 p = Vector2(x+.5, y+.5)/scale-translate; |
| 197 | SignedDistance minDistance; |
| 198 | const EdgeHolder *nearEdge = NULL; |
| 199 | double nearParam = 0; |
| 200 | for (std::vector<Contour>::const_iterator contour = shape.contours.begin(); contour != shape.contours.end(); ++contour) |
| 201 | for (std::vector<EdgeHolder>::const_iterator edge = contour->edges.begin(); edge != contour->edges.end(); ++edge) { |
| 202 | double param; |
| 203 | SignedDistance distance = (*edge)->signedDistance(p, param); |
| 204 | if (distance < minDistance) { |
| 205 | minDistance = distance; |
| 206 | nearEdge = &*edge; |
| 207 | nearParam = param; |
| 208 | } |
| 209 | } |
| 210 | if (nearEdge) |
| 211 | (*nearEdge)->distanceToPerpendicularDistance(minDistance, p, nearParam); |
| 212 | *output(x, y) = float(distanceMapping(minDistance.distance)); |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | void generatePseudoSDF_legacy(BitmapSection<float, 1> output, const Shape &shape, Range range, const Vector2 &scale, const Vector2 &translate) { |
| 218 | generatePSDF_legacy(output, shape, range, scale, translate); |
no test coverage detected