gdiplus: Set correct frame delay when GCE is missing.

This commit is contained in:
Jeff Smith 2023-07-19 22:35:52 -05:00 committed by Alexandre Julliard
parent 8c6e578864
commit 4245b1199c
2 changed files with 33 additions and 1 deletions

View file

@ -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;
}
}

View file

@ -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
};