From: Nikolay Sivov nsivov@codeweavers.com
This is handled automatically by libtiff when loading big-endian tiffs on little-endian build. It's implemented as a 'postdecode' hook and depends on TIFFTAG_BITSPERSAMPLE tag.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/windowscodecs/libtiff.c | 31 --------------------------- dlls/windowscodecs/tests/tiffformat.c | 1 - 2 files changed, 32 deletions(-)
diff --git a/dlls/windowscodecs/libtiff.c b/dlls/windowscodecs/libtiff.c index 98ad376f431..584dad116ed 100644 --- a/dlls/windowscodecs/libtiff.c +++ b/dlls/windowscodecs/libtiff.c @@ -659,11 +659,8 @@ static HRESULT CDECL tiff_decoder_get_decoder_palette(struct decoder *iface, UIN static HRESULT tiff_decoder_read_tile(struct tiff_decoder *This, UINT tile_x, UINT tile_y) { tsize_t ret; - int swap_bytes; tiff_decode_info *info = &This->cached_decode_info;
- swap_bytes = TIFFIsByteSwapped(This->tiff); - if (info->tiled) ret = TIFFReadEncodedTile(This->tiff, tile_x + tile_y * info->tiles_across, This->cached_tile, info->tile_size); else @@ -874,34 +871,6 @@ static HRESULT tiff_decoder_read_tile(struct tiff_decoder *This, UINT tile_x, UI } }
- if (swap_bytes && info->bps > 8) - { - UINT row, i, samples_per_row; - BYTE *sample, temp; - - samples_per_row = info->tile_width * info->samples; - - switch(info->bps) - { - case 16: - for (row=0; row<info->tile_height; row++) - { - sample = This->cached_tile + row * info->tile_stride; - for (i=0; i<samples_per_row; i++) - { - temp = sample[1]; - sample[1] = sample[0]; - sample[0] = temp; - sample += 2; - } - } - break; - default: - ERR("unhandled bps for byte swap %u\n", info->bps); - return E_FAIL; - } - } - if (info->invert_grayscale) { BYTE *byte, *end; diff --git a/dlls/windowscodecs/tests/tiffformat.c b/dlls/windowscodecs/tests/tiffformat.c index a42635ab44d..1bc94b03f35 100644 --- a/dlls/windowscodecs/tests/tiffformat.c +++ b/dlls/windowscodecs/tests/tiffformat.c @@ -1562,7 +1562,6 @@ static void test_tiff_16bpp(void) data = 0xfefefefe; hr = IWICBitmapFrameDecode_CopyPixels(frame, &rc, 4, sizeof(data), (BYTE *)&data); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(data == 0xfefe1234, "Unexpected data %#lx.\n", data);
IWICBitmapFrameDecode_Release(frame);