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

Function generatePSDF_legacy

MyGUIEngine/src/msdfgen/core/msdfgen.cpp:188–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188void 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
217void 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);

Callers 2

mainFunction · 0.85
generatePseudoSDF_legacyFunction · 0.85

Calls 7

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

Tested by

no test coverage detected