| 51 | |
| 52 | template <class ContourCombiner> |
| 53 | void generateDistanceField(typename DistancePixelConversion<typename ContourCombiner::DistanceType>::BitmapSectionType output, const Shape &shape, const SDFTransformation &transformation) { |
| 54 | DistancePixelConversion<typename ContourCombiner::DistanceType> distancePixelConversion(transformation.distanceMapping); |
| 55 | output.reorient(shape.getYAxisOrientation()); |
| 56 | #ifdef MSDFGEN_USE_OPENMP |
| 57 | #pragma omp parallel |
| 58 | #endif |
| 59 | { |
| 60 | ShapeDistanceFinder<ContourCombiner> distanceFinder(shape); |
| 61 | int xDirection = 1; |
| 62 | #ifdef MSDFGEN_USE_OPENMP |
| 63 | #pragma omp for |
| 64 | #endif |
| 65 | for (int y = 0; y < output.height; ++y) { |
| 66 | int x = xDirection < 0 ? output.width-1 : 0; |
| 67 | for (int col = 0; col < output.width; ++col) { |
| 68 | Point2 p = transformation.unproject(Point2(x+.5, y+.5)); |
| 69 | typename ContourCombiner::DistanceType distance = distanceFinder.distance(p); |
| 70 | distancePixelConversion(output(x, y), distance); |
| 71 | x += xDirection; |
| 72 | } |
| 73 | xDirection = -xDirection; |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | void generateSDF(const BitmapSection<float, 1> &output, const Shape &shape, const SDFTransformation &transformation, const GeneratorConfig &config) { |
| 79 | if (config.overlapSupport) |
nothing calls this directly
no test coverage detected