From 39a507187f3509dac313d08adeae51ec57f12e3c Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Thu, 2 May 2024 04:23:53 +0200 Subject: [PATCH] Explain the n vs. req_n vs. alpha shenanigans in draw_image So I don't have to figure it out again later ;p. --- fbink.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fbink.c b/fbink.c index fd03634b..9be8145f 100644 --- a/fbink.c +++ b/fbink.c @@ -10395,6 +10395,10 @@ static int w, h); // Warn if there's an alpha channel, because it's usually a bit more expensive to handle... + // NOTE: We look at the *original* pixel format, not whatever we ended up passing to draw_image, + // because we know that when we had to add an alpha layer for compatibility with the framebuffer + // pixel format (i.e., a 24bpp RGB image to a 32bpp RGBA fb), it's actually fully opaque, + // so we don't actually care about that component, it's just essentially padding for addressing purposes. if (n == 2 || n == 4) { img_has_alpha = true; if (fbink_cfg->ignore_alpha) {