Ziqing Hui : windowscodecs: More complete implementation of DdsFrameDecode_CopyPixels().

Alexandre Julliard julliard at winehq.org
Mon Aug 24 15:58:50 CDT 2020


Module: wine
Branch: master
Commit: 3f082762f81708f00eec599b70c2db94c49b59f6
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3f082762f81708f00eec599b70c2db94c49b59f6

Author: Ziqing Hui <zhui at codeweavers.com>
Date:   Mon Aug 24 12:11:01 2020 +0800

windowscodecs: More complete implementation of DdsFrameDecode_CopyPixels().

Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
Signed-off-by: Esme Povirk <esme at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/windowscodecs/ddsformat.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/dlls/windowscodecs/ddsformat.c b/dlls/windowscodecs/ddsformat.c
index ccd83ace55..ed105a2642 100644
--- a/dlls/windowscodecs/ddsformat.c
+++ b/dlls/windowscodecs/ddsformat.c
@@ -607,20 +607,19 @@ static HRESULT WINAPI DdsFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface,
     if (!prc) {
         if (cbStride < frame_stride) return E_INVALIDARG;
         if (cbBufferSize < frame_size) return WINCODEC_ERR_INSUFFICIENTBUFFER;
-        return S_OK;
-    }
-
-    x = prc->X;
-    y = prc->Y;
-    width = prc->Width;
-    height = prc->Height;
-    if (x < 0 || y < 0 || width <= 0 || height <= 0 ||
-        x + width > This->info.width ||
-        y + height > This->info.height) {
-        return E_INVALIDARG;
+    } else {
+        x = prc->X;
+        y = prc->Y;
+        width = prc->Width;
+        height = prc->Height;
+        if (x < 0 || y < 0 || width <= 0 || height <= 0 ||
+            x + width > This->info.width ||
+            y + height > This->info.height) {
+            return E_INVALIDARG;
+        }
+        if (cbStride < width * bpp / 8) return E_INVALIDARG;
+        if (cbBufferSize < cbStride * height) return WINCODEC_ERR_INSUFFICIENTBUFFER;
     }
-    if (cbStride < width * bpp / 8) return E_INVALIDARG;
-    if (cbBufferSize < cbStride * height) return WINCODEC_ERR_INSUFFICIENTBUFFER;
 
     EnterCriticalSection(&This->lock);
 
@@ -632,6 +631,9 @@ static HRESULT WINAPI DdsFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface,
         }
     }
 
+    hr = copy_pixels(bpp, This->pixel_data, This->info.width, This->info.height, frame_stride,
+                     prc, cbStride, cbBufferSize, pbBuffer);
+
 end:
     LeaveCriticalSection(&This->lock);
 




More information about the wine-cvs mailing list