rcore_desktop_glfw.c : flags to control texture font linear filtering - part 3
When in `FLAT_RESCALE_CONTENT` mode, the default "nearest pixel" filter of the texture font is ugly sometimes. So this change adds `FLAG_RESCALE_CONTENT_LINEAR` and `FLAG_TEXT_LINEAR_FILTER` to offer more control. `FLAG_TEXT_LINEAR_FILTER` can also be used to disable the linear filtering of `FLAG_WINDOW_HIGHDPI`.
This commit is contained in:
parent
4ae3e555ed
commit
9228338b39
|
|
@ -418,6 +418,14 @@ void SetWindowState(unsigned int flags)
|
||||||
glfwGetFramebufferSize(platform.handle, &fbWidth, &fbHeight);
|
glfwGetFramebufferSize(platform.handle, &fbWidth, &fbHeight);
|
||||||
WindowSizeCallback(platform.handle, fbWidth, fbHeight);
|
WindowSizeCallback(platform.handle, fbWidth, fbHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_TEXT_LINEAR_FILTER
|
||||||
|
if (((CORE.Window.flags & FLAG_TEXT_LINEAR_FILTER) != (flags & FLAG_TEXT_LINEAR_FILTER)) && ((flags & FLAG_TEXT_LINEAR_FILTER) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags |= FLAG_TEXT_LINEAR_FILTER;
|
||||||
|
rlTextureParameters(GetFontDefault().texture.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_LINEAR);
|
||||||
|
rlTextureParameters(GetFontDefault().texture.id, RL_TEXTURE_MAG_FILTER, RL_TEXTURE_FILTER_LINEAR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear window configuration state flags
|
// Clear window configuration state flags
|
||||||
|
|
@ -541,6 +549,14 @@ void ClearWindowState(unsigned int flags)
|
||||||
glfwGetFramebufferSize(platform.handle, &fbWidth, &fbHeight);
|
glfwGetFramebufferSize(platform.handle, &fbWidth, &fbHeight);
|
||||||
WindowSizeCallback(platform.handle, fbWidth, fbHeight);
|
WindowSizeCallback(platform.handle, fbWidth, fbHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_TEXT_LINEAR_FILTER
|
||||||
|
if (((CORE.Window.flags & FLAG_TEXT_LINEAR_FILTER) > 0) && ((flags & FLAG_TEXT_LINEAR_FILTER) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags &= ~FLAG_TEXT_LINEAR_FILTER;
|
||||||
|
rlTextureParameters(GetFontDefault().texture.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_NEAREST);
|
||||||
|
rlTextureParameters(GetFontDefault().texture.id, RL_TEXTURE_MAG_FILTER, RL_TEXTURE_FILTER_NEAREST);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set icon for window
|
// Set icon for window
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user