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

Function hasLinearArtifact

MyGUIEngine/src/msdfgen/core/MSDFErrorCorrection.cpp:331–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329/// Checks if a linear interpolation artifact will occur inbetween two horizontally or vertically adjacent texels a, b.
330template <class ArtifactClassifier>
331static bool hasLinearArtifact(const ArtifactClassifier &artifactClassifier, float am, const float *a, const float *b) {
332 float bm = median(b[0], b[1], b[2]);
333 return (
334 // Out of the pair, only report artifacts for the texel further from the edge to minimize side effects.
335 fabsf(am-.5f) >= fabsf(bm-.5f) && (
336 // Check points where each pair of color channels meets.
337 hasLinearArtifactInner(artifactClassifier, am, bm, a, b, a[1]-a[0], b[1]-b[0]) ||
338 hasLinearArtifactInner(artifactClassifier, am, bm, a, b, a[2]-a[1], b[2]-b[1]) ||
339 hasLinearArtifactInner(artifactClassifier, am, bm, a, b, a[0]-a[2], b[0]-b[2])
340 )
341 );
342}
343
344/// Checks if a bilinear interpolation artifact will occur inbetween two diagonally adjacent texels a, d (with b, c forming the other diagonal).
345template <class ArtifactClassifier>

Callers 1

findErrorsMethod · 0.85

Calls 2

hasLinearArtifactInnerFunction · 0.85
medianFunction · 0.70

Tested by

no test coverage detected