mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-02-10 17:05:53 +01:00
Fixed font rendering bleeding effects.
This commit is contained in:
parent
1609cf65ad
commit
bce77bba23
@ -101,6 +101,7 @@ void Text::Draw()
|
|||||||
rect.y = static_cast<int>(yOrigin);
|
rect.y = static_cast<int>(yOrigin);
|
||||||
|
|
||||||
SDL_LockMutex(SDL::GetMutex());
|
SDL_LockMutex(SDL::GetMutex());
|
||||||
|
SDL_SetTextureBlendMode(t, SDL_BLENDMODE_ADD);
|
||||||
SDL_SetTextureColorMod(t, FontColor.r, FontColor.g, FontColor.b);
|
SDL_SetTextureColorMod(t, FontColor.r, FontColor.g, FontColor.b);
|
||||||
SDL_UnlockMutex(SDL::GetMutex());
|
SDL_UnlockMutex(SDL::GetMutex());
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,7 @@ bool Font::GetRect(unsigned int charCode, GlyphInfo &glyph)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Font::Initialize(std::string fontPath)
|
bool Font::Initialize(std::string fontPath)
|
||||||
{
|
{
|
||||||
TTF_Font *font = TTF_OpenFont(fontPath.c_str(), 128);
|
TTF_Font *font = TTF_OpenFont(fontPath.c_str(), 128);
|
||||||
@ -121,7 +122,6 @@ bool Font::Initialize(std::string fontPath)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDL_Surface *atlasSurface = SDL_CreateRGBSurface(0, atlasWidth, atlasHeight, 24, rmask, gmask, bmask, amask);
|
SDL_Surface *atlasSurface = SDL_CreateRGBSurface(0, atlasWidth, atlasHeight, 24, rmask, gmask, bmask, amask);
|
||||||
SDL_FillRect(atlasSurface, NULL, SDL_MapRGB(atlasSurface->format, 0, 0, 0));
|
|
||||||
|
|
||||||
std::map<unsigned int, GlyphInfoBuild *>::iterator it;
|
std::map<unsigned int, GlyphInfoBuild *>::iterator it;
|
||||||
for(it = Atlas.begin(); it != Atlas.end(); it++)
|
for(it = Atlas.begin(); it != Atlas.end(); it++)
|
||||||
@ -133,7 +133,7 @@ bool Font::Initialize(std::string fontPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDL_LockMutex(SDL::GetMutex());
|
SDL_LockMutex(SDL::GetMutex());
|
||||||
SDL_SetColorKey(atlasSurface, SDL_TRUE, SDL_MapRGB(atlasSurface->format, 0x00, 0x00, 0x00));
|
|
||||||
Texture = SDL_CreateTextureFromSurface(SDL::GetRenderer(), atlasSurface);
|
Texture = SDL_CreateTextureFromSurface(SDL::GetRenderer(), atlasSurface);
|
||||||
SDL_FreeSurface(atlasSurface);
|
SDL_FreeSurface(atlasSurface);
|
||||||
SDL_UnlockMutex(SDL::GetMutex());
|
SDL_UnlockMutex(SDL::GetMutex());
|
||||||
@ -143,6 +143,8 @@ bool Font::Initialize(std::string fontPath)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Font::DeInitialize()
|
void Font::DeInitialize()
|
||||||
{
|
{
|
||||||
if(Texture)
|
if(Texture)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user