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
a6f71af0
Commit
a6f71af0
authored
Apr 21, 2006
by
Stefan Dösinger
Committed by
Alexandre Julliard
Apr 21, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Implement IWineD3DPalette.
parent
ff302bfc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
117 additions
and
11 deletions
+117
-11
device.c
dlls/wined3d/device.c
+20
-2
palette.c
dlls/wined3d/palette.c
+83
-9
wined3d_private.h
dlls/wined3d/wined3d_private.h
+14
-0
No files found.
dlls/wined3d/device.c
View file @
a6f71af0
...
@@ -1623,21 +1623,39 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface, CONST
...
@@ -1623,21 +1623,39 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface, CONST
HRESULT
WINAPI
IWineD3DDeviceImpl_CreatePalette
(
IWineD3DDevice
*
iface
,
DWORD
Flags
,
PALETTEENTRY
*
PalEnt
,
IWineD3DPalette
**
Palette
,
IUnknown
*
Parent
)
{
HRESULT
WINAPI
IWineD3DDeviceImpl_CreatePalette
(
IWineD3DDevice
*
iface
,
DWORD
Flags
,
PALETTEENTRY
*
PalEnt
,
IWineD3DPalette
**
Palette
,
IUnknown
*
Parent
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DPaletteImpl
*
object
;
IWineD3DPaletteImpl
*
object
;
HRESULT
hr
;
TRACE
(
"(%p)->(%lx, %p, %p, %p)
\n
"
,
This
,
Flags
,
PalEnt
,
Palette
,
Parent
);
TRACE
(
"(%p)->(%lx, %p, %p, %p)
\n
"
,
This
,
Flags
,
PalEnt
,
Palette
,
Parent
);
/* Create the new object */
/* Create the new object */
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IWineD3DPaletteImpl
));
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IWineD3DPaletteImpl
));
if
(
!
object
)
{
if
(
!
object
)
{
ERR
(
"Out of memory when allocating memory for a IWineD3DPalette implementation
\n
"
);
ERR
(
"Out of memory when allocating memory for a IWineD3DPalette implementation
\n
"
);
return
DDERR_OUTOFVIDEO
MEMORY
;
return
E_OUTOF
MEMORY
;
}
}
object
->
lpVtbl
=
&
IWineD3DPalette_Vtbl
;
object
->
lpVtbl
=
&
IWineD3DPalette_Vtbl
;
object
->
ref
=
1
;
object
->
ref
=
1
;
object
->
Flags
=
Flags
;
object
->
parent
=
Parent
;
object
->
wineD3DDevice
=
This
;
object
->
palNumEntries
=
IWineD3DPaletteImpl_Size
(
Flags
);
object
->
hpal
=
CreatePalette
((
const
LOGPALETTE
*
)
&
(
object
->
palVersion
));
if
(
!
object
->
hpal
)
{
HeapFree
(
GetProcessHeap
(),
0
,
object
);
return
E_OUTOFMEMORY
;
}
hr
=
IWineD3DPalette_SetEntries
((
IWineD3DPalette
*
)
object
,
0
,
0
,
IWineD3DPaletteImpl_Size
(
Flags
),
PalEnt
);
if
(
FAILED
(
hr
))
{
IWineD3DPalette_Release
((
IWineD3DPalette
*
)
object
);
return
hr
;
}
*
Palette
=
(
IWineD3DPalette
*
)
object
;
*
Palette
=
(
IWineD3DPalette
*
)
object
;
return
D
D_OK
;
return
WINED3
D_OK
;
}
}
HRESULT
WINAPI
IWineD3DDeviceImpl_Init3D
(
IWineD3DDevice
*
iface
,
WINED3DPRESENT_PARAMETERS
*
pPresentationParameters
,
D3DCB_CREATEADDITIONALSWAPCHAIN
D3DCB_CreateAdditionalSwapChain
)
{
HRESULT
WINAPI
IWineD3DDeviceImpl_Init3D
(
IWineD3DDevice
*
iface
,
WINED3DPRESENT_PARAMETERS
*
pPresentationParameters
,
D3DCB_CREATEADDITIONALSWAPCHAIN
D3DCB_CreateAdditionalSwapChain
)
{
...
...
dlls/wined3d/palette.c
View file @
a6f71af0
...
@@ -29,6 +29,8 @@
...
@@ -29,6 +29,8 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d
);
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d
);
#define SIZE_BITS (DDPCAPS_1BIT | DDPCAPS_2BIT | DDPCAPS_4BIT | DDPCAPS_8BIT)
HRESULT
WINAPI
IWineD3DPaletteImpl_QueryInterface
(
IWineD3DPalette
*
iface
,
REFIID
refiid
,
void
**
obj
)
{
HRESULT
WINAPI
IWineD3DPaletteImpl_QueryInterface
(
IWineD3DPalette
*
iface
,
REFIID
refiid
,
void
**
obj
)
{
IWineD3DPaletteImpl
*
This
=
(
IWineD3DPaletteImpl
*
)
iface
;
IWineD3DPaletteImpl
*
This
=
(
IWineD3DPaletteImpl
*
)
iface
;
TRACE
(
"(%p)->(%s,%p)
\n
"
,
This
,
debugstr_guid
(
refiid
),
obj
);
TRACE
(
"(%p)->(%s,%p)
\n
"
,
This
,
debugstr_guid
(
refiid
),
obj
);
...
@@ -67,24 +69,96 @@ ULONG WINAPI IWineD3DPaletteImpl_Release(IWineD3DPalette *iface) {
...
@@ -67,24 +69,96 @@ ULONG WINAPI IWineD3DPaletteImpl_Release(IWineD3DPalette *iface) {
return
ref
;
return
ref
;
}
}
/* Not called from the vtable */
DWORD
IWineD3DPaletteImpl_Size
(
DWORD
dwFlags
)
{
switch
(
dwFlags
&
SIZE_BITS
)
{
case
DDPCAPS_1BIT
:
return
2
;
case
DDPCAPS_2BIT
:
return
4
;
case
DDPCAPS_4BIT
:
return
16
;
case
DDPCAPS_8BIT
:
return
256
;
default:
assert
(
0
);
return
256
;
}
}
HRESULT
WINAPI
IWineD3DPaletteImpl_GetEntries
(
IWineD3DPalette
*
iface
,
DWORD
Flags
,
DWORD
Start
,
DWORD
Count
,
PALETTEENTRY
*
PalEnt
)
{
HRESULT
WINAPI
IWineD3DPaletteImpl_GetEntries
(
IWineD3DPalette
*
iface
,
DWORD
Flags
,
DWORD
Start
,
DWORD
Count
,
PALETTEENTRY
*
PalEnt
)
{
FIXME
(
"This is unimplemented for now(d3d7 merge)
\n
"
);
IWineD3DPaletteImpl
*
This
=
(
IWineD3DPaletteImpl
*
)
iface
;
return
DDERR_INVALIDPARAMS
;
TRACE
(
"(%p)->(%08lx,%ld,%ld,%p)
\n
"
,
This
,
Flags
,
Start
,
Count
,
PalEnt
);
if
(
Flags
!=
0
)
return
WINED3DERR_INVALIDCALL
;
/* unchecked */
if
(
Start
+
Count
>
IWineD3DPaletteImpl_Size
(
This
->
Flags
))
return
WINED3DERR_INVALIDCALL
;
if
(
This
->
Flags
&
DDPCAPS_8BITENTRIES
)
{
unsigned
int
i
;
LPBYTE
entry
=
(
LPBYTE
)
PalEnt
;
for
(
i
=
Start
;
i
<
Count
+
Start
;
i
++
)
*
entry
++
=
This
->
palents
[
i
].
peRed
;
}
else
memcpy
(
PalEnt
,
This
->
palents
+
Start
,
Count
*
sizeof
(
PALETTEENTRY
));
return
WINED3D_OK
;
}
}
HRESULT
WINAPI
IWineD3DPaletteImpl_SetEntries
(
IWineD3DPalette
*
iface
,
DWORD
Flags
,
DWORD
Start
,
DWORD
Count
,
PALETTEENTRY
*
PalEnt
)
{
HRESULT
WINAPI
IWineD3DPaletteImpl_SetEntries
(
IWineD3DPalette
*
iface
,
DWORD
Flags
,
DWORD
Start
,
DWORD
Count
,
PALETTEENTRY
*
PalEnt
)
FIXME
(
"This is unimplemented for now(d3d7 merge)
\n
"
);
{
return
DDERR_INVALIDPARAMS
;
IWineD3DPaletteImpl
*
This
=
(
IWineD3DPaletteImpl
*
)
iface
;
ResourceList
*
res
;
TRACE
(
"(%p)->(%08lx,%ld,%ld,%p)
\n
"
,
This
,
Flags
,
Start
,
Count
,
PalEnt
);
if
(
This
->
Flags
&
DDPCAPS_8BITENTRIES
)
{
unsigned
int
i
;
const
BYTE
*
entry
=
(
const
BYTE
*
)
PalEnt
;
for
(
i
=
Start
;
i
<
Count
+
Start
;
i
++
)
This
->
palents
[
i
].
peRed
=
*
entry
++
;
}
else
{
memcpy
(
This
->
palents
+
Start
,
PalEnt
,
Count
*
sizeof
(
PALETTEENTRY
));
if
(
This
->
hpal
)
SetPaletteEntries
(
This
->
hpal
,
Start
,
Count
,
This
->
palents
+
Start
);
}
#if 0
/* Now, if we are in 'depth conversion mode', update the screen palette */
/* FIXME: we need to update the image or we won't get palette fading. */
if (This->ddraw->d->palette_convert != NULL)
This->ddraw->d->palette_convert(palent,This->screen_palents,start,count);
#endif
/* If the palette is attached to the render target, update all render targets */
for
(
res
=
This
->
wineD3DDevice
->
resources
;
res
!=
NULL
;
res
=
res
->
next
)
{
if
(
IWineD3DResource_GetType
(
res
->
resource
)
==
D3DRTYPE_SURFACE
)
{
IWineD3DSurfaceImpl
*
impl
=
(
IWineD3DSurfaceImpl
*
)
res
->
resource
;
if
(
impl
->
palette
==
This
)
IWineD3DSurface_RealizePalette
(
(
IWineD3DSurface
*
)
res
->
resource
);
}
}
return
WINED3D_OK
;
}
}
HRESULT
WINAPI
IWineD3DPaletteImpl_GetCaps
(
IWineD3DPalette
*
iface
,
DWORD
*
Caps
)
{
HRESULT
WINAPI
IWineD3DPaletteImpl_GetCaps
(
IWineD3DPalette
*
iface
,
DWORD
*
Caps
)
{
FIXME
(
"This is unimplemented for now(d3d7 merge)
\n
"
);
IWineD3DPaletteImpl
*
This
=
(
IWineD3DPaletteImpl
*
)
iface
;
return
DDERR_INVALIDPARAMS
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
Caps
);
*
Caps
=
This
->
Flags
;
return
WINED3D_OK
;
}
}
HRESULT
WINAPI
IWineD3DPaletteImpl_GetParent
(
IWineD3DPalette
*
iface
,
IUnknown
**
Parent
)
{
HRESULT
WINAPI
IWineD3DPaletteImpl_GetParent
(
IWineD3DPalette
*
iface
,
IUnknown
**
Parent
)
{
FIXME
(
"This is unimplemented for now(d3d7 merge)
\n
"
);
IWineD3DPaletteImpl
*
This
=
(
IWineD3DPaletteImpl
*
)
iface
;
return
DDERR_INVALIDPARAMS
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
Parent
);
*
Parent
=
(
IUnknown
*
)
This
->
parent
;
IUnknown_AddRef
(
(
IUnknown
*
)
This
->
parent
);
return
WINED3D_OK
;
}
}
const
IWineD3DPaletteVtbl
IWineD3DPalette_Vtbl
=
const
IWineD3DPaletteVtbl
IWineD3DPalette_Vtbl
=
...
...
dlls/wined3d/wined3d_private.h
View file @
a6f71af0
...
@@ -830,6 +830,7 @@ struct IWineD3DSurfaceImpl
...
@@ -830,6 +830,7 @@ struct IWineD3DSurfaceImpl
/* IWineD3DSurface fields */
/* IWineD3DSurface fields */
IWineD3DBase
*
container
;
IWineD3DBase
*
container
;
WINED3DSURFACET_DESC
currentDesc
;
WINED3DSURFACET_DESC
currentDesc
;
IWineD3DPaletteImpl
*
palette
;
UINT
textureName
;
UINT
textureName
;
UINT
bytesPerPixel
;
UINT
bytesPerPixel
;
...
@@ -1282,9 +1283,22 @@ struct IWineD3DPaletteImpl {
...
@@ -1282,9 +1283,22 @@ struct IWineD3DPaletteImpl {
/* IUnknown parts */
/* IUnknown parts */
const
IWineD3DPaletteVtbl
*
lpVtbl
;
const
IWineD3DPaletteVtbl
*
lpVtbl
;
LONG
ref
;
LONG
ref
;
IUnknown
*
parent
;
IWineD3DDeviceImpl
*
wineD3DDevice
;
/* IWineD3DPalette */
HPALETTE
hpal
;
WORD
palVersion
;
/*| */
WORD
palNumEntries
;
/*| LOGPALETTE */
PALETTEENTRY
palents
[
256
];
/*| */
/* This is to store the palette in 'screen format' */
int
screen_palents
[
256
];
DWORD
Flags
;
};
};
extern
const
IWineD3DPaletteVtbl
IWineD3DPalette_Vtbl
;
extern
const
IWineD3DPaletteVtbl
IWineD3DPalette_Vtbl
;
DWORD
IWineD3DPaletteImpl_Size
(
DWORD
dwFlags
);
/* DirectDraw utility functions */
/* DirectDraw utility functions */
extern
WINED3DFORMAT
pixelformat_for_depth
(
DWORD
depth
);
extern
WINED3DFORMAT
pixelformat_for_depth
(
DWORD
depth
);
...
...
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