diff options
author | Kevin Walzer <kw@codebykevin.com> | 2020-10-12 18:28:33 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2020-10-12 18:28:33 (GMT) |
commit | f2f177e2064bbafeeadd087188cdbe2fa14f9104 (patch) | |
tree | 30c8a17458b46eb92e839b8d8895668e25138b7a /win/tkWinWm.c | |
parent | 0fce81eca599f32f50de1df99fcc28cf7fc326bd (diff) | |
download | tk-f2f177e2064bbafeeadd087188cdbe2fa14f9104.zip tk-f2f177e2064bbafeeadd087188cdbe2fa14f9104.tar.gz tk-f2f177e2064bbafeeadd087188cdbe2fa14f9104.tar.bz2 |
Remove compiler complaints on Windows
Diffstat (limited to 'win/tkWinWm.c')
-rw-r--r-- | win/tkWinWm.c | 71 |
1 files changed, 70 insertions, 1 deletions
diff --git a/win/tkWinWm.c b/win/tkWinWm.c index d856da0..911291d 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -385,9 +385,9 @@ static BlockOfIconImagesPtr ReadIconOrCursorFromFile(Tcl_Interp *interp, Tcl_Obj* fileName, BOOL isIcon); static WinIconPtr ReadIconFromFile(Tcl_Interp *interp, Tcl_Obj *fileName); +static BOOL AdjustIconImagePointers(LPICONIMAGE lpImage); static WinIconPtr GetIconFromPixmap(Display *dsPtr, Pixmap pixmap); static int ReadICOHeader(Tcl_Channel channel); -static BOOL AdjustIconImagePointers(LPICONIMAGE lpImage); static HICON MakeIconOrCursorFromResource(LPICONIMAGE lpIcon, BOOL isIcon); static HICON GetIcon(WinIconPtr titlebaricon, int icon_size); @@ -1135,6 +1135,75 @@ ReadIconFromFile( return titlebaricon; } + +/* + *---------------------------------------------------------------------- + * + * AdjustIconImagePointers -- + * + * Adjusts internal pointers in icon resource struct, as given by + * LPICONIMAGE lpImage - the resource to handle. Used by titlebar icon + * code. + * + * Results: + * BOOL - TRUE for success, FALSE for failure + * + *---------------------------------------------------------------------- + */ + +static BOOL +AdjustIconImagePointers( + LPICONIMAGE lpImage) +{ + /* + * Sanity check. + */ + + if (lpImage == NULL) { + return FALSE; + } + + /* + * BITMAPINFO is at beginning of bits. + */ + + lpImage->lpbi = (LPBITMAPINFO) lpImage->lpBits; + + /* + * Width - simple enough. + */ + + lpImage->Width = lpImage->lpbi->bmiHeader.biWidth; + + /* + * Icons are stored in funky format where height is doubled so account for + * that. + */ + + lpImage->Height = (lpImage->lpbi->bmiHeader.biHeight)/2; + + /* + * How many colors? + */ + + lpImage->Colors = lpImage->lpbi->bmiHeader.biPlanes + * lpImage->lpbi->bmiHeader.biBitCount; + + /* + * XOR bits follow the header and color table. + */ + + lpImage->lpXOR = (LPBYTE) FindDIBBits((LPSTR) lpImage->lpbi); + + /* + * AND bits follow the XOR bits. + */ + + lpImage->lpAND = lpImage->lpXOR + + lpImage->Height*BytesPerLine((LPBITMAPINFOHEADER) lpImage->lpbi); + return TRUE; +} + /* *---------------------------------------------------------------------- * |