summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2020-02-12 13:48:50 +0100
committerRay <[email protected]>2020-02-12 13:48:50 +0100
commit55f064721392a70d0ca96816e2a9a0b133e4073f (patch)
treec200708f25e9e733a753b4c8b9f433bae189cd90 /src
parent484c6b360f4da17c5034aa1408b3a3bef092eeea (diff)
downloadraylib-55f064721392a70d0ca96816e2a9a0b133e4073f.tar.gz
raylib-55f064721392a70d0ca96816e2a9a0b133e4073f.zip
[core] Avoid pixel bleeding issue on MSAA
Diffstat (limited to 'src')
-rw-r--r--src/core.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core.c b/src/core.c
index e31857a8..fe409d63 100644
--- a/src/core.c
+++ b/src/core.c
@@ -682,7 +682,9 @@ void InitWindow(int width, int height, const char *title)
// Load default font
// NOTE: External functions (defined in module: text)
LoadFontDefault();
- SetShapesTexture(GetFontDefault().texture, GetFontDefault().recs[95]);
+ Rectangle rec = GetFontDefault().recs[95];
+ // NOTE: We setup a 1px padding on char rectangle to avoid pixel bleeding on MSAA filtering
+ SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 1, rec.y + 1, rec.width - 2, rec.height - 2 });
#endif
#if defined(PLATFORM_DESKTOP) && defined(SUPPORT_HIGH_DPI)
// Set default font texture filter for HighDPI (blurry)
@@ -4136,7 +4138,9 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
// Load default font
// NOTE: External function (defined in module: text)
LoadFontDefault();
- SetShapesTexture(GetFontDefault().texture, GetFontDefault().recs[95]);
+ Rectangle rec = GetFontDefault().recs[95];
+ // NOTE: We setup a 1px padding on char rectangle to avoid pixel bleeding on MSAA filtering
+ SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 1, rec.y + 1, rec.width - 2, rec.height - 2 });
#endif
// TODO: GPU assets reload in case of lost focus (lost context)