@@ -26,11 +26,11 @@ core::smart_refctd_ptr<ICPUBuffer> TextRenderer::generateShapeMSDF(msdfgen::Shap
26
26
auto shapeBounds = glyph.getBounds ();
27
27
28
28
msdfgen::edgeColoringSimple (glyph, 3.0 );
29
- msdfgen::Bitmap<float , 3 > msdfMap (glyphW, glyphH);
29
+ msdfgen::Bitmap<float , 4 > msdfMap (glyphW, glyphH);
30
30
31
- msdfgen::generateMSDF (msdfMap, glyph, msdfPixelRange, { scale.x , scale.y }, { translate.x , translate.y });
31
+ msdfgen::generateMTSDF (msdfMap, glyph, msdfPixelRange, { scale.x , scale.y }, { translate.x , translate.y });
32
32
33
- auto cpuBuf = core::make_smart_refctd_ptr<ICPUBuffer>(glyphW * glyphH * sizeof (int8_t ) * 3 );
33
+ auto cpuBuf = core::make_smart_refctd_ptr<ICPUBuffer>(glyphW * glyphH * sizeof (int8_t ) * 4 );
34
34
int8_t * data = reinterpret_cast <int8_t *>(cpuBuf->getPointer ());
35
35
36
36
auto floatToSNORM8 = [](const float fl) -> int8_t
@@ -43,9 +43,10 @@ core::smart_refctd_ptr<ICPUBuffer> TextRenderer::generateShapeMSDF(msdfgen::Shap
43
43
for (int x = 0 ; x < msdfMap.width (); ++x)
44
44
{
45
45
auto pixel = msdfMap (x, glyphH - 1 - y);
46
- data[(x + y * glyphW) * 3 + 0 ] = floatToSNORM8 (pixel[0 ]);
47
- data[(x + y * glyphW) * 3 + 1 ] = floatToSNORM8 (pixel[1 ]);
48
- data[(x + y * glyphW) * 3 + 2 ] = floatToSNORM8 (pixel[2 ]);
46
+ data[(x + y * glyphW) * 4 + 0 ] = floatToSNORM8 (pixel[0 ]);
47
+ data[(x + y * glyphW) * 4 + 1 ] = floatToSNORM8 (pixel[1 ]);
48
+ data[(x + y * glyphW) * 4 + 2 ] = floatToSNORM8 (pixel[2 ]);
49
+ data[(x + y * glyphW) * 4 + 3 ] = floatToSNORM8 (pixel[3 ]);
49
50
}
50
51
}
51
52
0 commit comments