Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/rasops Fix color on 24bpp screen for little endian.



details:   https://anonhg.NetBSD.org/src/rev/1907fe359388
branches:  trunk
changeset: 842966:1907fe359388
user:      rin <rin%NetBSD.org@localhost>
date:      Mon Jul 29 14:43:14 2019 +0000

description:
Fix color on 24bpp screen for little endian.

diffstat:

 sys/dev/rasops/rasops.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 425de2d2ec92 -r 1907fe359388 sys/dev/rasops/rasops.c
--- a/sys/dev/rasops/rasops.c   Mon Jul 29 14:07:37 2019 +0000
+++ b/sys/dev/rasops/rasops.c   Mon Jul 29 14:43:14 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rasops.c,v 1.95 2019/07/29 01:04:20 rin Exp $ */
+/*      $NetBSD: rasops.c,v 1.96 2019/07/29 14:43:14 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.95 2019/07/29 01:04:20 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.96 2019/07/29 14:43:14 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -899,8 +899,13 @@
                        c |= c << 16;
                } else if (ri->ri_depth == 15 || ri->ri_depth == 16)
                        c |= c << 16;
-               else if (ri->ri_depth == 24)
+               else if (ri->ri_depth == 24) {
+#if BYTE_ORDER == LITTLE_ENDIAN
+                       c = (c & 0x0000ff) << 16 | (c & 0x00ff00) |
+                           (c & 0xff0000) >> 16;
+#endif
                        c |= (c & 0xff) << 24;
+               }
 
                /* 24bpp does bswap on the fly. {32,16,15}bpp do it here. */
                if ((ri->ri_flg & RI_BSWAP) == 0)



Home | Main Index | Thread Index | Old Index