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
2785e905
Commit
2785e905
authored
Jan 12, 2011
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jan 12, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Use ifaces instead of vtbl pointers in BmpDecoder.
parent
1515b36a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
27 deletions
+32
-27
bmpdecode.c
dlls/windowscodecs/bmpdecode.c
+32
-27
No files found.
dlls/windowscodecs/bmpdecode.c
View file @
2785e905
...
...
@@ -62,8 +62,8 @@ typedef struct {
typedef
HRESULT
(
*
ReadDataFunc
)(
BmpDecoder
*
This
);
struct
BmpDecoder
{
const
IWICBitmapDecoderVtbl
*
lpVtbl
;
const
IWICBitmapFrameDecodeVtbl
*
lpFrameVtbl
;
IWICBitmapDecoder
IWICBitmapDecoder_iface
;
IWICBitmapFrameDecode
IWICBitmapFrameDecode_iface
;
LONG
ref
;
BOOL
initialized
;
IStream
*
stream
;
...
...
@@ -81,9 +81,14 @@ struct BmpDecoder {
int
icoframe
;
/* If TRUE, this is a frame of a .ico file. */
};
static
inline
BmpDecoder
*
impl_from_
frame
(
IWICBitmapFrameDecode
*
iface
)
static
inline
BmpDecoder
*
impl_from_
IWICBitmapDecoder
(
IWICBitmapDecoder
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
BmpDecoder
,
lpFrameVtbl
);
return
CONTAINING_RECORD
(
iface
,
BmpDecoder
,
IWICBitmapDecoder_iface
);
}
static
inline
BmpDecoder
*
impl_from_IWICBitmapFrameDecode
(
IWICBitmapFrameDecode
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
BmpDecoder
,
IWICBitmapFrameDecode_iface
);
}
static
HRESULT
WINAPI
BmpFrameDecode_QueryInterface
(
IWICBitmapFrameDecode
*
iface
,
REFIID
iid
,
...
...
@@ -111,22 +116,22 @@ static HRESULT WINAPI BmpFrameDecode_QueryInterface(IWICBitmapFrameDecode *iface
static
ULONG
WINAPI
BmpFrameDecode_AddRef
(
IWICBitmapFrameDecode
*
iface
)
{
BmpDecoder
*
This
=
impl_from_
fram
e
(
iface
);
BmpDecoder
*
This
=
impl_from_
IWICBitmapFrameDecod
e
(
iface
);
return
I
Unknown_AddRef
((
IUnknown
*
)
This
);
return
I
WICBitmapDecoder_AddRef
(
&
This
->
IWICBitmapDecoder_iface
);
}
static
ULONG
WINAPI
BmpFrameDecode_Release
(
IWICBitmapFrameDecode
*
iface
)
{
BmpDecoder
*
This
=
impl_from_
fram
e
(
iface
);
BmpDecoder
*
This
=
impl_from_
IWICBitmapFrameDecod
e
(
iface
);
return
I
Unknown_Release
((
IUnknown
*
)
This
);
return
I
WICBitmapDecoder_Release
(
&
This
->
IWICBitmapDecoder_iface
);
}
static
HRESULT
WINAPI
BmpFrameDecode_GetSize
(
IWICBitmapFrameDecode
*
iface
,
UINT
*
puiWidth
,
UINT
*
puiHeight
)
{
BmpDecoder
*
This
=
impl_from_
fram
e
(
iface
);
BmpDecoder
*
This
=
impl_from_
IWICBitmapFrameDecod
e
(
iface
);
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
puiWidth
,
puiHeight
);
if
(
This
->
bih
.
bV5Size
==
sizeof
(
BITMAPCOREHEADER
))
...
...
@@ -146,7 +151,7 @@ static HRESULT WINAPI BmpFrameDecode_GetSize(IWICBitmapFrameDecode *iface,
static
HRESULT
WINAPI
BmpFrameDecode_GetPixelFormat
(
IWICBitmapFrameDecode
*
iface
,
WICPixelFormatGUID
*
pPixelFormat
)
{
BmpDecoder
*
This
=
impl_from_
fram
e
(
iface
);
BmpDecoder
*
This
=
impl_from_
IWICBitmapFrameDecod
e
(
iface
);
TRACE
(
"(%p,%p)
\n
"
,
iface
,
pPixelFormat
);
memcpy
(
pPixelFormat
,
This
->
pixelformat
,
sizeof
(
GUID
));
...
...
@@ -177,7 +182,7 @@ static HRESULT BmpHeader_GetResolution(BITMAPV5HEADER *bih, double *pDpiX, doubl
static
HRESULT
WINAPI
BmpFrameDecode_GetResolution
(
IWICBitmapFrameDecode
*
iface
,
double
*
pDpiX
,
double
*
pDpiY
)
{
BmpDecoder
*
This
=
impl_from_
fram
e
(
iface
);
BmpDecoder
*
This
=
impl_from_
IWICBitmapFrameDecod
e
(
iface
);
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
pDpiX
,
pDpiY
);
return
BmpHeader_GetResolution
(
&
This
->
bih
,
pDpiX
,
pDpiY
);
...
...
@@ -187,7 +192,7 @@ static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface,
IWICPalette
*
pIPalette
)
{
HRESULT
hr
;
BmpDecoder
*
This
=
impl_from_
fram
e
(
iface
);
BmpDecoder
*
This
=
impl_from_
IWICBitmapFrameDecod
e
(
iface
);
int
count
;
WICColor
*
wiccolors
=
NULL
;
RGBTRIPLE
*
bgrcolors
=
NULL
;
...
...
@@ -299,7 +304,7 @@ end:
static
HRESULT
WINAPI
BmpFrameDecode_CopyPixels
(
IWICBitmapFrameDecode
*
iface
,
const
WICRect
*
prc
,
UINT
cbStride
,
UINT
cbBufferSize
,
BYTE
*
pbBuffer
)
{
BmpDecoder
*
This
=
impl_from_
fram
e
(
iface
);
BmpDecoder
*
This
=
impl_from_
IWICBitmapFrameDecod
e
(
iface
);
HRESULT
hr
=
S_OK
;
UINT
width
,
height
;
TRACE
(
"(%p,%p,%u,%u,%p)
\n
"
,
iface
,
prc
,
cbStride
,
cbBufferSize
,
pbBuffer
);
...
...
@@ -403,7 +408,7 @@ static HRESULT BmpFrameDecode_ReadRGB8(BmpDecoder* This)
HRESULT
hr
;
UINT
width
,
height
;
hr
=
IWICBitmapFrameDecode_GetSize
(
(
IWICBitmapFrameDecode
*
)
&
This
->
lpFrameVtbl
,
&
width
,
&
height
);
hr
=
IWICBitmapFrameDecode_GetSize
(
&
This
->
IWICBitmapFrameDecode_iface
,
&
width
,
&
height
);
if
(
SUCCEEDED
(
hr
))
{
...
...
@@ -954,7 +959,7 @@ static HRESULT BmpDecoder_ReadHeaders(BmpDecoder* This, IStream *stream)
static
HRESULT
WINAPI
BmpDecoder_QueryInterface
(
IWICBitmapDecoder
*
iface
,
REFIID
iid
,
void
**
ppv
)
{
BmpDecoder
*
This
=
(
BmpDecoder
*
)
iface
;
BmpDecoder
*
This
=
impl_from_IWICBitmapDecoder
(
iface
)
;
TRACE
(
"(%p,%s,%p)
\n
"
,
iface
,
debugstr_guid
(
iid
),
ppv
);
if
(
!
ppv
)
return
E_INVALIDARG
;
...
...
@@ -975,7 +980,7 @@ static HRESULT WINAPI BmpDecoder_QueryInterface(IWICBitmapDecoder *iface, REFIID
static
ULONG
WINAPI
BmpDecoder_AddRef
(
IWICBitmapDecoder
*
iface
)
{
BmpDecoder
*
This
=
(
BmpDecoder
*
)
iface
;
BmpDecoder
*
This
=
impl_from_IWICBitmapDecoder
(
iface
)
;
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p) refcount=%u
\n
"
,
iface
,
ref
);
...
...
@@ -985,7 +990,7 @@ static ULONG WINAPI BmpDecoder_AddRef(IWICBitmapDecoder *iface)
static
ULONG
WINAPI
BmpDecoder_Release
(
IWICBitmapDecoder
*
iface
)
{
BmpDecoder
*
This
=
(
BmpDecoder
*
)
iface
;
BmpDecoder
*
This
=
impl_from_IWICBitmapDecoder
(
iface
)
;
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p) refcount=%u
\n
"
,
iface
,
ref
);
...
...
@@ -1006,7 +1011,7 @@ static HRESULT WINAPI BmpDecoder_QueryCapability(IWICBitmapDecoder *iface, IStre
DWORD
*
pdwCapability
)
{
HRESULT
hr
;
BmpDecoder
*
This
=
(
BmpDecoder
*
)
iface
;
BmpDecoder
*
This
=
impl_from_IWICBitmapDecoder
(
iface
)
;
EnterCriticalSection
(
&
This
->
lock
);
hr
=
BmpDecoder_ReadHeaders
(
This
,
pIStream
);
...
...
@@ -1025,7 +1030,7 @@ static HRESULT WINAPI BmpDecoder_Initialize(IWICBitmapDecoder *iface, IStream *p
WICDecodeOptions
cacheOptions
)
{
HRESULT
hr
;
BmpDecoder
*
This
=
(
BmpDecoder
*
)
iface
;
BmpDecoder
*
This
=
impl_from_IWICBitmapDecoder
(
iface
)
;
EnterCriticalSection
(
&
This
->
lock
);
hr
=
BmpDecoder_ReadHeaders
(
This
,
pIStream
);
...
...
@@ -1112,13 +1117,13 @@ static HRESULT WINAPI BmpDecoder_GetFrameCount(IWICBitmapDecoder *iface,
static
HRESULT
WINAPI
BmpDecoder_GetFrame
(
IWICBitmapDecoder
*
iface
,
UINT
index
,
IWICBitmapFrameDecode
**
ppIBitmapFrame
)
{
BmpDecoder
*
This
=
(
BmpDecoder
*
)
iface
;
BmpDecoder
*
This
=
impl_from_IWICBitmapDecoder
(
iface
)
;
if
(
index
!=
0
)
return
E_INVALIDARG
;
if
(
!
This
->
stream
)
return
WINCODEC_ERR_WRONGSTATE
;
*
ppIBitmapFrame
=
(
IWICBitmapFrameDecode
*
)
&
This
->
lpFrameVtbl
;
*
ppIBitmapFrame
=
&
This
->
IWICBitmapFrameDecode_iface
;
IWICBitmapDecoder_AddRef
(
iface
);
return
S_OK
;
...
...
@@ -1148,8 +1153,8 @@ static HRESULT BmpDecoder_Create(int packed, int icoframe, BmpDecoder **ppDecode
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BmpDecoder
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
lpVtbl
=
&
BmpDecoder_Vtbl
;
This
->
lpFrame
Vtbl
=
&
BmpDecoder_FrameVtbl
;
This
->
IWICBitmapDecoder_iface
.
lpVtbl
=
&
BmpDecoder_Vtbl
;
This
->
IWICBitmapFrameDecode_iface
.
lp
Vtbl
=
&
BmpDecoder_FrameVtbl
;
This
->
ref
=
1
;
This
->
initialized
=
FALSE
;
This
->
stream
=
NULL
;
...
...
@@ -1178,8 +1183,8 @@ static HRESULT BmpDecoder_Construct(int packed, int icoframe, IUnknown *pUnkOute
ret
=
BmpDecoder_Create
(
packed
,
icoframe
,
&
This
);
if
(
FAILED
(
ret
))
return
ret
;
ret
=
I
Unknown_QueryInterface
((
IUnknown
*
)
This
,
iid
,
ppv
);
I
Unknown_Release
((
IUnknown
*
)
This
);
ret
=
I
WICBitmapDecoder_QueryInterface
(
&
This
->
IWICBitmapDecoder_iface
,
iid
,
ppv
);
I
WICBitmapDecoder_Release
(
&
This
->
IWICBitmapDecoder_iface
);
return
ret
;
}
...
...
@@ -1201,7 +1206,7 @@ HRESULT IcoDibDecoder_CreateInstance(BmpDecoder **ppDecoder)
void
BmpDecoder_GetWICDecoder
(
BmpDecoder
*
This
,
IWICBitmapDecoder
**
ppDecoder
)
{
*
ppDecoder
=
(
IWICBitmapDecoder
*
)
This
;
*
ppDecoder
=
&
This
->
IWICBitmapDecoder_iface
;
}
/* Return the offset where the mask of an icon might be, or 0 for failure. */
...
...
@@ -1213,7 +1218,7 @@ void BmpDecoder_FindIconMask(BmpDecoder *This, ULONG *mask_offset, int *topdown)
{
/* RGB or BITFIELDS data */
ULONG
width
,
height
,
bytesperrow
,
datasize
;
IWICBitmapFrameDecode_GetSize
(
(
IWICBitmapFrameDecode
*
)
&
This
->
lpFrameVtbl
,
&
width
,
&
height
);
IWICBitmapFrameDecode_GetSize
(
&
This
->
IWICBitmapFrameDecode_iface
,
&
width
,
&
height
);
bytesperrow
=
(((
width
*
This
->
bitsperpixel
)
+
31
)
/
32
)
*
4
;
datasize
=
bytesperrow
*
height
;
*
mask_offset
=
This
->
image_offset
+
datasize
;
...
...
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