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
179ed52b
Commit
179ed52b
authored
Jul 12, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jul 12, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Add support for generating WICBitmapPaletteTypeFixedGray16 palette.
parent
d5cc4021
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
palette.c
dlls/windowscodecs/palette.c
+22
-0
palette.c
dlls/windowscodecs/tests/palette.c
+19
-0
No files found.
dlls/windowscodecs/palette.c
View file @
179ed52b
...
@@ -98,6 +98,23 @@ static ULONG WINAPI PaletteImpl_Release(IWICPalette *iface)
...
@@ -98,6 +98,23 @@ static ULONG WINAPI PaletteImpl_Release(IWICPalette *iface)
return
ref
;
return
ref
;
}
}
static
WICColor
*
generate_gray16_palette
(
UINT
*
count
)
{
WICColor
*
entries
;
UINT
i
;
*
count
=
16
;
entries
=
HeapAlloc
(
GetProcessHeap
(),
0
,
16
*
sizeof
(
WICColor
));
if
(
!
entries
)
return
NULL
;
for
(
i
=
0
;
i
<
16
;
i
++
)
{
entries
[
i
]
=
0xff000000
;
entries
[
i
]
|=
(
i
<<
20
)
|
(
i
<<
16
)
|
(
i
<<
12
)
|
(
i
<<
8
)
|
(
i
<<
4
)
|
i
;
}
return
entries
;
}
static
HRESULT
WINAPI
PaletteImpl_InitializePredefined
(
IWICPalette
*
iface
,
static
HRESULT
WINAPI
PaletteImpl_InitializePredefined
(
IWICPalette
*
iface
,
WICBitmapPaletteType
type
,
BOOL
add_transparent
)
WICBitmapPaletteType
type
,
BOOL
add_transparent
)
{
{
...
@@ -127,6 +144,11 @@ static HRESULT WINAPI PaletteImpl_InitializePredefined(IWICPalette *iface,
...
@@ -127,6 +144,11 @@ static HRESULT WINAPI PaletteImpl_InitializePredefined(IWICPalette *iface,
colors
[
3
]
=
0xffffffff
;
colors
[
3
]
=
0xffffffff
;
break
;
break
;
case
WICBitmapPaletteTypeFixedGray16
:
colors
=
generate_gray16_palette
(
&
count
);
if
(
!
colors
)
return
E_OUTOFMEMORY
;
break
;
default:
default:
FIXME
(
"(%p,%u,%d): stub
\n
"
,
iface
,
type
,
add_transparent
);
FIXME
(
"(%p,%u,%d): stub
\n
"
,
iface
,
type
,
add_transparent
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
...
...
dlls/windowscodecs/tests/palette.c
View file @
179ed52b
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
*/
*/
#include <stdarg.h>
#include <stdarg.h>
#include <assert.h>
#define COBJMACROS
#define COBJMACROS
...
@@ -148,6 +149,19 @@ static void test_custom_palette(void)
...
@@ -148,6 +149,19 @@ static void test_custom_palette(void)
IWICImagingFactory_Release
(
factory
);
IWICImagingFactory_Release
(
factory
);
}
}
static
void
generate_gray16_palette
(
DWORD
*
entries
,
UINT
count
)
{
UINT
i
;
assert
(
count
==
16
);
for
(
i
=
0
;
i
<
16
;
i
++
)
{
entries
[
i
]
=
0xff000000
;
entries
[
i
]
|=
(
i
<<
20
)
|
(
i
<<
16
)
|
(
i
<<
12
)
|
(
i
<<
8
)
|
(
i
<<
4
)
|
i
;
}
}
static
void
test_predefined_palette
(
void
)
static
void
test_predefined_palette
(
void
)
{
{
static
struct
test_data
static
struct
test_data
...
@@ -161,6 +175,7 @@ static void test_predefined_palette(void)
...
@@ -161,6 +175,7 @@ static void test_predefined_palette(void)
{
WICBitmapPaletteTypeFixedBW
,
1
,
1
,
2
,
{
0xff000000
,
0xffffffff
}
},
{
WICBitmapPaletteTypeFixedBW
,
1
,
1
,
2
,
{
0xff000000
,
0xffffffff
}
},
{
WICBitmapPaletteTypeFixedGray4
,
0
,
1
,
4
,
{
WICBitmapPaletteTypeFixedGray4
,
0
,
1
,
4
,
{
0xff000000
,
0xff555555
,
0xffaaaaaa
,
0xffffffff
}
},
{
0xff000000
,
0xff555555
,
0xffaaaaaa
,
0xffffffff
}
},
{
WICBitmapPaletteTypeFixedGray16
,
0
,
1
,
16
,
{
0
}
},
};
};
IWICImagingFactory
*
factory
;
IWICImagingFactory
*
factory
;
IWICPalette
*
palette
;
IWICPalette
*
palette
;
...
@@ -210,6 +225,10 @@ static void test_predefined_palette(void)
...
@@ -210,6 +225,10 @@ static void test_predefined_palette(void)
if
(
ret
==
td
[
i
].
count
)
if
(
ret
==
td
[
i
].
count
)
{
{
UINT
j
;
UINT
j
;
if
(
td
[
i
].
type
==
WICBitmapPaletteTypeFixedGray16
)
generate_gray16_palette
(
td
[
i
].
color
,
td
[
i
].
count
);
for
(
j
=
0
;
j
<
count
;
j
++
)
for
(
j
=
0
;
j
<
count
;
j
++
)
{
{
ok
(
color
[
j
]
==
td
[
i
].
color
[
j
],
"%u:[%u]: expected %#x, got %#x
\n
"
,
ok
(
color
[
j
]
==
td
[
i
].
color
[
j
],
"%u:[%u]: expected %#x, got %#x
\n
"
,
...
...
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