Dmitry Timoshkov : windowscodecs: Add support for 16bps RGBA format to TIFF decoder.
Alexandre Julliard
julliard at winehq.org
Tue Apr 21 15:59:47 CDT 2020
Module: wine
Branch: master
Commit: 3b9560c6f363433c47b08a4df940a6f86ab3aaab
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3b9560c6f363433c47b08a4df940a6f86ab3aaab
Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date: Tue Apr 21 12:02:21 2020 +0800
windowscodecs: Add support for 16bps RGBA format to TIFF decoder.
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/windowscodecs/tiffformat.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index 33d3a3c992..3d43c967d9 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -1186,6 +1186,36 @@ static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT
HeapFree(GetProcessHeap(), 0, srcdata);
}
+ /* 16bps RGBA */
+ else if (This->decode_info.source_bpp == 16 && This->decode_info.samples == 4 && This->decode_info.bpp == 32)
+ {
+ BYTE *srcdata, *src, *dst;
+ DWORD x, y, count, width_bytes = (This->decode_info.tile_width * 12 + 7) / 8;
+
+ count = width_bytes * This->decode_info.tile_height;
+
+ srcdata = HeapAlloc(GetProcessHeap(), 0, count);
+ if (!srcdata) return E_OUTOFMEMORY;
+ memcpy(srcdata, This->cached_tile, count);
+
+ for (y = 0; y < This->decode_info.tile_height; y++)
+ {
+ src = srcdata + y * width_bytes;
+ dst = This->cached_tile + y * This->decode_info.tile_width * 4;
+
+ for (x = 0; x < This->decode_info.tile_width; x++)
+ {
+ dst[0] = ((src[1] & 0xf0) >> 4) * 17; /* B */
+ dst[1] = (src[0] & 0x0f) * 17; /* G */
+ dst[2] = ((src[0] & 0xf0) >> 4) * 17; /* R */
+ dst[3] = (src[1] & 0x0f) * 17; /* A */
+ src += 2;
+ dst += 4;
+ }
+ }
+
+ HeapFree(GetProcessHeap(), 0, srcdata);
+ }
/* 8bpp grayscale with extra alpha */
else if (This->decode_info.source_bpp == 16 && This->decode_info.samples == 2 && This->decode_info.bpp == 32)
{
More information about the wine-cvs
mailing list