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
8e64d870
Commit
8e64d870
authored
Oct 08, 2007
by
Roderick Colenbrander
Committed by
Alexandre Julliard
Oct 10, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Merge p8 palette initialization code.
parent
848650d9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
51 deletions
+16
-51
surface.c
dlls/wined3d/surface.c
+16
-51
No files found.
dlls/wined3d/surface.c
View file @
8e64d870
...
...
@@ -34,6 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
HRESULT
d3dfmt_convert_surface
(
BYTE
*
src
,
BYTE
*
dst
,
UINT
pitch
,
UINT
width
,
UINT
height
,
UINT
outpitch
,
CONVERT_TYPES
convert
,
IWineD3DSurfaceImpl
*
surf
);
static
void
d3dfmt_p8_init_palette
(
IWineD3DSurfaceImpl
*
This
,
BYTE
(
*
table
)[
4
],
BOOL
colorkey
);
static
void
surface_download_data
(
IWineD3DSurfaceImpl
*
This
)
{
if
(
!
(
This
->
resource
.
allocatedMemory
||
This
->
Flags
&
SFLAG_PBO
))
This
->
resource
.
allocatedMemory
=
HeapAlloc
(
GetProcessHeap
(),
0
,
This
->
resource
.
size
+
4
);
...
...
@@ -1589,54 +1590,13 @@ HRESULT d3dfmt_convert_surface(BYTE *src, BYTE *dst, UINT pitch, UINT width, UIN
{
IWineD3DPaletteImpl
*
pal
=
This
->
palette
;
BYTE
table
[
256
][
4
];
unsigned
int
i
;
unsigned
int
x
,
y
;
if
(
pal
==
NULL
)
{
/* TODO: If we are a sublevel, try to get the palette from level 0 */
}
if
(
pal
==
NULL
)
{
/* Still no palette? Use the device's palette */
/* Get the surface's palette */
for
(
i
=
0
;
i
<
256
;
i
++
)
{
IWineD3DDeviceImpl
*
device
=
This
->
resource
.
wineD3DDevice
;
table
[
i
][
0
]
=
device
->
palettes
[
device
->
currentPalette
][
i
].
peRed
;
table
[
i
][
1
]
=
device
->
palettes
[
device
->
currentPalette
][
i
].
peGreen
;
table
[
i
][
2
]
=
device
->
palettes
[
device
->
currentPalette
][
i
].
peBlue
;
if
((
convert
==
CONVERT_PALETTED_CK
)
&&
(
i
>=
This
->
SrcBltCKey
.
dwColorSpaceLowValue
)
&&
(
i
<=
This
->
SrcBltCKey
.
dwColorSpaceHighValue
))
{
/* We should maybe here put a more 'neutral' color than the standard bright purple
one often used by application to prevent the nice purple borders when bi-linear
filtering is on */
table
[
i
][
3
]
=
0x00
;
}
else
{
table
[
i
][
3
]
=
0xFF
;
}
}
}
else
{
TRACE
(
"Using surface palette %p
\n
"
,
pal
);
/* Get the surface's palette */
for
(
i
=
0
;
i
<
256
;
i
++
)
{
table
[
i
][
0
]
=
pal
->
palents
[
i
].
peRed
;
table
[
i
][
1
]
=
pal
->
palents
[
i
].
peGreen
;
table
[
i
][
2
]
=
pal
->
palents
[
i
].
peBlue
;
if
((
convert
==
CONVERT_PALETTED_CK
)
&&
(
i
>=
This
->
SrcBltCKey
.
dwColorSpaceLowValue
)
&&
(
i
<=
This
->
SrcBltCKey
.
dwColorSpaceHighValue
))
{
/* We should maybe here put a more 'neutral' color than the standard bright purple
one often used by application to prevent the nice purple borders when bi-linear
filtering is on */
table
[
i
][
3
]
=
0x00
;
}
else
if
(
pal
->
Flags
&
WINEDDPCAPS_ALPHA
)
{
table
[
i
][
3
]
=
pal
->
palents
[
i
].
peFlags
;
}
else
{
table
[
i
][
3
]
=
0xFF
;
}
}
}
d3dfmt_p8_init_palette
(
This
,
table
,
(
convert
==
CONVERT_PALETTED_CK
));
for
(
y
=
0
;
y
<
height
;
y
++
)
{
...
...
@@ -1930,14 +1890,8 @@ HRESULT d3dfmt_convert_surface(BYTE *src, BYTE *dst, UINT pitch, UINT width, UIN
return
WINED3D_OK
;
}
/* This function is used in case of 8bit paletted textures to upload the palette.
For now it only supports GL_EXT_paletted_texture extension but support for other
extensions like ARB_fragment_program and ATI_fragment_shaders will be added as well.
*/
static
void
d3dfmt_p8_upload_palette
(
IWineD3DSurface
*
iface
,
CONVERT_TYPES
convert
)
{
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
static
void
d3dfmt_p8_init_palette
(
IWineD3DSurfaceImpl
*
This
,
BYTE
(
*
table
)[
4
],
BOOL
colorkey
)
{
IWineD3DPaletteImpl
*
pal
=
This
->
palette
;
BYTE
table
[
256
][
4
];
int
i
;
if
(
pal
==
NULL
)
{
...
...
@@ -1949,7 +1903,7 @@ static void d3dfmt_p8_upload_palette(IWineD3DSurface *iface, CONVERT_TYPES conve
table
[
i
][
0
]
=
device
->
palettes
[
device
->
currentPalette
][
i
].
peRed
;
table
[
i
][
1
]
=
device
->
palettes
[
device
->
currentPalette
][
i
].
peGreen
;
table
[
i
][
2
]
=
device
->
palettes
[
device
->
currentPalette
][
i
].
peBlue
;
if
(
(
convert
==
CONVERT_PALETTED_CK
)
&&
if
(
colorkey
&&
(
i
>=
This
->
SrcBltCKey
.
dwColorSpaceLowValue
)
&&
(
i
<=
This
->
SrcBltCKey
.
dwColorSpaceHighValue
))
{
/* We should maybe here put a more 'neutral' color than the standard bright purple
...
...
@@ -1967,7 +1921,7 @@ static void d3dfmt_p8_upload_palette(IWineD3DSurface *iface, CONVERT_TYPES conve
table
[
i
][
0
]
=
pal
->
palents
[
i
].
peRed
;
table
[
i
][
1
]
=
pal
->
palents
[
i
].
peGreen
;
table
[
i
][
2
]
=
pal
->
palents
[
i
].
peBlue
;
if
(
(
convert
==
CONVERT_PALETTED_CK
)
&&
if
(
colorkey
&&
(
i
>=
This
->
SrcBltCKey
.
dwColorSpaceLowValue
)
&&
(
i
<=
This
->
SrcBltCKey
.
dwColorSpaceHighValue
))
{
/* We should maybe here put a more 'neutral' color than the standard bright purple
...
...
@@ -1981,6 +1935,17 @@ static void d3dfmt_p8_upload_palette(IWineD3DSurface *iface, CONVERT_TYPES conve
}
}
}
}
/* This function is used in case of 8bit paletted textures to upload the palette.
For now it only supports GL_EXT_paletted_texture extension but support for other
extensions like ARB_fragment_program and ATI_fragment_shaders will be added as well.
*/
static
void
d3dfmt_p8_upload_palette
(
IWineD3DSurface
*
iface
,
CONVERT_TYPES
convert
)
{
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
BYTE
table
[
256
][
4
];
d3dfmt_p8_init_palette
(
This
,
table
,
(
convert
==
CONVERT_PALETTED_CK
));
GL_EXTCALL
(
glColorTableEXT
(
GL_TEXTURE_2D
,
GL_RGBA
,
256
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
table
));
}
...
...
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