diff options
author | Kevin Walzer <kw@codebykevin.com> | 2020-10-12 01:34:57 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2020-10-12 01:34:57 (GMT) |
commit | b702ba89a394de8668091f7442e4b08da0e94dcb (patch) | |
tree | 24f82ac90bc11798fc08fa3672833be464719772 /win/tkWinIco.c | |
parent | 4057120bb20bac23d00b670a51d5547269520588 (diff) | |
download | tk-b702ba89a394de8668091f7442e4b08da0e94dcb.zip tk-b702ba89a394de8668091f7442e4b08da0e94dcb.tar.gz tk-b702ba89a394de8668091f7442e4b08da0e94dcb.tar.bz2 |
Remove and refactor some irrelevant code
Diffstat (limited to 'win/tkWinIco.c')
-rw-r--r-- | win/tkWinIco.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/win/tkWinIco.c b/win/tkWinIco.c index b301ceb..f23d619 100644 --- a/win/tkWinIco.c +++ b/win/tkWinIco.c @@ -123,6 +123,75 @@ BytesPerLine( /* + *---------------------------------------------------------------------- + * + * 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; +} + + +/* * Local Variables: * mode: c * c-basic-offset: 4 |