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
f27bb660
Commit
f27bb660
authored
Dec 13, 2013
by
Henri Verbeet
Committed by
Alexandre Julliard
Dec 13, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Explicitly pass the palette size to wined3d_palette_create().
parent
89dedf64
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
28 deletions
+36
-28
palette.c
dlls/ddraw/palette.c
+26
-1
palette.c
dlls/wined3d/palette.c
+8
-25
wined3d.spec
dlls/wined3d/wined3d.spec
+1
-1
wined3d.h
include/wine/wined3d.h
+1
-1
No files found.
dlls/ddraw/palette.c
View file @
f27bb660
...
...
@@ -236,16 +236,41 @@ struct ddraw_palette *unsafe_impl_from_IDirectDrawPalette(IDirectDrawPalette *if
return
CONTAINING_RECORD
(
iface
,
struct
ddraw_palette
,
IDirectDrawPalette_iface
);
}
static
unsigned
int
palette_size
(
DWORD
flags
)
{
switch
(
flags
&
(
DDPCAPS_1BIT
|
DDPCAPS_2BIT
|
DDPCAPS_4BIT
|
DDPCAPS_8BIT
))
{
case
DDPCAPS_1BIT
:
return
2
;
case
DDPCAPS_2BIT
:
return
4
;
case
DDPCAPS_4BIT
:
return
16
;
case
DDPCAPS_8BIT
:
return
256
;
default:
return
~
0u
;
}
}
HRESULT
ddraw_palette_init
(
struct
ddraw_palette
*
palette
,
struct
ddraw
*
ddraw
,
DWORD
flags
,
PALETTEENTRY
*
entries
)
{
unsigned
int
entry_count
;
HRESULT
hr
;
if
((
entry_count
=
palette_size
(
flags
))
==
~
0u
)
{
WARN
(
"Invalid flags %#x.
\n
"
,
flags
);
return
DDERR_INVALIDPARAMS
;
}
palette
->
IDirectDrawPalette_iface
.
lpVtbl
=
&
ddraw_palette_vtbl
;
palette
->
ref
=
1
;
palette
->
flags
=
flags
;
if
(
FAILED
(
hr
=
wined3d_palette_create
(
ddraw
->
wined3d_device
,
flags
,
entries
,
&
palette
->
wineD3DPalette
)))
if
(
FAILED
(
hr
=
wined3d_palette_create
(
ddraw
->
wined3d_device
,
flags
,
entry_count
,
entries
,
&
palette
->
wineD3DPalette
)))
{
WARN
(
"Failed to create wined3d palette, hr %#x.
\n
"
,
hr
);
return
hr
;
...
...
dlls/wined3d/palette.c
View file @
f27bb660
...
...
@@ -29,8 +29,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d
);
#define SIZE_BITS (WINEDDPCAPS_1BIT | WINEDDPCAPS_2BIT | WINEDDPCAPS_4BIT | WINEDDPCAPS_8BIT)
ULONG
CDECL
wined3d_palette_incref
(
struct
wined3d_palette
*
palette
)
{
ULONG
refcount
=
InterlockedIncrement
(
&
palette
->
ref
);
...
...
@@ -55,28 +53,15 @@ ULONG CDECL wined3d_palette_decref(struct wined3d_palette *palette)
return
refcount
;
}
static
WORD
wined3d_palette_size
(
DWORD
flags
)
{
switch
(
flags
&
SIZE_BITS
)
{
case
WINEDDPCAPS_1BIT
:
return
2
;
case
WINEDDPCAPS_2BIT
:
return
4
;
case
WINEDDPCAPS_4BIT
:
return
16
;
case
WINEDDPCAPS_8BIT
:
return
256
;
default:
FIXME
(
"Unhandled size bits %#x.
\n
"
,
flags
&
SIZE_BITS
);
return
256
;
}
}
HRESULT
CDECL
wined3d_palette_get_entries
(
const
struct
wined3d_palette
*
palette
,
DWORD
flags
,
DWORD
start
,
DWORD
count
,
PALETTEENTRY
*
entries
)
{
TRACE
(
"palette %p, flags %#x, start %u, count %u, entries %p.
\n
"
,
palette
,
flags
,
start
,
count
,
entries
);
if
(
flags
)
return
WINED3DERR_INVALIDCALL
;
/* unchecked */
if
(
start
+
count
>
wined3d_palette_size
(
palette
->
flags
))
if
(
flags
)
return
WINED3DERR_INVALIDCALL
;
/* unchecked */
if
(
start
>
palette
->
palNumEntries
||
count
>
palette
->
palNumEntries
-
start
)
return
WINED3DERR_INVALIDCALL
;
if
(
palette
->
flags
&
WINEDDPCAPS_8BITENTRIES
)
...
...
@@ -146,7 +131,7 @@ HRESULT CDECL wined3d_palette_set_entries(struct wined3d_palette *palette,
}
static
HRESULT
wined3d_palette_init
(
struct
wined3d_palette
*
palette
,
struct
wined3d_device
*
device
,
DWORD
flags
,
const
PALETTEENTRY
*
entries
)
DWORD
flags
,
unsigned
int
entry_count
,
const
PALETTEENTRY
*
entries
)
{
HRESULT
hr
;
...
...
@@ -154,7 +139,7 @@ static HRESULT wined3d_palette_init(struct wined3d_palette *palette, struct wine
palette
->
device
=
device
;
palette
->
flags
=
flags
;
palette
->
palNumEntries
=
wined3d_palette_size
(
flags
)
;
palette
->
palNumEntries
=
entry_count
;
palette
->
hpal
=
CreatePalette
((
const
LOGPALETTE
*
)
&
palette
->
palVersion
);
if
(
!
palette
->
hpal
)
{
...
...
@@ -162,8 +147,7 @@ static HRESULT wined3d_palette_init(struct wined3d_palette *palette, struct wine
return
E_FAIL
;
}
hr
=
wined3d_palette_set_entries
(
palette
,
0
,
0
,
wined3d_palette_size
(
flags
),
entries
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
=
wined3d_palette_set_entries
(
palette
,
0
,
0
,
entry_count
,
entries
)))
{
WARN
(
"Failed to set palette entries, hr %#x.
\n
"
,
hr
);
DeleteObject
(
palette
->
hpal
);
...
...
@@ -174,7 +158,7 @@ static HRESULT wined3d_palette_init(struct wined3d_palette *palette, struct wine
}
HRESULT
CDECL
wined3d_palette_create
(
struct
wined3d_device
*
device
,
DWORD
flags
,
const
PALETTEENTRY
*
entries
,
struct
wined3d_palette
**
palette
)
unsigned
int
entry_count
,
const
PALETTEENTRY
*
entries
,
struct
wined3d_palette
**
palette
)
{
struct
wined3d_palette
*
object
;
HRESULT
hr
;
...
...
@@ -186,8 +170,7 @@ HRESULT CDECL wined3d_palette_create(struct wined3d_device *device, DWORD flags,
if
(
!
object
)
return
E_OUTOFMEMORY
;
hr
=
wined3d_palette_init
(
object
,
device
,
flags
,
entries
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
=
wined3d_palette_init
(
object
,
device
,
flags
,
entry_count
,
entries
)))
{
WARN
(
"Failed to initialize palette, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
...
...
dlls/wined3d/wined3d.spec
View file @
f27bb660
...
...
@@ -156,7 +156,7 @@
@ cdecl wined3d_device_update_texture(ptr ptr ptr)
@ cdecl wined3d_device_validate_device(ptr ptr)
@ cdecl wined3d_palette_create(ptr long ptr ptr)
@ cdecl wined3d_palette_create(ptr long
long
ptr ptr)
@ cdecl wined3d_palette_decref(ptr)
@ cdecl wined3d_palette_get_entries(ptr long long long ptr)
@ cdecl wined3d_palette_incref(ptr)
...
...
include/wine/wined3d.h
View file @
f27bb660
...
...
@@ -2234,7 +2234,7 @@ HRESULT __cdecl wined3d_device_update_texture(struct wined3d_device *device,
HRESULT
__cdecl
wined3d_device_validate_device
(
const
struct
wined3d_device
*
device
,
DWORD
*
num_passes
);
HRESULT
__cdecl
wined3d_palette_create
(
struct
wined3d_device
*
device
,
DWORD
flags
,
const
PALETTEENTRY
*
entries
,
struct
wined3d_palette
**
palette
);
unsigned
int
entry_count
,
const
PALETTEENTRY
*
entries
,
struct
wined3d_palette
**
palette
);
ULONG
__cdecl
wined3d_palette_decref
(
struct
wined3d_palette
*
palette
);
HRESULT
__cdecl
wined3d_palette_get_entries
(
const
struct
wined3d_palette
*
palette
,
DWORD
flags
,
DWORD
start
,
DWORD
count
,
PALETTEENTRY
*
entries
);
...
...
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