The branch main has been updated by tsoome:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=4bbfe4bf08d6d16ae65729bb22159c8dbd1027bd

commit 4bbfe4bf08d6d16ae65729bb22159c8dbd1027bd
Author:     Toomas Soome <[email protected]>
AuthorDate: 2021-01-13 16:38:08 +0000
Commit:     Toomas Soome <[email protected]>
CommitDate: 2021-01-19 20:15:26 +0000

    loader: comment on rgb_to_color_index()
    
    Add small comment block about rgb_to_color_index().
---
 stand/common/gfx_fb.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c
index d98e6d1bae4b..08c0f59505f2 100644
--- a/stand/common/gfx_fb.c
+++ b/stand/common/gfx_fb.c
@@ -303,7 +303,13 @@ gfx_fb_color_map(uint8_t index)
        return (rgb_color_map(index, rmask, 16, gmask, 8, bmask, 0));
 }
 
-/* Get indexed color */
+/*
+ * Get indexed color from RGB. This function is used to write data to video
+ * memory when the adapter is set to use indexed colors.
+ * Since UEFI does only support 32-bit colors, we do not implement it for
+ * UEFI because there is no need for it and we do not have palette array
+ * for UEFI.
+ */
 static uint8_t
 rgb_to_color_index(uint8_t r, uint8_t g, uint8_t b)
 {
@@ -321,8 +327,10 @@ rgb_to_color_index(uint8_t r, uint8_t g, uint8_t b)
                diff = b - pe8[k].Blue;
                dist += diff * diff;
 
+               /* Exact match, exit the loop */
                if (dist == 0)
                        break;
+
                if (dist < best) {
                        color = k;
                        best = dist;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to