summaryrefslogtreecommitdiff
path: root/www/links
diff options
context:
space:
mode:
authornat <nat@pkgsrc.org>2020-11-15 20:36:37 +0000
committernat <nat@pkgsrc.org>2020-11-15 20:36:37 +0000
commita0f7dede555c1fa88ba4b912abe0fd152b9c2ba2 (patch)
treeb8f0ac184f2b980c498d9138d4791a3d816abdfa /www/links
parent45edb69e9a36cd7bec0b050df60389b5df99494e (diff)
downloadpkgsrc-a0f7dede555c1fa88ba4b912abe0fd152b9c2ba2.tar.gz
Add support for X servers at 1/2 bpp color depths.
Diffstat (limited to 'www/links')
-rw-r--r--www/links/distinfo3
-rw-r--r--www/links/patches/patch-x.c78
2 files changed, 80 insertions, 1 deletions
diff --git a/www/links/distinfo b/www/links/distinfo
index 727d1e170e8..7e641e9227c 100644
--- a/www/links/distinfo
+++ b/www/links/distinfo
@@ -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 --git a/www/links/patches/patch-x.c b/www/links/patches/patch-x.c
new file mode 100644
index 00000000000..525f6d4910a
--- /dev/null
+++ b/www/links/patches/patch-x.c
@@ -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;
++ }
+ }
+ }
+