Sync push

This commit is contained in:
OmniaX-Dev 2026-04-14 00:58:05 +02:00
parent 64cd4598f2
commit c9ea18d586
4 changed files with 60 additions and 51 deletions

View file

@ -1,2 +1,3 @@
CompileFlags: CompileFlags:
CompilationDatabase: bin CompilationDatabase: bin
Add: ["--target=x86_64-w64-mingw32"]

View file

@ -1 +1 @@
2058 2059

View file

@ -126,6 +126,7 @@ namespace ogfx
int lockedPitch = 0; int lockedPitch = 0;
if (SDL_LockTexture(atlas, &dstRect, &lockedPixels, &lockedPitch)) if (SDL_LockTexture(atlas, &dstRect, &lockedPixels, &lockedPitch))
{ {
SDL_LockSurface(surf);
uint8_t* src = (uint8_t*)surf->pixels; uint8_t* src = (uint8_t*)surf->pixels;
uint8_t* dst = (uint8_t*)lockedPixels; uint8_t* dst = (uint8_t*)lockedPixels;
for (int y = 0; y < gh; y++) for (int y = 0; y < gh; y++)
@ -134,6 +135,7 @@ namespace ogfx
src += surf->pitch; src += surf->pitch;
dst += lockedPitch; dst += lockedPitch;
} }
SDL_UnlockSurface(surf);
SDL_UnlockTexture(atlas); SDL_UnlockTexture(atlas);
} }

View file

@ -157,55 +157,61 @@ class Window : public ogfx::gui::Window
setTheme(m_theme); setTheme(m_theme);
int32_t count = 0; m_gfx.setFontSize(fs);
for (char c = 'A'; c <= 'Z'; c++) m_gfx.getFontGlyphAtlas().rasterize_glyph(ostd::String("").addChar('H'), m_gfx.getSDLFont(), fs);
{ m_gfx.getFontGlyphAtlas().rasterize_glyph(ostd::String("").addChar('e'), m_gfx.getSDLFont(), fs);
for (int32_t i = 0; i < 200; i++) m_gfx.getFontGlyphAtlas().rasterize_glyph(ostd::String("").addChar('l'), m_gfx.getSDLFont(), fs);
{ m_gfx.getFontGlyphAtlas().rasterize_glyph(ostd::String("").addChar('o'), m_gfx.getSDLFont(), fs);
count++;
uint32_t _fs = ostd::Random::getui32(8, 200);
m_gfx.setFontSize(_fs);
m_gfx.getFontGlyphAtlas().rasterize_glyph(ostd::String("").addChar(c), m_gfx.getSDLFont(), _fs);
}
}
for (char c = '0'; c <= '9'; c++)
{
for (int32_t i = 0; i < 200; i++)
{
count++;
uint32_t _fs = ostd::Random::getui32(8, 200);
m_gfx.setFontSize(_fs);
m_gfx.getFontGlyphAtlas().rasterize_glyph(ostd::String("").addChar(c), m_gfx.getSDLFont(), _fs);
}
}
for (char c = 'a'; c <= 'z'; c++)
{
count++;
for (int32_t i = 0; i < 200; i++)
{
uint32_t _fs = ostd::Random::getui32(8, 200);
m_gfx.setFontSize(_fs);
m_gfx.getFontGlyphAtlas().rasterize_glyph(ostd::String("").addChar(c), m_gfx.getSDLFont(), _fs);
}
}
for (char c = '0'; c <= '9'; c++)
{
for (int32_t i = 0; i < 200; i++)
{
count++;
uint32_t _fs = ostd::Random::getui32(8, 200);
m_gfx.setFontSize(_fs);
m_gfx.getFontGlyphAtlas().rasterize_glyph(ostd::String("").addChar(c), m_gfx.getSDLFont(), _fs);
}
}
for (int32_t i = 0; i < m_gfx.getFontGlyphAtlas().m_currentAtlasCount; i++) // int32_t count = 0;
{ // for (char c = 'A'; c <= 'Z'; c++)
ostd::String file("./atlas"); // {
file.add(i).add(".png"); // for (int32_t i = 0; i < 200; i++)
m_gfx.getFontGlyphAtlas().save_atlas_to_png(m_gfx.getSDLRenderer(), m_gfx.getFontGlyphAtlas().m_atlases[i], file); // {
} // count++;
std::cout << "Atlas cound: " << (int)count << "\n"; // uint32_t _fs = ostd::Random::getui32(8, 200);
// m_gfx.setFontSize(_fs);
// m_gfx.getFontGlyphAtlas().rasterize_glyph(ostd::String("").addChar(c), m_gfx.getSDLFont(), _fs);
// }
// }
// for (char c = '0'; c <= '9'; c++)
// {
// for (int32_t i = 0; i < 200; i++)
// {
// count++;
// uint32_t _fs = ostd::Random::getui32(8, 200);
// m_gfx.setFontSize(_fs);
// m_gfx.getFontGlyphAtlas().rasterize_glyph(ostd::String("").addChar(c), m_gfx.getSDLFont(), _fs);
// }
// }
// for (char c = 'a'; c <= 'z'; c++)
// {
// count++;
// for (int32_t i = 0; i < 200; i++)
// {
// uint32_t _fs = ostd::Random::getui32(8, 200);
// m_gfx.setFontSize(_fs);
// m_gfx.getFontGlyphAtlas().rasterize_glyph(ostd::String("").addChar(c), m_gfx.getSDLFont(), _fs);
// }
// }
// for (char c = '0'; c <= '9'; c++)
// {
// for (int32_t i = 0; i < 200; i++)
// {
// count++;
// uint32_t _fs = ostd::Random::getui32(8, 200);
// m_gfx.setFontSize(_fs);
// m_gfx.getFontGlyphAtlas().rasterize_glyph(ostd::String("").addChar(c), m_gfx.getSDLFont(), _fs);
// }
// }
// for (int32_t i = 0; i < m_gfx.getFontGlyphAtlas().m_currentAtlasCount; i++)
// {
// ostd::String file("./atlas");
// file.add(i).add(".png");
// m_gfx.getFontGlyphAtlas().save_atlas_to_png(m_gfx.getSDLRenderer(), m_gfx.getFontGlyphAtlas().m_atlases[i], file);
// }
// std::cout << "Atlas cound: " << (int)count << "\n";
} }
inline void onSignal(ostd::Signal& signal) override inline void onSignal(ostd::Signal& signal) override
@ -251,7 +257,7 @@ class Window : public ogfx::gui::Window
l_renderString("Hello", { 10, 140 }); l_renderString("Hello", { 10, 140 });
gfx.renderText("Hello", 10, 100, ostd::Colors::Crimson, 30); gfx.renderText("Hello", 10, 100, ostd::Colors::Crimson, fs);
} }