Dmitry Timoshkov : windowscodecs: Avoid redundant checks when reading a TIFF tile.
Alexandre Julliard
julliard at winehq.org
Wed Feb 20 16:37:01 CST 2019
Module: wine
Branch: master
Commit: 493fbabb855645e00c304cccaf1dfca764fa5305
URL: https://source.winehq.org/git/wine.git/?a=commit;h=493fbabb855645e00c304cccaf1dfca764fa5305
Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date: Tue Feb 19 12:07:58 2019 +0800
windowscodecs: Avoid redundant checks when reading a TIFF tile.
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 | 40 ++++++++++++++--------------------------
1 file changed, 14 insertions(+), 26 deletions(-)
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index 3bc8d69..295330a 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -974,34 +974,25 @@ static HRESULT WINAPI TiffFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface,
static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT tile_y)
{
- HRESULT hr=S_OK;
tsize_t ret;
int swap_bytes;
swap_bytes = pTIFFIsByteSwapped(This->parent->tiff);
ret = pTIFFSetDirectory(This->parent->tiff, This->index);
-
if (ret == -1)
- hr = E_FAIL;
+ return E_FAIL;
- if (hr == S_OK)
- {
- if (This->decode_info.tiled)
- {
- ret = pTIFFReadEncodedTile(This->parent->tiff, tile_x + tile_y * This->decode_info.tiles_across, This->cached_tile, This->decode_info.tile_size);
- }
- else
- {
- ret = pTIFFReadEncodedStrip(This->parent->tiff, tile_y, This->cached_tile, This->decode_info.tile_size);
- }
+ if (This->decode_info.tiled)
+ ret = pTIFFReadEncodedTile(This->parent->tiff, tile_x + tile_y * This->decode_info.tiles_across, This->cached_tile, This->decode_info.tile_size);
+ else
+ ret = pTIFFReadEncodedStrip(This->parent->tiff, tile_y, This->cached_tile, This->decode_info.tile_size);
- if (ret == -1)
- hr = E_FAIL;
- }
+ if (ret == -1)
+ return E_FAIL;
/* 8bpp grayscale with extra alpha */
- if (hr == S_OK && This->decode_info.source_bpp == 16 && This->decode_info.samples == 2 && This->decode_info.bpp == 32)
+ if (This->decode_info.source_bpp == 16 && This->decode_info.samples == 2 && This->decode_info.bpp == 32)
{
BYTE *src;
DWORD *dst, count = This->decode_info.tile_width * This->decode_info.tile_height;
@@ -1016,7 +1007,7 @@ static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT
}
}
- if (hr == S_OK && This->decode_info.reverse_bgr)
+ if (This->decode_info.reverse_bgr)
{
if (This->decode_info.bps == 8)
{
@@ -1027,7 +1018,7 @@ static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT
}
}
- if (hr == S_OK && swap_bytes && This->decode_info.bps > 8)
+ if (swap_bytes && This->decode_info.bps > 8)
{
UINT row, i, samples_per_row;
BYTE *sample, temp;
@@ -1055,7 +1046,7 @@ static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT
}
}
- if (hr == S_OK && This->decode_info.invert_grayscale)
+ if (This->decode_info.invert_grayscale)
{
BYTE *byte, *end;
@@ -1071,13 +1062,10 @@ static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT
*byte = ~(*byte);
}
- if (hr == S_OK)
- {
- This->cached_tile_x = tile_x;
- This->cached_tile_y = tile_y;
- }
+ This->cached_tile_x = tile_x;
+ This->cached_tile_y = tile_y;
- return hr;
+ return S_OK;
}
static HRESULT WINAPI TiffFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface,
More information about the wine-cvs
mailing list