9front - general discussion about 9front
 help / color / mirror / Atom feed
* Rio color map patch
@ 2019-01-18  7:35 Iroironameeru
  2019-01-18  8:48 ` [9front] " Ethan Gardener
  0 siblings, 1 reply; 2+ messages in thread
From: Iroironameeru @ 2019-01-18  7:35 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 351 bytes --]

In data.c rio uses CMAP8 for all the colors. It should use the apropriate color map for your display, so display->image->chan.
This only really makes a difference to ricers. I know, 'someone will laugh at you for doing this', but it makes more sense for it to use the right format for your display anyhow and doesn't change how the default looks.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: colormap.diff --]
[-- Type: text/x-patch; name="colormap.diff", Size: 2719 bytes --]

diff -r 8c50688cb280 sys/src/cmd/rio/data.c
--- a/sys/src/cmd/rio/data.c	Wed Jan 02 10:26:38 2019 +0100
+++ b/sys/src/cmd/rio/data.c	Fri Jan 18 02:28:57 2019 -0500
@@ -175,27 +175,28 @@
 void
 iconinit(void)
 {
+	ulong cmap = display->image->chan;
 	background = allocimage(display, Rect(0,0,1,1), RGB24, 1, 0x777777FF);
 
 	/* greys are multiples of 0x11111100+0xFF, 14* being palest */
-	cols[BACK] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0xFFFFFFFF^reverse);
-	cols[BORD] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x999999FF^reverse);
-	cols[TEXT] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x000000FF^reverse);
-	cols[HTEXT] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x000000FF);
+	cols[BACK] = allocimage(display, Rect(0,0,1,1), cmap, 1, 0xFFFFFFFF^reverse);
+	cols[BORD] = allocimage(display, Rect(0,0,1,1), cmap, 1, 0x999999FF^reverse);
+	cols[TEXT] = allocimage(display, Rect(0,0,1,1), cmap, 1, 0x000000FF^reverse);
+	cols[HTEXT] = allocimage(display, Rect(0,0,1,1), cmap, 1, 0x000000FF);
 	if(!reverse) {
-		cols[HIGH] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0xCCCCCCFF);
-		titlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DGreygreen);
-		lighttitlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPalegreygreen);
+		cols[HIGH] = allocimage(display, Rect(0,0,1,1), cmap, 1, 0xCCCCCCFF);
+		titlecol = allocimage(display, Rect(0,0,1,1), cmap, 1, DGreygreen);
+		lighttitlecol = allocimage(display, Rect(0,0,1,1), cmap, 1, DPalegreygreen);
 	} else {
-		cols[HIGH] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPurpleblue);
-		titlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPurpleblue);
-		lighttitlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x222222FF);
+		cols[HIGH] = allocimage(display, Rect(0,0,1,1), cmap, 1, DPurpleblue);
+		titlecol = allocimage(display, Rect(0,0,1,1), cmap, 1, DPurpleblue);
+		lighttitlecol = allocimage(display, Rect(0,0,1,1), cmap, 1, 0x222222FF);
 	}
-	dholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DMedblue);
-	lightholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DGreyblue);
-	paleholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPalegreyblue);
-	paletextcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x666666FF^reverse);
-	sizecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DRed);
+	dholdcol = allocimage(display, Rect(0,0,1,1), cmap, 1, DMedblue);
+	lightholdcol = allocimage(display, Rect(0,0,1,1), cmap, 1, DGreyblue);
+	paleholdcol = allocimage(display, Rect(0,0,1,1), cmap, 1, DPalegreyblue);
+	paletextcol = allocimage(display, Rect(0,0,1,1), cmap, 1, 0x666666FF^reverse);
+	sizecol = allocimage(display, Rect(0,0,1,1), cmap, 1, DRed);
 
 	if(reverse == 0)
 		holdcol = dholdcol;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9front] Rio color map patch
  2019-01-18  7:35 Rio color map patch Iroironameeru
@ 2019-01-18  8:48 ` Ethan Gardener
  0 siblings, 0 replies; 2+ messages in thread
From: Ethan Gardener @ 2019-01-18  8:48 UTC (permalink / raw)
  To: 9front

On Fri, Jan 18, 2019, at 7:35 AM, Iroironameeru wrote:
> In data.c rio uses CMAP8 for all the colors. It should use the 
> apropriate color map for your display, so display->image->chan.
> This only really makes a difference to ricers. I know, 'someone will 
> laugh at you for doing this', but it makes more sense for it to use the 
> right format for your display anyhow and doesn't change how the default 
> looks.

I tried fixing this. I... uh... found I am not impressed with the color choices when they are rendered correctly. :)  I do fix it when I make my own color scheme.  Actually, I just set the color map to RGB24 because there's no practical performance loss, not even on a 90s laptop with a 400MHz AMD K6/2 if I remember right.  Actually, now I think about it, the memory use might matter on that little laptop; it only has 64MB RAM.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-18  8:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-18  7:35 Rio color map patch Iroironameeru
2019-01-18  8:48 ` [9front] " Ethan Gardener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).