From b896f01937748d89573a5b006b799a5cfd6b204e Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 20 Aug 2009 14:28:04 -0500 Subject: [PATCH] windowscodecs: implement CopyPixels for 24-bit ICO icons --- dlls/windowscodecs/icoformat.c | 51 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-) diff --git a/dlls/windowscodecs/icoformat.c b/dlls/windowscodecs/icoformat.c index cb545a1..a6c7af3 100644 --- a/dlls/windowscodecs/icoformat.c +++ b/dlls/windowscodecs/icoformat.c @@ -249,6 +249,57 @@ static HRESULT IcoFrameDecode_ReadPixels(IcoFrameDecode *This) HeapFree(GetProcessHeap(), 0, tempdata); break; } + case 24: + { + UINT xorBytesPerRow = (width*3+3)/4*4; + UINT xorBytes = xorBytesPerRow * height; + INT xorStride; + BYTE *xorRow; + BYTE *bitsRow; + UINT x, y; + + tempdata = HeapAlloc(GetProcessHeap(), 0, xorBytes); + if (!tempdata) + { + hr = E_OUTOFMEMORY; + goto fail; + } + + hr = IStream_Read(This->parent->stream, tempdata, xorBytes, &bytesread); + if (FAILED(hr) || bytesread != xorBytes) goto fail; + + if (bih.biHeight > 0) /* bottom-up DIB */ + { + xorStride = -xorBytesPerRow; + xorRow = tempdata + (height-1)*xorBytesPerRow; + } + else /* top-down DIB */ + { + xorStride = xorBytesPerRow; + xorRow = tempdata; + } + + bits = HeapAlloc(GetProcessHeap(), 0, bitsSize); + + /* copy BGR->BGRA */ + bitsRow = bits; + for (y=0; yentry.wBitCount); goto fail; -- 1.5.4.3