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
03724685
Commit
03724685
authored
Jan 04, 2013
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jan 04, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Implement ComponentFactory_CreateBitmapFromMemory.
parent
44b462c9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
19 deletions
+24
-19
bitmap.c
dlls/windowscodecs/bitmap.c
+8
-3
imgfactory.c
dlls/windowscodecs/imgfactory.c
+11
-7
bitmap.c
dlls/windowscodecs/tests/bitmap.c
+4
-9
wincodecs_private.h
dlls/windowscodecs/wincodecs_private.h
+1
-0
No files found.
dlls/windowscodecs/bitmap.c
View file @
03724685
...
...
@@ -447,19 +447,23 @@ static const IWICBitmapVtbl BitmapImpl_Vtbl = {
};
HRESULT
BitmapImpl_Create
(
UINT
uiWidth
,
UINT
uiHeight
,
UINT
stride
,
UINT
datasize
,
BYTE
*
bits
,
REFWICPixelFormatGUID
pixelFormat
,
WICBitmapCreateCacheOption
option
,
IWICBitmap
**
ppIBitmap
)
{
HRESULT
hr
;
BitmapImpl
*
This
;
UINT
bpp
,
stride
,
datasize
;
BYTE
*
data
;
UINT
bpp
;
hr
=
get_pixelformat_bpp
(
pixelFormat
,
&
bpp
);
if
(
FAILED
(
hr
))
return
hr
;
stride
=
(((
bpp
*
uiWidth
)
+
31
)
/
32
)
*
4
;
datasize
=
stride
*
uiHeight
;
if
(
!
stride
)
stride
=
(((
bpp
*
uiWidth
)
+
31
)
/
32
)
*
4
;
if
(
!
datasize
)
datasize
=
stride
*
uiHeight
;
if
(
datasize
<
stride
*
uiHeight
)
return
WINCODEC_ERR_INSUFFICIENTBUFFER
;
if
(
stride
<
((
bpp
*
uiWidth
)
+
7
)
/
8
)
return
E_INVALIDARG
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BitmapImpl
));
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
datasize
);
...
...
@@ -469,6 +473,7 @@ HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight,
HeapFree
(
GetProcessHeap
(),
0
,
data
);
return
E_OUTOFMEMORY
;
}
if
(
bits
)
memcpy
(
data
,
bits
,
datasize
);
This
->
IWICBitmap_iface
.
lpVtbl
=
&
BitmapImpl_Vtbl
;
This
->
ref
=
1
;
...
...
dlls/windowscodecs/imgfactory.c
View file @
03724685
/*
* Copyright 2009 Vincent Povirk for CodeWeavers
* Copyright 2012 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -459,7 +460,7 @@ static HRESULT WINAPI ComponentFactory_CreateBitmap(IWICComponentFactory *iface,
{
TRACE
(
"(%p,%u,%u,%s,%u,%p)
\n
"
,
iface
,
uiWidth
,
uiHeight
,
debugstr_guid
(
pixelFormat
),
option
,
ppIBitmap
);
return
BitmapImpl_Create
(
uiWidth
,
uiHeight
,
pixelFormat
,
option
,
ppIBitmap
);
return
BitmapImpl_Create
(
uiWidth
,
uiHeight
,
0
,
0
,
NULL
,
pixelFormat
,
option
,
ppIBitmap
);
}
static
HRESULT
WINAPI
ComponentFactory_CreateBitmapFromSource
(
IWICComponentFactory
*
iface
,
...
...
@@ -506,7 +507,7 @@ static HRESULT WINAPI ComponentFactory_CreateBitmapFromSource(IWICComponentFacto
}
if
(
SUCCEEDED
(
hr
))
hr
=
BitmapImpl_Create
(
width
,
height
,
&
pixelformat
,
option
,
&
result
);
hr
=
BitmapImpl_Create
(
width
,
height
,
0
,
0
,
NULL
,
&
pixelformat
,
option
,
&
result
);
if
(
SUCCEEDED
(
hr
))
{
...
...
@@ -576,12 +577,15 @@ static HRESULT WINAPI ComponentFactory_CreateBitmapFromSourceRect(IWICComponentF
}
static
HRESULT
WINAPI
ComponentFactory_CreateBitmapFromMemory
(
IWICComponentFactory
*
iface
,
UINT
uiWidth
,
UINT
uiHeight
,
REFWICPixelFormatGUID
pixelFormat
,
UINT
cbS
tride
,
UINT
cbBufferSize
,
BYTE
*
pbBuffer
,
IWICBitmap
**
ppIB
itmap
)
UINT
width
,
UINT
height
,
REFWICPixelFormatGUID
format
,
UINT
s
tride
,
UINT
size
,
BYTE
*
buffer
,
IWICBitmap
**
b
itmap
)
{
FIXME
(
"(%p,%u,%u,%s,%u,%u,%p,%p): stub
\n
"
,
iface
,
uiWidth
,
uiHeight
,
debugstr_guid
(
pixelFormat
),
cbStride
,
cbBufferSize
,
pbBuffer
,
ppIBitmap
);
return
E_NOTIMPL
;
TRACE
(
"(%p,%u,%u,%s,%u,%u,%p,%p
\n
"
,
iface
,
width
,
height
,
debugstr_guid
(
format
),
stride
,
size
,
buffer
,
bitmap
);
if
(
!
stride
||
!
size
||
!
buffer
||
!
bitmap
)
return
E_INVALIDARG
;
return
BitmapImpl_Create
(
width
,
height
,
stride
,
size
,
buffer
,
format
,
WICBitmapCacheOnLoad
,
bitmap
);
}
static
HRESULT
WINAPI
ComponentFactory_CreateBitmapFromHBITMAP
(
IWICComponentFactory
*
iface
,
...
...
dlls/windowscodecs/tests/bitmap.c
View file @
03724685
...
...
@@ -439,34 +439,27 @@ static void test_CreateBitmapFromMemory(void)
hr
=
IWICImagingFactory_CreateBitmapFromMemory
(
factory
,
3
,
3
,
&
GUID_WICPixelFormat24bppBGR
,
0
,
0
,
NULL
,
&
bitmap
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %#x
\n
"
,
hr
);
hr
=
IWICImagingFactory_CreateBitmapFromMemory
(
factory
,
3
,
3
,
&
GUID_WICPixelFormat24bppBGR
,
0
,
sizeof
(
data3x3
),
data3x3
,
&
bitmap
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %#x
\n
"
,
hr
);
hr
=
IWICImagingFactory_CreateBitmapFromMemory
(
factory
,
3
,
3
,
&
GUID_WICPixelFormat24bppBGR
,
6
,
sizeof
(
data3x3
),
data3x3
,
&
bitmap
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %#x
\n
"
,
hr
);
hr
=
IWICImagingFactory_CreateBitmapFromMemory
(
factory
,
3
,
3
,
&
GUID_WICPixelFormat24bppBGR
,
12
,
sizeof
(
data3x3
),
data3x3
,
&
bitmap
);
todo_wine
ok
(
hr
==
WINCODEC_ERR_INSUFFICIENTBUFFER
,
"expected WINCODEC_ERR_INSUFFICIENTBUFFER, got %#x
\n
"
,
hr
);
hr
=
IWICImagingFactory_CreateBitmapFromMemory
(
factory
,
3
,
3
,
&
GUID_WICPixelFormat24bppBGR
,
9
,
sizeof
(
data3x3
)
-
1
,
data3x3
,
&
bitmap
);
todo_wine
ok
(
hr
==
WINCODEC_ERR_INSUFFICIENTBUFFER
,
"expected WINCODEC_ERR_INSUFFICIENTBUFFER, got %#x
\n
"
,
hr
);
hr
=
IWICImagingFactory_CreateBitmapFromMemory
(
factory
,
3
,
3
,
&
GUID_WICPixelFormat24bppBGR
,
9
,
sizeof
(
data3x3
),
data3x3
,
&
bitmap
);
todo_wine
ok
(
hr
==
S_OK
,
"IWICImagingFactory_CreateBitmapFromMemory error %#x
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
return
;
hr
=
IWICBitmap_GetSize
(
bitmap
,
&
width
,
&
height
);
ok
(
hr
==
S_OK
,
"IWICBitmap_GetSize error %#x
\n
"
,
hr
);
...
...
@@ -486,7 +479,6 @@ todo_wine
hr
=
IWICImagingFactory_CreateBitmapFromMemory
(
factory
,
3
,
2
,
&
GUID_WICPixelFormat24bppBGR
,
13
,
sizeof
(
orig_data3x3
),
orig_data3x3
,
&
bitmap
);
ok
(
hr
==
S_OK
,
"IWICImagingFactory_CreateBitmapFromMemory error %#x
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
return
;
hr
=
IWICBitmap_GetSize
(
bitmap
,
&
width
,
&
height
);
ok
(
hr
==
S_OK
,
"IWICBitmap_GetSize error %#x
\n
"
,
hr
);
...
...
@@ -497,7 +489,10 @@ todo_wine
hr
=
IWICBitmap_CopyPixels
(
bitmap
,
NULL
,
13
,
sizeof
(
data
),
data
);
ok
(
hr
==
S_OK
,
"IWICBitmap_CopyPixels error %#x
\n
"
,
hr
);
for
(
i
=
0
;
i
<
sizeof
(
data
);
i
++
)
ok
(
data
[
i
]
==
data3x2
[
i
],
"%u: expected %u, got %u
\n
"
,
i
,
data3x2
[
i
],
data
[
i
]);
if
((
i
%
13
)
<
9
)
ok
(
data
[
i
]
==
data3x2
[
i
],
"%u: expected %u, got %u
\n
"
,
i
,
data3x2
[
i
],
data
[
i
]);
else
todo_wine
ok
(
data
[
i
]
==
data3x2
[
i
],
"%u: expected %u, got %u
\n
"
,
i
,
data3x2
[
i
],
data
[
i
]);
IWICBitmap_Release
(
bitmap
);
}
...
...
dlls/windowscodecs/wincodecs_private.h
View file @
03724685
...
...
@@ -45,6 +45,7 @@ extern HRESULT IcnsEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void*
extern
HRESULT
TgaDecoder_CreateInstance
(
IUnknown
*
pUnkOuter
,
REFIID
iid
,
void
**
ppv
)
DECLSPEC_HIDDEN
;
extern
HRESULT
BitmapImpl_Create
(
UINT
uiWidth
,
UINT
uiHeight
,
UINT
stride
,
UINT
datasize
,
BYTE
*
bits
,
REFWICPixelFormatGUID
pixelFormat
,
WICBitmapCreateCacheOption
option
,
IWICBitmap
**
ppIBitmap
)
DECLSPEC_HIDDEN
;
extern
HRESULT
BitmapScaler_Create
(
IWICBitmapScaler
**
scaler
)
DECLSPEC_HIDDEN
;
...
...
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