Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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
wine
wine-winehq
Commits
0ef523e2
Commit
0ef523e2
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 palette to the image properties.
parent
faa24d96
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
2 deletions
+62
-2
image.c
dlls/gdiplus/image.c
+62
-1
image.c
dlls/gdiplus/tests/image.c
+0
-1
No files found.
dlls/gdiplus/image.c
View file @
0ef523e2
...
...
@@ -3275,6 +3275,62 @@ static PropertyItem *get_gif_background(IWICMetadataReader *reader)
return
background
;
}
static
PropertyItem
*
get_gif_palette
(
IWICBitmapDecoder
*
decoder
,
IWICMetadataReader
*
reader
)
{
static
const
WCHAR
global_flagW
[]
=
{
'G'
,
'l'
,
'o'
,
'b'
,
'a'
,
'l'
,
'C'
,
'o'
,
'l'
,
'o'
,
'r'
,
'T'
,
'a'
,
'b'
,
'l'
,
'e'
,
'F'
,
'l'
,
'a'
,
'g'
,
0
};
HRESULT
hr
;
IWICImagingFactory
*
factory
;
IWICPalette
*
palette
;
UINT
count
=
0
;
WICColor
colors
[
256
];
if
(
!
get_bool_property
(
reader
,
&
GUID_MetadataFormatLSD
,
global_flagW
))
return
NULL
;
hr
=
CoCreateInstance
(
&
CLSID_WICImagingFactory
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IWICImagingFactory
,
(
void
**
)
&
factory
);
if
(
hr
!=
S_OK
)
return
NULL
;
hr
=
IWICImagingFactory_CreatePalette
(
factory
,
&
palette
);
if
(
hr
==
S_OK
)
{
hr
=
IWICBitmapDecoder_CopyPalette
(
decoder
,
palette
);
if
(
hr
==
S_OK
)
IWICPalette_GetColors
(
palette
,
256
,
colors
,
&
count
);
IWICPalette_Release
(
palette
);
}
IWICImagingFactory_Release
(
factory
);
if
(
count
)
{
PropertyItem
*
pal
;
UINT
i
;
BYTE
*
rgb
;
pal
=
GdipAlloc
(
sizeof
(
*
pal
)
+
count
*
3
);
if
(
!
pal
)
return
NULL
;
pal
->
type
=
PropertyTagTypeByte
;
pal
->
id
=
PropertyTagGlobalPalette
;
pal
->
value
=
pal
+
1
;
pal
->
length
=
count
*
3
;
rgb
=
pal
->
value
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
rgb
[
i
*
3
]
=
(
colors
[
i
]
>>
16
)
&
0xff
;
rgb
[
i
*
3
+
1
]
=
(
colors
[
i
]
>>
8
)
&
0xff
;
rgb
[
i
*
3
+
2
]
=
colors
[
i
]
&
0xff
;
}
return
pal
;
}
return
NULL
;
}
static
PropertyItem
*
get_gif_transparent_idx
(
IWICMetadataReader
*
reader
)
{
static
const
WCHAR
transparency_flagW
[]
=
{
'T'
,
'r'
,
'a'
,
'n'
,
's'
,
'p'
,
'a'
,
'r'
,
'e'
,
'n'
,
'c'
,
'y'
,
'F'
,
'l'
,
'a'
,
'g'
,
0
};
...
...
@@ -3337,7 +3393,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
,
*
loop
=
NULL
;
PropertyItem
*
transparent_idx
=
NULL
,
*
loop
=
NULL
,
*
palette
=
NULL
;
IWICBitmapDecoder_GetFrameCount
(
decoder
,
&
frame_count
);
if
(
frame_count
>
1
)
...
...
@@ -3387,6 +3443,9 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
if
(
!
background
)
background
=
get_gif_background
(
reader
);
if
(
!
palette
)
palette
=
get_gif_palette
(
decoder
,
reader
);
IWICMetadataReader_Release
(
reader
);
}
}
...
...
@@ -3410,11 +3469,13 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
if
(
delay
)
add_property
(
bitmap
,
delay
);
if
(
comment
)
add_property
(
bitmap
,
comment
);
if
(
loop
)
add_property
(
bitmap
,
loop
);
if
(
palette
)
add_property
(
bitmap
,
palette
);
if
(
background
)
add_property
(
bitmap
,
background
);
GdipFree
(
delay
);
GdipFree
(
comment
);
GdipFree
(
loop
);
GdipFree
(
palette
);
GdipFree
(
background
);
/* Win7 gdiplus always returns transparent color index from frame 0 */
...
...
dlls/gdiplus/tests/image.c
View file @
0ef523e2
...
...
@@ -3988,7 +3988,6 @@ static void test_gif_properties(void)
status
=
GdipGetPropertyCount
(
image
,
&
prop_count
);
expect
(
Ok
,
status
);
todo_wine
ok
(
prop_count
==
sizeof
(
td
)
/
sizeof
(
td
[
0
])
||
broken
(
prop_count
==
1
)
/* before win7 */
,
"expected property count %u, got %u
\n
"
,
(
UINT
)(
sizeof
(
td
)
/
sizeof
(
td
[
0
])),
prop_count
);
...
...
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