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
cdc8e59b
Commit
cdc8e59b
authored
Jun 22, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jun 25, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Implement ImagingFactory_CreateDecoder.
parent
40185b6c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
104 additions
and
2 deletions
+104
-2
imgfactory.c
dlls/windowscodecs/imgfactory.c
+76
-2
bmpformat.c
dlls/windowscodecs/tests/bmpformat.c
+28
-0
No files found.
dlls/windowscodecs/imgfactory.c
View file @
cdc8e59b
...
...
@@ -252,9 +252,83 @@ static HRESULT WINAPI ComponentFactory_CreateDecoder(IWICComponentFactory *iface
REFGUID
guidContainerFormat
,
const
GUID
*
pguidVendor
,
IWICBitmapDecoder
**
ppIDecoder
)
{
FIXME
(
"(%p,%s,%s,%p): stub
\n
"
,
iface
,
debugstr_guid
(
guidContainerFormat
),
IEnumUnknown
*
enumdecoders
;
IUnknown
*
unkdecoderinfo
;
IWICBitmapDecoderInfo
*
decoderinfo
;
IWICBitmapDecoder
*
decoder
=
NULL
,
*
preferred_decoder
=
NULL
;
GUID
vendor
;
HRESULT
res
;
ULONG
num_fetched
;
TRACE
(
"(%p,%s,%s,%p)
\n
"
,
iface
,
debugstr_guid
(
guidContainerFormat
),
debugstr_guid
(
pguidVendor
),
ppIDecoder
);
return
E_NOTIMPL
;
if
(
!
guidContainerFormat
||
!
ppIDecoder
)
return
E_INVALIDARG
;
res
=
CreateComponentEnumerator
(
WICDecoder
,
WICComponentEnumerateDefault
,
&
enumdecoders
);
if
(
FAILED
(
res
))
return
res
;
while
(
!
preferred_decoder
)
{
res
=
IEnumUnknown_Next
(
enumdecoders
,
1
,
&
unkdecoderinfo
,
&
num_fetched
);
if
(
res
!=
S_OK
)
break
;
res
=
IUnknown_QueryInterface
(
unkdecoderinfo
,
&
IID_IWICBitmapDecoderInfo
,
(
void
**
)
&
decoderinfo
);
if
(
SUCCEEDED
(
res
))
{
GUID
container_guid
;
res
=
IWICBitmapDecoderInfo_GetContainerFormat
(
decoderinfo
,
&
container_guid
);
if
(
SUCCEEDED
(
res
)
&&
IsEqualIID
(
&
container_guid
,
guidContainerFormat
))
{
IWICBitmapDecoder
*
new_decoder
;
res
=
IWICBitmapDecoderInfo_CreateInstance
(
decoderinfo
,
&
new_decoder
);
if
(
SUCCEEDED
(
res
))
{
if
(
pguidVendor
)
{
res
=
IWICBitmapDecoderInfo_GetVendorGUID
(
decoderinfo
,
&
vendor
);
if
(
SUCCEEDED
(
res
)
&&
IsEqualIID
(
&
vendor
,
pguidVendor
))
{
preferred_decoder
=
new_decoder
;
new_decoder
=
NULL
;
}
}
if
(
new_decoder
&&
!
decoder
)
{
decoder
=
new_decoder
;
new_decoder
=
NULL
;
}
if
(
new_decoder
)
IWICBitmapDecoder_Release
(
new_decoder
);
}
}
IWICBitmapDecoderInfo_Release
(
decoderinfo
);
}
IUnknown_Release
(
unkdecoderinfo
);
}
IEnumUnknown_Release
(
enumdecoders
);
if
(
preferred_decoder
)
{
*
ppIDecoder
=
preferred_decoder
;
if
(
decoder
)
IWICBitmapDecoder_Release
(
decoder
);
return
S_OK
;
}
if
(
decoder
)
{
*
ppIDecoder
=
decoder
;
return
S_OK
;
}
*
ppIDecoder
=
NULL
;
return
WINCODEC_ERR_COMPONENTNOTFOUND
;
}
static
HRESULT
WINAPI
ComponentFactory_CreateEncoder
(
IWICComponentFactory
*
iface
,
...
...
dlls/windowscodecs/tests/bmpformat.c
View file @
cdc8e59b
...
...
@@ -1119,6 +1119,33 @@ static void test_gif_notrailer(void)
IWICImagingFactory_Release
(
factory
);
}
static
void
test_create_decoder
(
void
)
{
IWICBitmapDecoder
*
decoder
;
IWICImagingFactory
*
factory
;
HRESULT
hr
;
hr
=
CoCreateInstance
(
&
CLSID_WICImagingFactory
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IWICImagingFactory
,
(
void
**
)
&
factory
);
ok
(
hr
==
S_OK
,
"CoCreateInstance error %#x
\n
"
,
hr
);
hr
=
IWICImagingFactory_CreateDecoder
(
factory
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %#x
\n
"
,
hr
);
hr
=
IWICImagingFactory_CreateDecoder
(
factory
,
NULL
,
NULL
,
&
decoder
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %#x
\n
"
,
hr
);
hr
=
IWICImagingFactory_CreateDecoder
(
factory
,
&
GUID_ContainerFormatBmp
,
NULL
,
&
decoder
);
ok
(
hr
==
S_OK
,
"CreateDecoder error %#x
\n
"
,
hr
);
IWICBitmapDecoder_Release
(
decoder
);
hr
=
IWICImagingFactory_CreateDecoder
(
factory
,
&
GUID_ContainerFormatBmp
,
&
GUID_VendorMicrosoft
,
&
decoder
);
ok
(
hr
==
S_OK
,
"CreateDecoder error %#x
\n
"
,
hr
);
IWICBitmapDecoder_Release
(
decoder
);
IWICImagingFactory_Release
(
factory
);
}
START_TEST
(
bmpformat
)
{
CoInitializeEx
(
NULL
,
COINIT_APARTMENTTHREADED
);
...
...
@@ -1131,6 +1158,7 @@ START_TEST(bmpformat)
test_componentinfo
();
test_createfromstream
();
test_gif_notrailer
();
test_create_decoder
();
CoUninitialize
();
}
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