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
3e36f1e4
Commit
3e36f1e4
authored
Aug 14, 2012
by
Vincent Povirk
Committed by
Alexandre Julliard
Aug 15, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Implement BitmapImpl_SetPalette and CopyPalette.
parent
f9b67b6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
8 deletions
+39
-8
bitmap.c
dlls/windowscodecs/bitmap.c
+35
-4
bitmap.c
dlls/windowscodecs/tests/bitmap.c
+4
-4
No files found.
dlls/windowscodecs/bitmap.c
View file @
3e36f1e4
...
@@ -36,6 +36,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
...
@@ -36,6 +36,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
typedef
struct
BitmapImpl
{
typedef
struct
BitmapImpl
{
IWICBitmap
IWICBitmap_iface
;
IWICBitmap
IWICBitmap_iface
;
LONG
ref
;
LONG
ref
;
IWICPalette
*
palette
;
int
palette_set
;
}
BitmapImpl
;
}
BitmapImpl
;
static
inline
BitmapImpl
*
impl_from_IWICBitmap
(
IWICBitmap
*
iface
)
static
inline
BitmapImpl
*
impl_from_IWICBitmap
(
IWICBitmap
*
iface
)
...
@@ -86,6 +88,7 @@ static ULONG WINAPI BitmapImpl_Release(IWICBitmap *iface)
...
@@ -86,6 +88,7 @@ static ULONG WINAPI BitmapImpl_Release(IWICBitmap *iface)
if
(
ref
==
0
)
if
(
ref
==
0
)
{
{
if
(
This
->
palette
)
IWICPalette_Release
(
This
->
palette
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
}
...
@@ -119,9 +122,13 @@ static HRESULT WINAPI BitmapImpl_GetResolution(IWICBitmap *iface,
...
@@ -119,9 +122,13 @@ static HRESULT WINAPI BitmapImpl_GetResolution(IWICBitmap *iface,
static
HRESULT
WINAPI
BitmapImpl_CopyPalette
(
IWICBitmap
*
iface
,
static
HRESULT
WINAPI
BitmapImpl_CopyPalette
(
IWICBitmap
*
iface
,
IWICPalette
*
pIPalette
)
IWICPalette
*
pIPalette
)
{
{
FIXME
(
"(%p,%p)
\n
"
,
iface
,
pIPalette
);
BitmapImpl
*
This
=
impl_from_IWICBitmap
(
iface
);
TRACE
(
"(%p,%p)
\n
"
,
iface
,
pIPalette
);
return
E_NOTIMPL
;
if
(
!
This
->
palette_set
)
return
WINCODEC_ERR_PALETTEUNAVAILABLE
;
return
IWICPalette_InitializeFromPalette
(
pIPalette
,
This
->
palette
);
}
}
static
HRESULT
WINAPI
BitmapImpl_CopyPixels
(
IWICBitmap
*
iface
,
static
HRESULT
WINAPI
BitmapImpl_CopyPixels
(
IWICBitmap
*
iface
,
...
@@ -142,9 +149,31 @@ static HRESULT WINAPI BitmapImpl_Lock(IWICBitmap *iface, const WICRect *prcLock,
...
@@ -142,9 +149,31 @@ static HRESULT WINAPI BitmapImpl_Lock(IWICBitmap *iface, const WICRect *prcLock,
static
HRESULT
WINAPI
BitmapImpl_SetPalette
(
IWICBitmap
*
iface
,
IWICPalette
*
pIPalette
)
static
HRESULT
WINAPI
BitmapImpl_SetPalette
(
IWICBitmap
*
iface
,
IWICPalette
*
pIPalette
)
{
{
FIXME
(
"(%p,%p)
\n
"
,
iface
,
pIPalette
);
BitmapImpl
*
This
=
impl_from_IWICBitmap
(
iface
);
HRESULT
hr
;
return
E_NOTIMPL
;
TRACE
(
"(%p,%p)
\n
"
,
iface
,
pIPalette
);
if
(
!
This
->
palette
)
{
IWICPalette
*
new_palette
;
hr
=
PaletteImpl_Create
(
&
new_palette
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
InterlockedCompareExchangePointer
((
void
**
)
&
This
->
palette
,
new_palette
,
NULL
))
{
/* someone beat us to it */
IWICPalette_Release
(
new_palette
);
}
}
hr
=
IWICPalette_InitializeFromPalette
(
This
->
palette
,
pIPalette
);
if
(
SUCCEEDED
(
hr
))
This
->
palette_set
=
1
;
return
S_OK
;
}
}
static
HRESULT
WINAPI
BitmapImpl_SetResolution
(
IWICBitmap
*
iface
,
static
HRESULT
WINAPI
BitmapImpl_SetResolution
(
IWICBitmap
*
iface
,
...
@@ -180,6 +209,8 @@ HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight,
...
@@ -180,6 +209,8 @@ HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight,
This
->
IWICBitmap_iface
.
lpVtbl
=
&
BitmapImpl_Vtbl
;
This
->
IWICBitmap_iface
.
lpVtbl
=
&
BitmapImpl_Vtbl
;
This
->
ref
=
1
;
This
->
ref
=
1
;
This
->
palette
=
NULL
;
This
->
palette_set
=
0
;
*
ppIBitmap
=
&
This
->
IWICBitmap_iface
;
*
ppIBitmap
=
&
This
->
IWICBitmap_iface
;
...
...
dlls/windowscodecs/tests/bitmap.c
View file @
3e36f1e4
...
@@ -62,23 +62,23 @@ static void test_createbitmap(void)
...
@@ -62,23 +62,23 @@ static void test_createbitmap(void)
/* Palette is unavailable until explicitly set */
/* Palette is unavailable until explicitly set */
hr
=
IWICBitmap_CopyPalette
(
bitmap
,
palette
);
hr
=
IWICBitmap_CopyPalette
(
bitmap
,
palette
);
todo_wine
ok
(
hr
==
WINCODEC_ERR_PALETTEUNAVAILABLE
,
"IWICBitmap_CopyPalette failed hr=%x
\n
"
,
hr
);
ok
(
hr
==
WINCODEC_ERR_PALETTEUNAVAILABLE
,
"IWICBitmap_CopyPalette failed hr=%x
\n
"
,
hr
);
hr
=
IWICPalette_InitializePredefined
(
palette
,
WICBitmapPaletteTypeFixedGray256
,
FALSE
);
hr
=
IWICPalette_InitializePredefined
(
palette
,
WICBitmapPaletteTypeFixedGray256
,
FALSE
);
ok
(
hr
==
S_OK
,
"IWICPalette_InitializePredefined failed hr=%x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"IWICPalette_InitializePredefined failed hr=%x
\n
"
,
hr
);
hr
=
IWICBitmap_SetPalette
(
bitmap
,
palette
);
hr
=
IWICBitmap_SetPalette
(
bitmap
,
palette
);
todo_wine
ok
(
hr
==
S_OK
,
"IWICBitmap_SetPalette failed hr=%x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"IWICBitmap_SetPalette failed hr=%x
\n
"
,
hr
);
hr
=
IWICPalette_InitializePredefined
(
palette
,
WICBitmapPaletteTypeFixedGray4
,
FALSE
);
hr
=
IWICPalette_InitializePredefined
(
palette
,
WICBitmapPaletteTypeFixedGray4
,
FALSE
);
ok
(
hr
==
S_OK
,
"IWICPalette_InitializePredefined failed hr=%x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"IWICPalette_InitializePredefined failed hr=%x
\n
"
,
hr
);
hr
=
IWICBitmap_CopyPalette
(
bitmap
,
palette
);
hr
=
IWICBitmap_CopyPalette
(
bitmap
,
palette
);
todo_wine
ok
(
hr
==
S_OK
,
"IWICBitmap_CopyPalette failed hr=%x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"IWICBitmap_CopyPalette failed hr=%x
\n
"
,
hr
);
hr
=
IWICPalette_GetType
(
palette
,
&
palettetype
);
hr
=
IWICPalette_GetType
(
palette
,
&
palettetype
);
ok
(
hr
==
S_OK
,
"IWICPalette_GetType failed hr=%x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"IWICPalette_GetType failed hr=%x
\n
"
,
hr
);
todo_wine
ok
(
palettetype
==
WICBitmapPaletteTypeFixedGray256
,
ok
(
palettetype
==
WICBitmapPaletteTypeFixedGray256
,
"expected WICBitmapPaletteTypeFixedGray256, got %x
\n
"
,
palettetype
);
"expected WICBitmapPaletteTypeFixedGray256, got %x
\n
"
,
palettetype
);
IWICPalette_Release
(
palette
);
IWICPalette_Release
(
palette
);
...
...
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