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

Method apply

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

Source from the content-addressed store, hash-verified

458
459template <int N>
460void MSDFErrorCorrection::apply(BitmapSection<float, N> sdf) const {
461 sdf.reorient(stencil.yOrientation);
462 const byte *stencilRow = stencil.pixels;
463 float *rowStart = sdf.pixels;
464 for (int y = 0; y < sdf.height; ++y) {
465 const byte *mask = stencilRow;
466 float *pixel = rowStart;
467 for (int x = 0; x < sdf.width; ++x) {
468 if (*mask&ERROR) {
469 // Set all color channels to the median.
470 float m = median(pixel[0], pixel[1], pixel[2]);
471 pixel[0] = m, pixel[1] = m, pixel[2] = m;
472 }
473 ++mask;
474 pixel += N;
475 }
476 stencilRow += stencil.rowStride;
477 rowStart += sdf.rowStride;
478 }
479}
480
481BitmapConstSection<byte, 1> MSDFErrorCorrection::getStencil() const {
482 return stencil;

Callers 2

msdfErrorCorrectionInnerFunction · 0.80

Calls 2

medianFunction · 0.70
reorientMethod · 0.45

Tested by

no test coverage detected