Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
5c4ed986
Commit
5c4ed986
authored
Jul 02, 2012
by
Vincent Povirk
Committed by
Alexandre Julliard
Jul 03, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Implement IWICBitmapCodecInfo::GetPixelFormats.
parent
8dad0435
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
123 additions
and
4 deletions
+123
-4
info.c
dlls/windowscodecs/info.c
+69
-4
info.c
dlls/windowscodecs/tests/info.c
+54
-0
No files found.
dlls/windowscodecs/info.c
View file @
5c4ed986
...
...
@@ -42,6 +42,7 @@ static const WCHAR mimetypes_valuename[] = {'M','i','m','e','T','y','p','e','s',
static
const
WCHAR
author_valuename
[]
=
{
'A'
,
'u'
,
't'
,
'h'
,
'o'
,
'r'
,
0
};
static
const
WCHAR
friendlyname_valuename
[]
=
{
'F'
,
'r'
,
'i'
,
'e'
,
'n'
,
'd'
,
'l'
,
'y'
,
'N'
,
'a'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
pixelformats_keyname
[]
=
{
'P'
,
'i'
,
'x'
,
'e'
,
'l'
,
'F'
,
'o'
,
'r'
,
'm'
,
'a'
,
't'
,
's'
,
0
};
static
const
WCHAR
formats_keyname
[]
=
{
'F'
,
'o'
,
'r'
,
'm'
,
'a'
,
't'
,
's'
,
0
};
static
const
WCHAR
containerformat_valuename
[]
=
{
'C'
,
'o'
,
'n'
,
't'
,
'a'
,
'i'
,
'n'
,
'e'
,
'r'
,
'F'
,
'o'
,
'r'
,
'm'
,
'a'
,
't'
,
0
};
static
const
WCHAR
metadataformat_valuename
[]
=
{
'M'
,
'e'
,
't'
,
'a'
,
'd'
,
'a'
,
't'
,
'a'
,
'F'
,
'o'
,
'r'
,
'm'
,
'a'
,
't'
,
0
};
static
const
WCHAR
vendor_valuename
[]
=
{
'V'
,
'e'
,
'n'
,
'd'
,
'o'
,
'r'
,
0
};
...
...
@@ -135,6 +136,68 @@ static HRESULT ComponentInfo_GetDWORDValue(HKEY classkey, LPCWSTR value,
return
HRESULT_FROM_WIN32
(
ret
);
}
static
HRESULT
ComponentInfo_GetGuidList
(
HKEY
classkey
,
LPCWSTR
subkeyname
,
UINT
buffersize
,
GUID
*
buffer
,
UINT
*
actual_size
)
{
LONG
ret
;
HKEY
subkey
;
UINT
items_returned
;
WCHAR
guid_string
[
39
];
DWORD
guid_string_size
;
HRESULT
hr
=
S_OK
;
if
(
!
actual_size
)
return
E_INVALIDARG
;
ret
=
RegOpenKeyExW
(
classkey
,
subkeyname
,
0
,
KEY_READ
,
&
subkey
);
if
(
ret
!=
ERROR_SUCCESS
)
return
HRESULT_FROM_WIN32
(
ret
);
if
(
buffer
)
{
items_returned
=
0
;
guid_string_size
=
39
;
while
(
items_returned
<
buffersize
)
{
ret
=
RegEnumKeyExW
(
subkey
,
items_returned
,
guid_string
,
&
guid_string_size
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
ret
!=
ERROR_SUCCESS
)
{
hr
=
HRESULT_FROM_WIN32
(
ret
);
break
;
}
if
(
guid_string_size
!=
38
)
{
hr
=
E_FAIL
;
break
;
}
hr
=
CLSIDFromString
(
guid_string
,
&
buffer
[
items_returned
]);
if
(
FAILED
(
hr
))
break
;
items_returned
++
;
guid_string_size
=
39
;
}
if
(
ret
==
ERROR_NO_MORE_ITEMS
)
hr
=
S_OK
;
*
actual_size
=
items_returned
;
}
else
{
ret
=
RegQueryInfoKeyW
(
subkey
,
NULL
,
NULL
,
NULL
,
actual_size
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
ret
!=
ERROR_SUCCESS
)
hr
=
HRESULT_FROM_WIN32
(
ret
);
}
RegCloseKey
(
subkey
);
return
hr
;
}
typedef
struct
{
IWICBitmapDecoderInfo
IWICBitmapDecoderInfo_iface
;
LONG
ref
;
...
...
@@ -290,8 +353,9 @@ static HRESULT WINAPI BitmapDecoderInfo_GetContainerFormat(IWICBitmapDecoderInfo
static
HRESULT
WINAPI
BitmapDecoderInfo_GetPixelFormats
(
IWICBitmapDecoderInfo
*
iface
,
UINT
cFormats
,
GUID
*
pguidPixelFormats
,
UINT
*
pcActual
)
{
FIXME
(
"(%p,%u,%p,%p): stub
\n
"
,
iface
,
cFormats
,
pguidPixelFormats
,
pcActual
);
return
E_NOTIMPL
;
BitmapDecoderInfo
*
This
=
impl_from_IWICBitmapDecoderInfo
(
iface
);
TRACE
(
"(%p,%u,%p,%p)
\n
"
,
iface
,
cFormats
,
pguidPixelFormats
,
pcActual
);
return
ComponentInfo_GetGuidList
(
This
->
classkey
,
formats_keyname
,
cFormats
,
pguidPixelFormats
,
pcActual
);
}
static
HRESULT
WINAPI
BitmapDecoderInfo_GetColorManagementVersion
(
IWICBitmapDecoderInfo
*
iface
,
...
...
@@ -755,8 +819,9 @@ static HRESULT WINAPI BitmapEncoderInfo_GetContainerFormat(IWICBitmapEncoderInfo
static
HRESULT
WINAPI
BitmapEncoderInfo_GetPixelFormats
(
IWICBitmapEncoderInfo
*
iface
,
UINT
cFormats
,
GUID
*
pguidPixelFormats
,
UINT
*
pcActual
)
{
FIXME
(
"(%p,%u,%p,%p): stub
\n
"
,
iface
,
cFormats
,
pguidPixelFormats
,
pcActual
);
return
E_NOTIMPL
;
BitmapEncoderInfo
*
This
=
impl_from_IWICBitmapEncoderInfo
(
iface
);
TRACE
(
"(%p,%u,%p,%p)
\n
"
,
iface
,
cFormats
,
pguidPixelFormats
,
pcActual
);
return
ComponentInfo_GetGuidList
(
This
->
classkey
,
formats_keyname
,
cFormats
,
pguidPixelFormats
,
pcActual
);
}
static
HRESULT
WINAPI
BitmapEncoderInfo_GetColorManagementVersion
(
IWICBitmapEncoderInfo
*
iface
,
...
...
dlls/windowscodecs/tests/info.c
View file @
5c4ed986
...
...
@@ -63,6 +63,23 @@ static HRESULT get_component_info(const GUID *clsid, IWICComponentInfo **result)
return
hr
;
}
static
int
is_pixelformat
(
GUID
*
format
)
{
IWICComponentInfo
*
info
;
HRESULT
hr
;
WICComponentType
componenttype
;
hr
=
get_component_info
(
format
,
&
info
);
if
(
FAILED
(
hr
))
return
FALSE
;
hr
=
IWICComponentInfo_GetComponentType
(
info
,
&
componenttype
);
IWICComponentInfo_Release
(
info
);
return
SUCCEEDED
(
hr
)
&&
componenttype
==
WICPixelFormat
;
}
static
void
test_decoder_info
(
void
)
{
IWICComponentInfo
*
info
;
...
...
@@ -72,6 +89,9 @@ static void test_decoder_info(void)
WCHAR
value
[
256
];
const
WCHAR
expected_mimetype
[]
=
{
'i'
,
'm'
,
'a'
,
'g'
,
'e'
,
'/'
,
'b'
,
'm'
,
'p'
,
0
};
CLSID
clsid
;
GUID
pixelformats
[
20
];
UINT
num_formats
,
count
;
int
i
;
hr
=
get_component_info
(
&
CLSID_WICBmpDecoder
,
&
info
);
...
...
@@ -114,6 +134,40 @@ static void test_decoder_info(void)
ok
(
lstrcmpW
(
value
,
expected_mimetype
)
==
0
,
"GetMimeType returned wrong value %s
\n
"
,
wine_dbgstr_w
(
value
));
ok
(
len
==
lstrlenW
(
expected_mimetype
)
+
1
,
"GetMimeType returned wrong len %i
\n
"
,
len
);
num_formats
=
0xdeadbeef
;
hr
=
IWICBitmapDecoderInfo_GetPixelFormats
(
decoder_info
,
0
,
NULL
,
&
num_formats
);
ok
(
hr
==
S_OK
,
"GetPixelFormats failed, hr=%x
\n
"
,
hr
);
ok
(
num_formats
<
20
&&
num_formats
>
1
,
"got %d formats
\n
"
,
num_formats
);
hr
=
IWICBitmapDecoderInfo_GetPixelFormats
(
decoder_info
,
0
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"GetPixelFormats failed, hr=%x
\n
"
,
hr
);
count
=
0xdeadbeef
;
hr
=
IWICBitmapDecoderInfo_GetPixelFormats
(
decoder_info
,
0
,
pixelformats
,
&
count
);
ok
(
hr
==
S_OK
,
"GetPixelFormats failed, hr=%x
\n
"
,
hr
);
ok
(
count
==
0
,
"got %d formats
\n
"
,
count
);
count
=
0xdeadbeef
;
hr
=
IWICBitmapDecoderInfo_GetPixelFormats
(
decoder_info
,
1
,
pixelformats
,
&
count
);
ok
(
hr
==
S_OK
,
"GetPixelFormats failed, hr=%x
\n
"
,
hr
);
ok
(
count
==
1
,
"got %d formats
\n
"
,
count
);
ok
(
is_pixelformat
(
&
pixelformats
[
0
]),
"got invalid pixel format
\n
"
);
count
=
0xdeadbeef
;
hr
=
IWICBitmapDecoderInfo_GetPixelFormats
(
decoder_info
,
num_formats
,
pixelformats
,
&
count
);
ok
(
hr
==
S_OK
,
"GetPixelFormats failed, hr=%x
\n
"
,
hr
);
ok
(
count
==
num_formats
,
"got %d formats, expected %d
\n
"
,
count
,
num_formats
);
for
(
i
=
0
;
i
<
num_formats
;
i
++
)
ok
(
is_pixelformat
(
&
pixelformats
[
i
]),
"got invalid pixel format
\n
"
);
hr
=
IWICBitmapDecoderInfo_GetPixelFormats
(
decoder_info
,
num_formats
,
pixelformats
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"GetPixelFormats failed, hr=%x
\n
"
,
hr
);
count
=
0xdeadbeef
;
hr
=
IWICBitmapDecoderInfo_GetPixelFormats
(
decoder_info
,
20
,
pixelformats
,
&
count
);
ok
(
hr
==
S_OK
,
"GetPixelFormats failed, hr=%x
\n
"
,
hr
);
ok
(
count
==
num_formats
,
"got %d formats, expected %d
\n
"
,
count
,
num_formats
);
IWICBitmapDecoderInfo_Release
(
decoder_info
);
IWICComponentInfo_Release
(
info
);
...
...
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