pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/www/links Add support for X servers at 1/2 bpp color d...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0452b855d2b5
branches:  trunk
changeset: 441970:0452b855d2b5
user:      nat <nat%pkgsrc.org@localhost>
date:      Sun Nov 15 20:36:37 2020 +0000

description:
Add support for X servers at 1/2 bpp color depths.

diffstat:

 www/links/distinfo          |   3 +-
 www/links/patches/patch-x.c |  78 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+), 1 deletions(-)

diffs (95 lines):

diff -r db9c946047ba -r 0452b855d2b5 www/links/distinfo
--- a/www/links/distinfo        Sun Nov 15 20:27:39 2020 +0000
+++ b/www/links/distinfo        Sun Nov 15 20:36:37 2020 +0000
@@ -1,7 +1,8 @@
-$NetBSD: distinfo,v 1.74 2019/11/13 21:32:40 wiz Exp $
+$NetBSD: distinfo,v 1.75 2020/11/15 20:36:37 nat Exp $
 
 SHA1 (links-2.20.2.tar.bz2) = dbcd36c9b37ba6340ce63bb77b7e1c2dec0cfdee
 RMD160 (links-2.20.2.tar.bz2) = ff974cc39235b5657d666ab75d7daf09b48b9997
 SHA512 (links-2.20.2.tar.bz2) = 82be459856f49f45c9b824589b78c0f58b039b09802e077420053e9449bc1ded272bb8ad57ea10522d8b3305ceb212a5dd08b01052538cd5b4f0447d0ba02152
 Size (links-2.20.2.tar.bz2) = 6474383 bytes
 SHA1 (patch-ab) = 3856b53ea6c17d72ca569acf1128ae40d2439ffb
+SHA1 (patch-x.c) = e4291e08437efd1147cfce88530fc662152df346
diff -r db9c946047ba -r 0452b855d2b5 www/links/patches/patch-x.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/links/patches/patch-x.c       Sun Nov 15 20:36:37 2020 +0000
@@ -0,0 +1,78 @@
+$NetBSD: patch-x.c,v 1.1 2020/11/15 20:36:37 nat Exp $
+Fix display for color depths lower than 4bpp.
+--- x.c.orig   2019-08-28 13:01:46.000000000 +0000
++++ x.c
+@@ -1663,12 +1663,12 @@ static unsigned char *x_init_driver(unsi
+ 
+       /* find best visual */
+       {
+-              static_const unsigned char depths[] = {24, 16, 15, 8, 4};
+-              static_const int classes[] = {TrueColor, PseudoColor, StaticColor}; /* FIXME: dodelat DirectColor */
++              static_const unsigned char depths[] = {24, 16, 15, 8, 4, 2, 1};
++              static_const int classes[] = {TrueColor, PseudoColor, StaticColor, StaticGray}; /* FIXME: dodelat DirectColor */
+               unsigned a, b;
+ 
+               for (a = 0; a < array_elements(depths); a++) for (b = 0; b < array_elements(classes); b++) {
+-                      if ((classes[b] == PseudoColor || classes[b] == StaticColor) && depths[a] > 8)
++                      if ((classes[b] == PseudoColor || classes[b] == StaticColor || classes[b] == StaticGray) && depths[a] > 8)
+                               continue;
+                       if (classes[b] == TrueColor && depths[a] <= 8)
+                               continue;
+@@ -1696,11 +1696,13 @@ bytes_per_pixel_found:
+                               /* test misordered flag */
+                               /*debug("x_depth %d, x_bitmap_bpp %d %lx %lx %lx %s", x_depth, x_bitmap_bpp, vinfo.red_mask, vinfo.green_mask, vinfo.blue_mask, x_bitmap_bit_order == MSBFirst ? 
"MSBFirst" : "LSBFirst");*/
+                               switch (x_depth) {
++                                      case 1:
++                                      case 2:
+                                       case 4:
+                                       case 8:
+                                               if (x_bitmap_bpp != 1)
+                                                       break;
+-                                              if (vinfo.class == StaticColor || vinfo.class == PseudoColor) {
++                                              if (vinfo.class == StaticColor || vinfo.class == PseudoColor || vinfo.class == StaticGray) {
+                                                       misordered = 0;
+                                                       goto visual_found;
+                                               }
+@@ -1755,7 +1757,7 @@ visual_found:
+       x_driver.flags &= ~GD_SWITCH_PALETTE;
+       x_have_palette = 0;
+       x_use_static_color_table = 0;
+-      if (vinfo.class == StaticColor) {
++      if (vinfo.class == StaticColor || vinfo.class == StaticGray) {
+               if (x_depth > 8)
+                       return stracpy(cast_uchar "Static color supported for up to 8-bit depth.\n");
+               if ((err = x_query_palette()))
+@@ -2219,13 +2221,32 @@ static void x_translate_colors(unsigned 
+               return;
+       }
+ 
++      unsigned char *mypic = data;
+       if (x_use_static_color_table) {
+               for (j = 0; j < y; j++) {
+                       for (i = 0; i < x; i++)
+                               data[i] = static_color_table[data[i]];
+                       data += skip;
+               }
+-              return;
++      }
++      if (x_depth == 1) {
++              unsigned char s;
++              for (j = 0; j < y; j++) {
++                      s = 0;
++                      for (i = 0; i < x; i++) {
++                              if (mypic[i])
++                                      s |= 1;
++                              if (i % 8 == 7) {
++                                      mypic[i / 8] = s;
++                                      s = 0;
++                              } else if (i == (x - 1)) {
++                                      s <<= (8 - ((i + 1) % 8));
++                                      mypic[i / 8] = s;
++                              } else
++                                      s <<= 1;
++                      }
++                      mypic += skip;
++              }
+       }
+ }
+ 



Home | Main Index | Thread Index | Old Index