1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:57:44 +00:00

LibGfx: Do not use divisions when calculating font subpixel offsets

No functional or performance changes; they were probably already
optimized away by the compiler.
This commit is contained in:
Jelle Raaijmakers 2023-06-01 12:25:50 +02:00 committed by Andreas Kling
parent 5bac9df865
commit 4df3b5e1d2

View file

@ -13,7 +13,7 @@ GlyphRasterPosition GlyphRasterPosition::get_nearest_fit_for(FloatPoint position
constexpr auto subpixel_divisions = GlyphSubpixelOffset::subpixel_divisions();
auto fit = [](float pos, int& blit_pos, u8& subpixel_offset) {
blit_pos = floorf(pos);
subpixel_offset = round_to<u8>((pos - blit_pos) / (1.0f / subpixel_divisions));
subpixel_offset = round_to<u8>((pos - blit_pos) * subpixel_divisions);
if (subpixel_offset >= subpixel_divisions) {
blit_pos += 1;
subpixel_offset = 0;