Vincent Povirk : windowscodecs: Fix the tile coordinate translation in the TIFF decoder.

Alexandre Julliard julliard at winehq.org
Mon May 31 11:21:35 CDT 2010


Module: wine
Branch: master
Commit: e390839732f7314f0ad9330df8493612b63d8e03
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e390839732f7314f0ad9330df8493612b63d8e03

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Sat May 29 10:07:17 2010 -0500

windowscodecs: Fix the tile coordinate translation in the TIFF decoder.

---

 dlls/windowscodecs/tiffformat.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index fe87ddd..d069fd1 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -756,16 +756,20 @@ static HRESULT WINAPI TiffFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface,
 
                 if (prc->X+prc->Width > (tile_x+1) * This->decode_info.tile_width)
                     rc.Width = This->decode_info.tile_width - rc.X;
+                else if (prc->X < tile_x * This->decode_info.tile_width)
+                    rc.Width = prc->Width + prc->X - tile_x * This->decode_info.tile_width;
                 else
-                    rc.Width = prc->Width + rc.X - prc->X;
+                    rc.Width = prc->Width;
 
                 if (prc->Y+prc->Height > (tile_y+1) * This->decode_info.tile_height)
                     rc.Height = This->decode_info.tile_height - rc.Y;
+                else if (prc->Y < tile_y * This->decode_info.tile_height)
+                    rc.Height = prc->Height + prc->Y - tile_y * This->decode_info.tile_height;
                 else
-                    rc.Height = prc->Height + rc.Y - prc->Y;
+                    rc.Height = prc->Height;
 
-                dst_tilepos = pbBuffer + (cbStride * (rc.Y - prc->Y)) +
-                    ((This->decode_info.bpp * (rc.X - prc->X) + 7) / 8);
+                dst_tilepos = pbBuffer + (cbStride * ((rc.Y + tile_y * This->decode_info.tile_height) - prc->Y)) +
+                    ((This->decode_info.bpp * ((rc.X + tile_x * This->decode_info.tile_width) - prc->X) + 7) / 8);
 
                 hr = copy_pixels(This->decode_info.bpp, This->cached_tile,
                     This->decode_info.tile_width, This->decode_info.tile_height, This->decode_info.tile_stride,




More information about the wine-cvs mailing list