Vincent Povirk : gdiplus: Fix GdipImageRotateFlip for images from streams.

Alexandre Julliard julliard at winehq.org
Thu Jul 12 18:00:33 CDT 2012


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Thu Jul 12 09:17:09 2012 -0500

gdiplus: Fix GdipImageRotateFlip for images from streams.

---

 dlls/gdiplus/image.c       |    8 ++++++--
 dlls/gdiplus/tests/image.c |   11 +++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index db79eca..233a9eac 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -1971,8 +1971,6 @@ static void move_bitmap(GpBitmap *dst, GpBitmap *src, BOOL clobber_palette)
 {
     assert(src->image.type == ImageTypeBitmap);
     assert(dst->image.type == ImageTypeBitmap);
-    assert(src->image.stream == NULL);
-    assert(dst->image.stream == NULL);
 
     GdipFree(dst->bitmapbits);
     DeleteDC(dst->hdc);
@@ -2001,6 +1999,12 @@ static void move_bitmap(GpBitmap *dst, GpBitmap *src, BOOL clobber_palette)
     if (dst->metadata_reader)
         IWICMetadataReader_Release(dst->metadata_reader);
     dst->metadata_reader = src->metadata_reader;
+    if (dst->image.stream)
+        IStream_Release(dst->image.stream);
+    dst->image.stream = src->image.stream;
+    dst->image.frame_count = src->image.frame_count;
+    dst->image.current_frame = src->image.current_frame;
+    dst->image.format = src->image.format;
 
     src->image.type = ~0;
     GdipFree(src);
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index 29182aa..750b084 100644
--- a/dlls/gdiplus/tests/image.c
+++ b/dlls/gdiplus/tests/image.c
@@ -2345,6 +2345,17 @@ static void test_multiframegif(void)
     expect(Ok, stat);
     expect(0xffffffff, color);
 
+    /* rotate/flip discards the information about other frames */
+    stat = GdipImageRotateFlip((GpImage*)bmp, Rotate90FlipNone);
+    expect(Ok, stat);
+
+    count = 12345;
+    stat = GdipImageGetFrameCount((GpImage*)bmp, &dimension, &count);
+    expect(Ok, stat);
+    expect(1, count);
+
+    expect_rawformat(&ImageFormatMemoryBMP, (GpImage*)bmp, __LINE__, FALSE);
+
     GdipDisposeImage((GpImage*)bmp);
     IStream_Release(stream);
 




More information about the wine-cvs mailing list