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
ab80e973
Commit
ab80e973
authored
Apr 13, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 13, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Add a separate function for palette initialization.
parent
d1d8c814
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
25 deletions
+48
-25
device.c
dlls/wined3d/device.c
+13
-21
palette.c
dlls/wined3d/palette.c
+33
-2
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-2
No files found.
dlls/wined3d/device.c
View file @
ab80e973
...
...
@@ -1360,35 +1360,27 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreatePalette(IWineD3DDevice *iface, DW
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DPaletteImpl
*
object
;
HRESULT
hr
;
TRACE
(
"(%p)->(%x, %p, %p, %p)
\n
"
,
This
,
Flags
,
PalEnt
,
Palette
,
Parent
);
/* Create the new object */
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IWineD3DPaletteImpl
));
if
(
!
object
)
{
ERR
(
"Out of memory when allocating memory for a IWineD3DPalette implementation
\n
"
);
return
E_OUTOFMEMORY
;
}
TRACE
(
"iface %p, flags %#x, entries %p, palette %p, parent %p.
\n
"
,
iface
,
Flags
,
PalEnt
,
Palette
,
Parent
);
object
->
lpVtbl
=
&
IWineD3DPalette_Vtbl
;
object
->
ref
=
1
;
object
->
Flags
=
Flags
;
object
->
parent
=
Parent
;
object
->
device
=
This
;
object
->
palNumEntries
=
IWineD3DPaletteImpl_Size
(
Flags
);
object
->
hpal
=
CreatePalette
((
const
LOGPALETTE
*
)
&
(
object
->
palVersion
));
if
(
!
object
->
hpal
)
{
HeapFree
(
GetProcessHeap
(),
0
,
object
);
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
if
(
!
object
)
{
ERR
(
"Failed to allocate palette memory.
\n
"
);
return
E_OUTOFMEMORY
;
}
hr
=
IWineD3DPalette_SetEntries
((
IWineD3DPalette
*
)
object
,
0
,
0
,
IWineD3DPaletteImpl_Size
(
Flags
),
PalEnt
);
if
(
FAILED
(
hr
))
{
IWineD3DPalette_Release
((
IWineD3DPalette
*
)
object
);
hr
=
wined3d_palette_init
(
object
,
This
,
Flags
,
PalEnt
,
Parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize palette, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
return
hr
;
}
*
Palette
=
(
IWineD3DPalette
*
)
object
;
TRACE
(
"Created palette %p.
\n
"
,
object
);
*
Palette
=
(
IWineD3DPalette
*
)
object
;
return
WINED3D_OK
;
}
...
...
dlls/wined3d/palette.c
View file @
ab80e973
...
...
@@ -74,7 +74,8 @@ static ULONG WINAPI IWineD3DPaletteImpl_Release(IWineD3DPalette *iface) {
}
/* Not called from the vtable */
DWORD
IWineD3DPaletteImpl_Size
(
DWORD
dwFlags
)
{
static
DWORD
IWineD3DPaletteImpl_Size
(
DWORD
dwFlags
)
{
switch
(
dwFlags
&
SIZE_BITS
)
{
case
WINEDDPCAPS_1BIT
:
return
2
;
case
WINEDDPCAPS_2BIT
:
return
4
;
...
...
@@ -183,7 +184,7 @@ static HRESULT WINAPI IWineD3DPaletteImpl_GetParent(IWineD3DPalette *iface, IUn
return
WINED3D_OK
;
}
const
IWineD3DPaletteVtbl
IWineD3DPalette_Vtbl
=
static
const
IWineD3DPaletteVtbl
IWineD3DPalette_Vtbl
=
{
/*** IUnknown ***/
IWineD3DPaletteImpl_QueryInterface
,
...
...
@@ -195,3 +196,33 @@ const IWineD3DPaletteVtbl IWineD3DPalette_Vtbl =
IWineD3DPaletteImpl_GetCaps
,
IWineD3DPaletteImpl_SetEntries
};
HRESULT
wined3d_palette_init
(
IWineD3DPaletteImpl
*
palette
,
IWineD3DDeviceImpl
*
device
,
DWORD
flags
,
const
PALETTEENTRY
*
entries
,
IUnknown
*
parent
)
{
HRESULT
hr
;
palette
->
lpVtbl
=
&
IWineD3DPalette_Vtbl
;
palette
->
ref
=
1
;
palette
->
parent
=
parent
;
palette
->
device
=
device
;
palette
->
Flags
=
flags
;
palette
->
palNumEntries
=
IWineD3DPaletteImpl_Size
(
flags
);
palette
->
hpal
=
CreatePalette
((
const
LOGPALETTE
*
)
&
palette
->
palVersion
);
if
(
!
palette
->
hpal
)
{
WARN
(
"Failed to create palette.
\n
"
);
return
E_FAIL
;
}
hr
=
IWineD3DPalette_SetEntries
((
IWineD3DPalette
*
)
palette
,
0
,
0
,
IWineD3DPaletteImpl_Size
(
flags
),
entries
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to set palette entries, hr %#x.
\n
"
,
hr
);
DeleteObject
(
palette
->
hpal
);
return
hr
;
}
return
WINED3D_OK
;
}
dlls/wined3d/wined3d_private.h
View file @
ab80e973
...
...
@@ -2966,8 +2966,8 @@ struct IWineD3DPaletteImpl {
DWORD
Flags
;
};
extern
const
IWineD3DPaletteVtbl
IWineD3DPalette_Vtbl
DECLSPEC_HIDDEN
;
DWORD
IWineD3DPaletteImpl_Size
(
DWORD
dwFlags
)
DECLSPEC_HIDDEN
;
HRESULT
wined3d_palette_init
(
IWineD3DPaletteImpl
*
palette
,
IWineD3DDeviceImpl
*
device
,
DWORD
flags
,
const
PALETTEENTRY
*
entries
,
IUnknown
*
parent
)
DECLSPEC_HIDDEN
;
/* DirectDraw utility functions */
extern
WINED3DFORMAT
pixelformat_for_depth
(
DWORD
depth
)
DECLSPEC_HIDDEN
;
...
...
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