Tk Source Code

View Ticket
Login
Ticket UUID: 453518
Title: Windows 16-bit color green mask is wrong
Type: Bug Version: obsolete: 8.3.3
Submitter: lloydlim Created on: 2001-08-20 21:43:47
Subsystem: 68. Win Window Operations Assigned To: fvogel
Priority: 6 Severity: Minor
Status: Closed Last Modified: 2016-01-08 14:34:54
Resolution: Works For Me Closed By: fvogel
    Closed on: 2016-01-08 14:34:54
Description:
tkWinX.c specifies a value of FC for the green_mask in
16 bit mode.  While 5-6-5 is a supported Windows DIB
format, a quick glance at tkWinImage.c (line 140) shows
that Tk uses the 5-5-5 format.  Therefore, the value
should be F8 for R, G, and B.

Here is a patch to correct it:

--- tkWinX.c.old        Mon Jul  9 12:46:10 2001
+++ tkWinX.c    Mon Aug 20 14:35:22 2001
@@ -383,7 +383,7 @@
            screen->root_visual->class = TrueColor;
            screen->root_visual->map_entries = 64;
            screen->root_visual->red_mask = 0xf8;
-           screen->root_visual->green_mask = 0xfc00;
+           screen->root_visual->green_mask = 0xf800;
            screen->root_visual->blue_mask = 0xf80000;
        } else if (screen->root_depth >= 24) {
            screen->root_visual->class = TrueColor;
User Comments: fvogel added on 2016-01-08 14:34:54:
Fine with me.

jan.nijtmans added on 2016-01-08 09:34:48:
Well, I have my doubts on this patch. The mentioned code is part of
TkWinDisplayChanged(), which might be used by more than only Tk images. It might be that Tk extensions use the 5-6-5 format, or it might be that the actual mistake is in tkWinImage.c which should use the 5-6-5 format. Without further investigation, I would prefer to keep this as-is, marking it "works for me"

oehhar added on 2016-01-07 09:01:25:

We just have noone who really cares about Tk like Donald on Tcl. There is no bug master who cares that tickets are processed.

Thats why I admire your work and I would like to have you in the TCT. Tk is under-represented...

Personally I am not in the position to judge the consequences of this patch, but I can imagine that it has consequences in a coupple of places..

-Harald


fvogel added on 2016-01-06 22:23:12:
This report looks perfectly right to me.

Proposed patch committed in branch bug-453518fff.

Test suite (run under Windows Vista with 16-bit colors display) is happy with the patch.

I can't understand why this accurate report (and which includes the fix) is the most stale ticket of the Tk tracker. This was opened more than 14 years ago and untouched since then. Am I missing something?