MCPcopy Create free account
hub / github.com/MyGUI/mygui / generateSDF_legacy

Function generateSDF_legacy

MyGUIEngine/src/msdfgen/core/msdfgen.cpp:166–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164// Legacy version
165
166void 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
188void generatePSDF_legacy(BitmapSection<float, 1> output, const Shape &shape, Range range, const Vector2 &scale, const Vector2 &translate) {
189 DistanceMapping distanceMapping(range);

Callers 1

mainFunction · 0.85

Calls 6

Vector2Class · 0.85
getYAxisOrientationMethod · 0.80
signedDistanceMethod · 0.80
reorientMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected