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
3d914c4f
Commit
3d914c4f
authored
Apr 09, 2010
by
Vincent Povirk
Committed by
Alexandre Julliard
Apr 12, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Combine the bitmap decoder and bitmap decoder frame objects.
parent
7ce7ce82
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
68 deletions
+32
-68
bmpdecode.c
dlls/windowscodecs/bmpdecode.c
+32
-68
No files found.
dlls/windowscodecs/bmpdecode.c
View file @
3d914c4f
...
...
@@ -58,12 +58,14 @@ typedef struct {
DWORD
bc2AppData
;
}
BITMAPCOREHEADER2
;
struct
Bmp
FrameDecode
;
typedef
HRESULT
(
*
ReadDataFunc
)(
struct
Bmp
FrameDecode
*
This
);
struct
Bmp
Decoder
;
typedef
HRESULT
(
*
ReadDataFunc
)(
struct
Bmp
Decoder
*
This
);
typedef
struct
BmpFrameDecode
{
const
IWICBitmapFrameDecodeVtbl
*
lpVtbl
;
typedef
struct
BmpDecoder
{
const
IWICBitmapDecoderVtbl
*
lpVtbl
;
const
IWICBitmapFrameDecodeVtbl
*
lpFrameVtbl
;
LONG
ref
;
BOOL
initialized
;
IStream
*
stream
;
BITMAPFILEHEADER
bfh
;
BITMAPV5HEADER
bih
;
...
...
@@ -73,12 +75,16 @@ typedef struct BmpFrameDecode {
INT
stride
;
BYTE
*
imagedata
;
BYTE
*
imagedatastart
;
}
BmpFrameDecode
;
}
BmpDecoder
;
static
inline
BmpDecoder
*
impl_from_frame
(
IWICBitmapFrameDecode
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
BmpDecoder
,
lpFrameVtbl
);
}
static
HRESULT
WINAPI
BmpFrameDecode_QueryInterface
(
IWICBitmapFrameDecode
*
iface
,
REFIID
iid
,
void
**
ppv
)
{
BmpFrameDecode
*
This
=
(
BmpFrameDecode
*
)
iface
;
TRACE
(
"(%p,%s,%p)
\n
"
,
iface
,
debugstr_guid
(
iid
),
ppv
);
if
(
!
ppv
)
return
E_INVALIDARG
;
...
...
@@ -87,7 +93,7 @@ static HRESULT WINAPI BmpFrameDecode_QueryInterface(IWICBitmapFrameDecode *iface
IsEqualIID
(
&
IID_IWICBitmapSource
,
iid
)
||
IsEqualIID
(
&
IID_IWICBitmapFrameDecode
,
iid
))
{
*
ppv
=
This
;
*
ppv
=
iface
;
}
else
{
...
...
@@ -101,35 +107,22 @@ static HRESULT WINAPI BmpFrameDecode_QueryInterface(IWICBitmapFrameDecode *iface
static
ULONG
WINAPI
BmpFrameDecode_AddRef
(
IWICBitmapFrameDecode
*
iface
)
{
BmpFrameDecode
*
This
=
(
BmpFrameDecode
*
)
iface
;
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p) refcount=%u
\n
"
,
iface
,
ref
);
BmpDecoder
*
This
=
impl_from_frame
(
iface
);
return
ref
;
return
IUnknown_AddRef
((
IUnknown
*
)
This
)
;
}
static
ULONG
WINAPI
BmpFrameDecode_Release
(
IWICBitmapFrameDecode
*
iface
)
{
BmpFrameDecode
*
This
=
(
BmpFrameDecode
*
)
iface
;
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p) refcount=%u
\n
"
,
iface
,
ref
);
if
(
ref
==
0
)
{
IStream_Release
(
This
->
stream
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
imagedata
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
BmpDecoder
*
This
=
impl_from_frame
(
iface
);
return
ref
;
return
IUnknown_Release
((
IUnknown
*
)
This
)
;
}
static
HRESULT
WINAPI
BmpFrameDecode_GetSize
(
IWICBitmapFrameDecode
*
iface
,
UINT
*
puiWidth
,
UINT
*
puiHeight
)
{
Bmp
FrameDecode
*
This
=
(
BmpFrameDecode
*
)
iface
;
Bmp
Decoder
*
This
=
impl_from_frame
(
iface
)
;
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
puiWidth
,
puiHeight
);
if
(
This
->
bih
.
bV5Size
==
sizeof
(
BITMAPCOREHEADER
))
...
...
@@ -149,7 +142,7 @@ static HRESULT WINAPI BmpFrameDecode_GetSize(IWICBitmapFrameDecode *iface,
static
HRESULT
WINAPI
BmpFrameDecode_GetPixelFormat
(
IWICBitmapFrameDecode
*
iface
,
WICPixelFormatGUID
*
pPixelFormat
)
{
Bmp
FrameDecode
*
This
=
(
BmpFrameDecode
*
)
iface
;
Bmp
Decoder
*
This
=
impl_from_frame
(
iface
)
;
TRACE
(
"(%p,%p)
\n
"
,
iface
,
pPixelFormat
);
memcpy
(
pPixelFormat
,
This
->
pixelformat
,
sizeof
(
GUID
));
...
...
@@ -180,7 +173,7 @@ static HRESULT BmpHeader_GetResolution(BITMAPV5HEADER *bih, double *pDpiX, doubl
static
HRESULT
WINAPI
BmpFrameDecode_GetResolution
(
IWICBitmapFrameDecode
*
iface
,
double
*
pDpiX
,
double
*
pDpiY
)
{
Bmp
FrameDecode
*
This
=
(
BmpFrameDecode
*
)
iface
;
Bmp
Decoder
*
This
=
impl_from_frame
(
iface
)
;
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
pDpiX
,
pDpiY
);
return
BmpHeader_GetResolution
(
&
This
->
bih
,
pDpiX
,
pDpiY
);
...
...
@@ -190,7 +183,7 @@ static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface,
IWICPalette
*
pIPalette
)
{
HRESULT
hr
;
Bmp
FrameDecode
*
This
=
(
BmpFrameDecode
*
)
iface
;
Bmp
Decoder
*
This
=
impl_from_frame
(
iface
)
;
int
count
;
WICColor
*
wiccolors
=
NULL
;
RGBTRIPLE
*
bgrcolors
=
NULL
;
...
...
@@ -290,7 +283,7 @@ end:
static
HRESULT
WINAPI
BmpFrameDecode_CopyPixels
(
IWICBitmapFrameDecode
*
iface
,
const
WICRect
*
prc
,
UINT
cbStride
,
UINT
cbBufferSize
,
BYTE
*
pbBuffer
)
{
Bmp
FrameDecode
*
This
=
(
BmpFrameDecode
*
)
iface
;
Bmp
Decoder
*
This
=
impl_from_frame
(
iface
)
;
HRESULT
hr
;
UINT
width
,
height
;
TRACE
(
"(%p,%p,%u,%u,%p)
\n
"
,
iface
,
prc
,
cbStride
,
cbBufferSize
,
pbBuffer
);
...
...
@@ -330,7 +323,7 @@ static HRESULT WINAPI BmpFrameDecode_GetThumbnail(IWICBitmapFrameDecode *iface,
return
WINCODEC_ERR_CODECNOTHUMBNAIL
;
}
static
HRESULT
BmpFrameDecode_ReadUncompressed
(
Bmp
FrameDecode
*
This
)
static
HRESULT
BmpFrameDecode_ReadUncompressed
(
Bmp
Decoder
*
This
)
{
UINT
bytesperrow
;
UINT
width
,
height
;
...
...
@@ -387,7 +380,7 @@ fail:
return
hr
;
}
static
HRESULT
BmpFrameDecode_ReadRLE8
(
Bmp
FrameDecode
*
This
)
static
HRESULT
BmpFrameDecode_ReadRLE8
(
Bmp
Decoder
*
This
)
{
UINT
bytesperrow
;
UINT
width
,
height
;
...
...
@@ -493,7 +486,7 @@ fail:
return
hr
;
}
static
HRESULT
BmpFrameDecode_ReadRLE4
(
Bmp
FrameDecode
*
This
)
static
HRESULT
BmpFrameDecode_ReadRLE4
(
Bmp
Decoder
*
This
)
{
UINT
bytesperrow
;
UINT
width
,
height
;
...
...
@@ -614,7 +607,7 @@ fail:
return
hr
;
}
static
HRESULT
BmpFrameDecode_ReadUnsupported
(
Bmp
FrameDecode
*
This
)
static
HRESULT
BmpFrameDecode_ReadUnsupported
(
Bmp
Decoder
*
This
)
{
return
E_FAIL
;
}
...
...
@@ -637,7 +630,7 @@ static const struct bitfields_format bitfields_formats[] = {
{
0
}
};
static
const
IWICBitmapFrameDecodeVtbl
Bmp
FrameDecode_
Vtbl
=
{
static
const
IWICBitmapFrameDecodeVtbl
Bmp
Decoder_Frame
Vtbl
=
{
BmpFrameDecode_QueryInterface
,
BmpFrameDecode_AddRef
,
BmpFrameDecode_Release
,
...
...
@@ -651,19 +644,6 @@ static const IWICBitmapFrameDecodeVtbl BmpFrameDecode_Vtbl = {
BmpFrameDecode_GetThumbnail
};
typedef
struct
{
const
IWICBitmapDecoderVtbl
*
lpVtbl
;
LONG
ref
;
BOOL
initialized
;
IStream
*
stream
;
BITMAPFILEHEADER
bfh
;
BITMAPV5HEADER
bih
;
BmpFrameDecode
*
framedecode
;
const
WICPixelFormatGUID
*
pixelformat
;
int
bitsperpixel
;
ReadDataFunc
read_data_func
;
}
BmpDecoder
;
static
HRESULT
BmpDecoder_ReadHeaders
(
BmpDecoder
*
This
,
IStream
*
stream
)
{
HRESULT
hr
;
...
...
@@ -873,7 +853,7 @@ static ULONG WINAPI BmpDecoder_Release(IWICBitmapDecoder *iface)
if
(
ref
==
0
)
{
if
(
This
->
stream
)
IStream_Release
(
This
->
stream
);
if
(
This
->
framedecode
)
IUnknown_Release
((
IUnknown
*
)
This
->
framedecode
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
imagedata
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -992,25 +972,8 @@ static HRESULT WINAPI BmpDecoder_GetFrame(IWICBitmapDecoder *iface,
if
(
!
This
->
stream
)
return
WINCODEC_ERR_WRONGSTATE
;
if
(
!
This
->
framedecode
)
{
This
->
framedecode
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BmpFrameDecode
));
if
(
!
This
->
framedecode
)
return
E_OUTOFMEMORY
;
This
->
framedecode
->
lpVtbl
=
&
BmpFrameDecode_Vtbl
;
This
->
framedecode
->
ref
=
1
;
This
->
framedecode
->
stream
=
This
->
stream
;
IStream_AddRef
(
This
->
stream
);
This
->
framedecode
->
bfh
=
This
->
bfh
;
This
->
framedecode
->
bih
=
This
->
bih
;
This
->
framedecode
->
pixelformat
=
This
->
pixelformat
;
This
->
framedecode
->
bitsperpixel
=
This
->
bitsperpixel
;
This
->
framedecode
->
read_data_func
=
This
->
read_data_func
;
This
->
framedecode
->
imagedata
=
NULL
;
}
*
ppIBitmapFrame
=
(
IWICBitmapFrameDecode
*
)
This
->
framedecode
;
IWICBitmapFrameDecode_AddRef
((
IWICBitmapFrameDecode
*
)
This
->
framedecode
);
*
ppIBitmapFrame
=
(
IWICBitmapFrameDecode
*
)
&
This
->
lpFrameVtbl
;
IWICBitmapDecoder_AddRef
(
iface
);
return
S_OK
;
}
...
...
@@ -1047,10 +1010,11 @@ HRESULT BmpDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
lpVtbl
=
&
BmpDecoder_Vtbl
;
This
->
lpFrameVtbl
=
&
BmpDecoder_FrameVtbl
;
This
->
ref
=
1
;
This
->
initialized
=
FALSE
;
This
->
stream
=
NULL
;
This
->
framedecode
=
NULL
;
This
->
imagedata
=
NULL
;
ret
=
IUnknown_QueryInterface
((
IUnknown
*
)
This
,
iid
,
ppv
);
IUnknown_Release
((
IUnknown
*
)
This
);
...
...
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