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

Function distanceSignCorrection

MyGUIEngine/src/msdfgen/core/rasterization.cpp:19–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19void distanceSignCorrection(BitmapSection<float, 1> sdf, const Shape &shape, const Projection &projection, float sdfZeroValue, FillRule fillRule) {
20 sdf.reorient(shape.getYAxisOrientation());
21 float doubleSdfZeroValue = sdfZeroValue+sdfZeroValue;
22 Scanline scanline;
23 for (int y = 0; y < sdf.height; ++y) {
24 shape.scanline(scanline, projection.unprojectY(y+.5));
25 for (int x = 0; x < sdf.width; ++x) {
26 bool fill = scanline.filled(projection.unprojectX(x+.5), fillRule);
27 float &sd = *sdf(x, y);
28 if ((sd > sdfZeroValue) != fill)
29 sd = doubleSdfZeroValue-sd;
30 }
31 }
32}
33
34template <int N>
35static void multiDistanceSignCorrection(BitmapSection<float, N> sdf, const Shape &shape, const Projection &projection, float sdfZeroValue, FillRule fillRule) {

Callers 1

mainFunction · 0.85

Calls 8

ProjectionClass · 0.85
getYAxisOrientationMethod · 0.80
scanlineMethod · 0.80
unprojectYMethod · 0.80
filledMethod · 0.80
unprojectXMethod · 0.80
reorientMethod · 0.45

Tested by

no test coverage detected