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
5a5e0e93
Commit
5a5e0e93
authored
Aug 22, 2009
by
Vincent Povirk
Committed by
Alexandre Julliard
Aug 24, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Avoid copying the data when loading an image using WIC.
parent
616b2727
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
28 deletions
+30
-28
olepicture.c
dlls/oleaut32/olepicture.c
+30
-28
No files found.
dlls/oleaut32/olepicture.c
View file @
5a5e0e93
...
@@ -1319,48 +1319,50 @@ end:
...
@@ -1319,48 +1319,50 @@ end:
static
HRESULT
OLEPictureImpl_LoadWICDecoder
(
OLEPictureImpl
*
This
,
REFCLSID
decoder_clsid
,
BYTE
*
xbuf
,
ULONG
xread
)
static
HRESULT
OLEPictureImpl_LoadWICDecoder
(
OLEPictureImpl
*
This
,
REFCLSID
decoder_clsid
,
BYTE
*
xbuf
,
ULONG
xread
)
{
{
HRESULT
hr
;
HRESULT
hr
;
IWICImagingFactory
*
factory
;
IWICBitmapDecoder
*
decoder
;
IWICBitmapDecoder
*
decoder
;
IWICBitmapFrameDecode
*
framedecode
;
IWICBitmapFrameDecode
*
framedecode
;
HRESULT
initresult
;
HRESULT
initresult
;
HGLOBAL
hdata
;
IWICStream
*
stream
;
BYTE
*
data
;
IStream
*
stream
;
hdata
=
GlobalAlloc
(
GMEM_MOVEABLE
,
xread
);
initresult
=
CoInitialize
(
NULL
);
if
(
!
hdata
)
return
E_OUTOFMEMORY
;
data
=
GlobalLock
(
hdata
);
memcpy
(
data
,
xbuf
,
xread
);
GlobalUnlock
(
hdata
);
hr
=
CreateStreamOnHGlobal
(
hdata
,
TRUE
,
&
stream
);
hr
=
CoCreateInstance
(
&
CLSID_WICImagingFactory
,
NULL
,
CLSCTX_INPROC_SERVER
,
if
(
FAILED
(
hr
))
&
IID_IWICImagingFactory
,
(
void
**
)
&
factory
);
if
(
SUCCEEDED
(
hr
))
/* created factory */
{
{
GlobalFree
(
hdata
);
hr
=
IWICImagingFactory_CreateStream
(
factory
,
&
stream
);
return
hr
;
IWICImagingFactory_Release
(
factory
)
;
}
}
initresult
=
CoInitialize
(
NULL
);
if
(
SUCCEEDED
(
hr
))
/* created stream */
hr
=
CoCreateInstance
(
decoder_clsid
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IWICBitmapDecoder
,
(
void
**
)
&
decoder
);
if
(
FAILED
(
hr
))
goto
end
;
hr
=
IWICBitmapDecoder_Initialize
(
decoder
,
stream
,
WICDecodeMetadataCacheOnLoad
);
if
(
SUCCEEDED
(
hr
))
{
{
hr
=
IWICBitmapDecoder_GetFrame
(
decoder
,
0
,
&
framedecode
);
hr
=
IWICStream_InitializeFromMemory
(
stream
,
xbuf
,
xread
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
/* initialized stream */
{
{
hr
=
OLEPictureImpl_LoadWICSource
(
This
,
(
IWICBitmapSource
*
)
framedecode
);
hr
=
CoCreateInstance
(
decoder_clsid
,
NULL
,
CLSCTX_INPROC_SERVER
,
IWICBitmapFrameDecode_Release
(
framedecode
);
&
IID_IWICBitmapDecoder
,
(
void
**
)
&
decoder
);
if
(
SUCCEEDED
(
hr
))
/* created decoder */
{
hr
=
IWICBitmapDecoder_Initialize
(
decoder
,
(
IStream
*
)
stream
,
WICDecodeMetadataCacheOnLoad
);
if
(
SUCCEEDED
(
hr
))
/* initialized decoder */
hr
=
IWICBitmapDecoder_GetFrame
(
decoder
,
0
,
&
framedecode
);
IWICBitmapDecoder_Release
(
decoder
);
}
}
}
IWICStream_Release
(
stream
);
}
}
IWICBitmapDecoder_Release
(
decoder
);
if
(
SUCCEEDED
(
hr
))
/* got framedecode */
{
hr
=
OLEPictureImpl_LoadWICSource
(
This
,
(
IWICBitmapSource
*
)
framedecode
);
IWICBitmapFrameDecode_Release
(
framedecode
);
}
end:
IStream_Release
(
stream
);
if
(
SUCCEEDED
(
initresult
))
CoUninitialize
();
if
(
SUCCEEDED
(
initresult
))
CoUninitialize
();
return
hr
;
return
hr
;
}
}
...
...
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