Vincent Povirk : windowscodecs: Partially implement IWICBitmapFlipRotator_CopyPixels.

Alexandre Julliard julliard at winehq.org
Tue Apr 27 16:59:34 CDT 2010


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Tue Apr 27 13:15:33 2010 -0500

windowscodecs: Partially implement IWICBitmapFlipRotator_CopyPixels.

---

 dlls/windowscodecs/fliprotate.c |   42 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/dlls/windowscodecs/fliprotate.c b/dlls/windowscodecs/fliprotate.c
index 7bbaf99..7dac252 100644
--- a/dlls/windowscodecs/fliprotate.c
+++ b/dlls/windowscodecs/fliprotate.c
@@ -135,9 +135,47 @@ static HRESULT WINAPI FlipRotator_CopyPalette(IWICBitmapFlipRotator *iface,
 static HRESULT WINAPI FlipRotator_CopyPixels(IWICBitmapFlipRotator *iface,
     const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
 {
-    FIXME("(%p,%p,%u,%u,%p): stub\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
+    FlipRotator *This = (FlipRotator*)iface;
+    HRESULT hr;
+    UINT y;
+    UINT srcy, srcwidth, srcheight;
+    WICRect rc;
 
-    return E_NOTIMPL;
+    TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
+
+    if (!This->source) return WINCODEC_ERR_WRONGSTATE;
+
+    if (This->swap_xy || This->flip_x)
+    {
+        /* This requires knowledge of the pixel format. */
+        FIXME("flipping x and rotating are not implemented\n");
+        return E_NOTIMPL;
+    }
+
+    hr = IWICBitmapSource_GetSize(This->source, &srcwidth, &srcheight);
+    if (FAILED(hr)) return hr;
+
+    for (y=prc->Y; y - prc->Y < prc->Height; y++)
+    {
+        if (This->flip_y)
+            srcy = srcheight - 1 - y;
+        else
+            srcy = y;
+
+        rc.X = prc->X;
+        rc.Y = srcy;
+        rc.Width = prc->Width;
+        rc.Height = 1;
+
+        hr = IWICBitmapSource_CopyPixels(This->source, &rc, cbStride, cbStride,
+            pbBuffer);
+
+        if (FAILED(hr)) break;
+
+        pbBuffer += cbStride;
+    }
+
+    return hr;
 }
 
 static HRESULT WINAPI FlipRotator_Initialize(IWICBitmapFlipRotator *iface,




More information about the wine-cvs mailing list