Module: wine Branch: master Commit: 4245b1199c36fd42dcefb24ede94dd7c5af983fc URL: https://gitlab.winehq.org/wine/wine/-/commit/4245b1199c36fd42dcefb24ede94dd7...
Author: Jeff Smith whydoubt@gmail.com Date: Wed Jul 19 22:35:52 2023 -0500
gdiplus: Set correct frame delay when GCE is missing.
---
dlls/gdiplus/image.c | 4 +++- dlls/gdiplus/tests/image.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 1cbad7742b5..56a3cfa1d18 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -3302,6 +3302,7 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI if (delay) { LONG *value; + LONG frame_delay = 0;
delay->type = PropertyTagTypeLong; delay->id = PropertyTagFrameDelay; @@ -3315,9 +3316,10 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI hr = IWICBitmapDecoder_GetFrame(decoder, i, &frame); if (hr == S_OK) { - get_gif_frame_property(frame, &GUID_MetadataFormatGCE, L"Delay", &value[i]); + get_gif_frame_property(frame, &GUID_MetadataFormatGCE, L"Delay", &frame_delay); IWICBitmapFrameDecode_Release(frame); } + value[i] = frame_delay; } }
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index aa1e3e4eb35..bced4e0ca39 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -4859,6 +4859,24 @@ static const BYTE gif_2frame_no_pal[] = { 0x02,0x02,0x44,0x01,0x00, 0x3b };
+static const BYTE gif_2frame_missing_gce1[] = { +'G','I','F','8','7','a', 0x01,0x00, 0x01,0x00, 0x21, 0x02, 0x00, +0x2c, 0x00,0x00, 0x00,0x00, 0x01,0x00, 0x01,0x00, 0x01, +0x02,0x02,0x44,0x01,0x00, +0x21,0xF9,0x04, 0x00,0x14,0x00,0x08, 0x00, +0x2c, 0x00,0x00, 0x00,0x00, 0x01,0x00, 0x01,0x00, 0x01, +0x02,0x02,0x44,0x01,0x00, 0x3b +}; + +static const BYTE gif_2frame_missing_gce2[] = { +'G','I','F','8','7','a', 0x01,0x00, 0x01,0x00, 0x21, 0x02, 0x00, +0x21,0xF9,0x04, 0x00,0x0A,0x00,0x08, 0x00, +0x2c, 0x00,0x00, 0x00,0x00, 0x01,0x00, 0x01,0x00, 0x01, +0x02,0x02,0x44,0x01,0x00, +0x2c, 0x00,0x00, 0x00,0x00, 0x01,0x00, 0x01,0x00, 0x01, +0x02,0x02,0x44,0x01,0x00, 0x3b +}; + static const BYTE gif_no_pal[] = { 'G','I','F','8','7','a', 0x01,0x00, 0x01,0x00, 0x27, 0x02, 0x00, 0x2c, 0x00,0x00, 0x00,0x00, 0x01,0x00, 0x01,0x00, 0x01, @@ -4888,6 +4906,16 @@ static void test_gif_properties(void) { PropertyTagTypeLong, PropertyTagFrameDelay, 8, { 10,0,0,0,20,0,0,0 } }, { PropertyTagTypeShort, PropertyTagLoopCount, 2, { 1,0 } }, }; + static const struct property_test_data gif_2frame_missing_gce1_props[] = + { + { PropertyTagTypeLong, PropertyTagFrameDelay, 8, { 0,0,0,0,20,0,0,0 } }, + { PropertyTagTypeShort, PropertyTagLoopCount, 2, { 1,0 } }, + }; + static const struct property_test_data gif_2frame_missing_gce2_props[] = + { + { PropertyTagTypeLong, PropertyTagFrameDelay, 8, { 10,0,0,0,10,0,0,0 } }, + { PropertyTagTypeShort, PropertyTagLoopCount, 2, { 1,0 } }, + }; static const struct property_test_data gif_no_pal_props[] = { { PropertyTagTypeLong, PropertyTagFrameDelay, 4, { 0,0,0,0 } }, @@ -4906,6 +4934,8 @@ static void test_gif_properties(void) giftest(animatedgif, animatedgif_props, 2), giftest(gif_2frame_global_pal, gif_2frame_global_pal_props, 2), giftest(gif_2frame_no_pal, gif_2frame_no_pal_props, 2), + giftest(gif_2frame_missing_gce1, gif_2frame_missing_gce1_props, 2), + giftest(gif_2frame_missing_gce2, gif_2frame_missing_gce2_props, 2), giftest(gif_no_pal, gif_no_pal_props, 1), #undef giftest };