| 164 | // Legacy version |
| 165 | |
| 166 | void generateSDF_legacy(BitmapSection<float, 1> output, const Shape &shape, Range range, const Vector2 &scale, const Vector2 &translate) { |
| 167 | DistanceMapping distanceMapping(range); |
| 168 | output.reorient(shape.getYAxisOrientation()); |
| 169 | #ifdef MSDFGEN_USE_OPENMP |
| 170 | #pragma omp parallel for |
| 171 | #endif |
| 172 | for (int y = 0; y < output.height; ++y) { |
| 173 | for (int x = 0; x < output.width; ++x) { |
| 174 | double dummy; |
| 175 | Point2 p = Vector2(x+.5, y+.5)/scale-translate; |
| 176 | SignedDistance minDistance; |
| 177 | for (std::vector<Contour>::const_iterator contour = shape.contours.begin(); contour != shape.contours.end(); ++contour) |
| 178 | for (std::vector<EdgeHolder>::const_iterator edge = contour->edges.begin(); edge != contour->edges.end(); ++edge) { |
| 179 | SignedDistance distance = (*edge)->signedDistance(p, dummy); |
| 180 | if (distance < minDistance) |
| 181 | minDistance = distance; |
| 182 | } |
| 183 | *output(x, y) = float(distanceMapping(minDistance.distance)); |
| 184 | } |
| 185 | } |
| 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); |
no test coverage detected