Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aleksandr Isakov
wine-fonts
Commits
faa24d96
Commit
faa24d96
authored
Sep 25, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Sep 25, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Add GIF loopcount to the image properties.
parent
54edca19
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
1 deletion
+60
-1
image.c
dlls/gdiplus/image.c
+60
-1
No files found.
dlls/gdiplus/image.c
View file @
faa24d96
...
...
@@ -3222,6 +3222,47 @@ static PropertyItem *get_gif_comment(IWICMetadataReader *reader)
return
comment
;
}
static
PropertyItem
*
get_gif_loopcount
(
IWICMetadataReader
*
reader
)
{
static
const
WCHAR
applicationW
[]
=
{
'A'
,
'p'
,
'p'
,
'l'
,
'i'
,
'c'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
const
WCHAR
dataW
[]
=
{
'D'
,
'a'
,
't'
,
'a'
,
0
};
PropertyItem
*
appext
=
NULL
,
*
appdata
=
NULL
,
*
loop
=
NULL
;
appext
=
get_property
(
reader
,
&
GUID_MetadataFormatAPE
,
applicationW
);
if
(
appext
)
{
if
(
appext
->
type
==
PropertyTagTypeByte
&&
appext
->
length
==
11
&&
(
!
memcmp
(
appext
->
value
,
"NETSCAPE2.0"
,
11
)
||
!
memcmp
(
appext
->
value
,
"ANIMEXTS1.0"
,
11
)))
{
appdata
=
get_property
(
reader
,
&
GUID_MetadataFormatAPE
,
dataW
);
if
(
appdata
)
{
if
(
appdata
->
type
==
PropertyTagTypeByte
&&
appdata
->
length
==
4
)
{
BYTE
*
data
=
appdata
->
value
;
if
(
data
[
0
]
==
3
&&
data
[
1
]
==
1
)
{
loop
=
GdipAlloc
(
sizeof
(
*
loop
)
+
sizeof
(
SHORT
));
if
(
loop
)
{
loop
->
type
=
PropertyTagTypeShort
;
loop
->
id
=
PropertyTagLoopCount
;
loop
->
length
=
sizeof
(
SHORT
);
loop
->
value
=
loop
+
1
;
*
(
SHORT
*
)
loop
->
value
=
data
[
2
]
|
(
data
[
3
]
<<
8
);
}
}
}
}
}
}
GdipFree
(
appext
);
GdipFree
(
appdata
);
return
loop
;
}
static
PropertyItem
*
get_gif_background
(
IWICMetadataReader
*
reader
)
{
static
const
WCHAR
backgroundW
[]
=
{
'B'
,
'a'
,
'c'
,
'k'
,
'g'
,
'r'
,
'o'
,
'u'
,
'n'
,
'd'
,
'C'
,
'o'
,
'l'
,
'o'
,
'r'
,
'I'
,
'n'
,
'd'
,
'e'
,
'x'
,
0
};
...
...
@@ -3296,7 +3337,7 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
IWICMetadataReader
*
reader
;
UINT
frame_count
,
block_count
,
i
;
PropertyItem
*
delay
=
NULL
,
*
comment
=
NULL
,
*
background
=
NULL
;
PropertyItem
*
transparent_idx
=
NULL
;
PropertyItem
*
transparent_idx
=
NULL
,
*
loop
=
NULL
;
IWICBitmapDecoder_GetFrameCount
(
decoder
,
&
frame_count
);
if
(
frame_count
>
1
)
...
...
@@ -3340,6 +3381,9 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
if
(
!
comment
)
comment
=
get_gif_comment
(
reader
);
if
(
frame_count
>
1
&&
!
loop
)
loop
=
get_gif_loopcount
(
reader
);
if
(
!
background
)
background
=
get_gif_background
(
reader
);
...
...
@@ -3350,12 +3394,27 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
IWICMetadataBlockReader_Release
(
block_reader
);
}
if
(
frame_count
>
1
&&
!
loop
)
{
loop
=
GdipAlloc
(
sizeof
(
*
loop
)
+
sizeof
(
SHORT
));
if
(
loop
)
{
loop
->
type
=
PropertyTagTypeShort
;
loop
->
id
=
PropertyTagLoopCount
;
loop
->
length
=
sizeof
(
SHORT
);
loop
->
value
=
loop
+
1
;
*
(
SHORT
*
)
loop
->
value
=
1
;
}
}
if
(
delay
)
add_property
(
bitmap
,
delay
);
if
(
comment
)
add_property
(
bitmap
,
comment
);
if
(
loop
)
add_property
(
bitmap
,
loop
);
if
(
background
)
add_property
(
bitmap
,
background
);
GdipFree
(
delay
);
GdipFree
(
comment
);
GdipFree
(
loop
);
GdipFree
(
background
);
/* Win7 gdiplus always returns transparent color index from frame 0 */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment