Fixed a Windows bug

This commit is contained in:
OmniaX-Dev 2026-04-14 01:23:11 +02:00
parent c9ea18d586
commit ceb25e8e38
3 changed files with 25 additions and 20 deletions

View file

@ -1 +1 @@
2059
2060

View file

@ -122,26 +122,31 @@ namespace ogfx
// 7. Upload glyph bitmap into atlas
SDL_Rect dstRect { m_penX, m_penY, gw, gh };
void* lockedPixels = nullptr;
int lockedPitch = 0;
if (SDL_LockTexture(atlas, &dstRect, &lockedPixels, &lockedPitch))
{
SDL_LockSurface(surf);
uint8_t* src = (uint8_t*)surf->pixels;
uint8_t* dst = (uint8_t*)lockedPixels;
for (int y = 0; y < gh; y++)
{
memcpy(dst, src, gw * 4); // 4 bytes per pixel (ARGB8888)
src += surf->pitch;
dst += lockedPitch;
}
SDL_UnlockSurface(surf);
SDL_UnlockTexture(atlas);
}
// SDL_UpdateTexture(atlas, &dstRect, surf->pixels, surf->pitch);
SDL_LockSurface(surf);
SDL_UpdateTexture(atlas, &dstRect, surf->pixels, surf->pitch);
SDL_UnlockSurface(surf);
SDL_DestroySurface(surf);
// void* lockedPixels = nullptr;
// int lockedPitch = 0;
// if (SDL_LockTexture(atlas, &dstRect, &lockedPixels, &lockedPitch))
// {
// SDL_LockSurface(surf);
// uint8_t* src = (uint8_t*)surf->pixels;
// uint8_t* dst = (uint8_t*)lockedPixels;
// for (int y = 0; y < gh; y++)
// {
// memcpy(dst, src, gw * 4); // 4 bytes per pixel (ARGB8888)
// src += surf->pitch;
// dst += lockedPitch;
// }
// SDL_UnlockSurface(surf);
// SDL_UnlockTexture(atlas);
// }
// // SDL_UpdateTexture(atlas, &dstRect, surf->pixels, surf->pitch);
// SDL_DestroySurface(surf);
// 8. Compute UVs
float u0 = float(m_penX) / float(AtlasTextureDimension);
float v0 = float(m_penY) / float(AtlasTextureDimension);

View file

@ -56,7 +56,7 @@ namespace ostd
if (!parseThemeFileLine(line, variables))
l_warn("Error");
};
uint8_t lineNumberMaxWidth = ostd::String("").add(lines.size()).len();
uint8_t lineNumberMaxWidth = ostd::String("").add(static_cast<uint32_t>(lines.size())).len();
ostd::String groupSelector = "";
bool groupLines = true;
std::vector<ostd::String> group;