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
d063ff55
Commit
d063ff55
authored
Aug 21, 2011
by
Henri Verbeet
Committed by
Alexandre Julliard
Aug 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Move surface_color_fill() based color fills from…
wined3d: Move surface_color_fill() based color fills from IWineD3DSurfaceImpl_BltOverride() to wined3d_surface_blt().
parent
a887128f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
83 deletions
+82
-83
surface.c
dlls/wined3d/surface.c
+82
-83
No files found.
dlls/wined3d/surface.c
View file @
d063ff55
...
...
@@ -1210,6 +1210,73 @@ static BOOL fbo_blit_supported(const struct wined3d_gl_info *gl_info, enum wined
return
TRUE
;
}
/* This function checks if the primary render target uses the 8bit paletted format. */
static
BOOL
primary_render_target_is_p8
(
const
struct
wined3d_device
*
device
)
{
if
(
device
->
fb
.
render_targets
&&
device
->
fb
.
render_targets
[
0
])
{
const
struct
wined3d_surface
*
render_target
=
device
->
fb
.
render_targets
[
0
];
if
((
render_target
->
resource
.
usage
&
WINED3DUSAGE_RENDERTARGET
)
&&
(
render_target
->
resource
.
format
->
id
==
WINED3DFMT_P8_UINT
))
return
TRUE
;
}
return
FALSE
;
}
static
BOOL
surface_convert_color_to_float
(
const
struct
wined3d_surface
*
surface
,
DWORD
color
,
WINED3DCOLORVALUE
*
float_color
)
{
const
struct
wined3d_format
*
format
=
surface
->
resource
.
format
;
const
struct
wined3d_device
*
device
=
surface
->
resource
.
device
;
switch
(
format
->
id
)
{
case
WINED3DFMT_P8_UINT
:
if
(
surface
->
palette
)
{
float_color
->
r
=
surface
->
palette
->
palents
[
color
].
peRed
/
255
.
0
f
;
float_color
->
g
=
surface
->
palette
->
palents
[
color
].
peGreen
/
255
.
0
f
;
float_color
->
b
=
surface
->
palette
->
palents
[
color
].
peBlue
/
255
.
0
f
;
}
else
{
float_color
->
r
=
0
.
0
f
;
float_color
->
g
=
0
.
0
f
;
float_color
->
b
=
0
.
0
f
;
}
float_color
->
a
=
primary_render_target_is_p8
(
device
)
?
color
/
255
.
0
f
:
1
.
0
f
;
break
;
case
WINED3DFMT_B5G6R5_UNORM
:
float_color
->
r
=
((
color
>>
11
)
&
0x1f
)
/
31
.
0
f
;
float_color
->
g
=
((
color
>>
5
)
&
0x3f
)
/
63
.
0
f
;
float_color
->
b
=
(
color
&
0x1f
)
/
31
.
0
f
;
float_color
->
a
=
1
.
0
f
;
break
;
case
WINED3DFMT_B8G8R8_UNORM
:
case
WINED3DFMT_B8G8R8X8_UNORM
:
float_color
->
r
=
D3DCOLOR_R
(
color
);
float_color
->
g
=
D3DCOLOR_G
(
color
);
float_color
->
b
=
D3DCOLOR_B
(
color
);
float_color
->
a
=
1
.
0
f
;
break
;
case
WINED3DFMT_B8G8R8A8_UNORM
:
float_color
->
r
=
D3DCOLOR_R
(
color
);
float_color
->
g
=
D3DCOLOR_G
(
color
);
float_color
->
b
=
D3DCOLOR_B
(
color
);
float_color
->
a
=
D3DCOLOR_A
(
color
);
break
;
default:
ERR
(
"Unhandled conversion from %s to floating point.
\n
"
,
debug_d3dformat
(
format
->
id
));
return
FALSE
;
}
return
TRUE
;
}
static
BOOL
surface_convert_depth_to_float
(
const
struct
wined3d_surface
*
surface
,
DWORD
depth
,
float
*
float_depth
)
{
const
struct
wined3d_format
*
format
=
surface
->
resource
.
format
;
...
...
@@ -1464,6 +1531,21 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
return
WINED3D_OK
;
}
}
else
{
if
(
flags
&
WINEDDBLT_COLORFILL
)
{
WINED3DCOLORVALUE
color
;
TRACE
(
"Color fill.
\n
"
);
if
(
!
surface_convert_color_to_float
(
dst_surface
,
fx
->
u5
.
dwFillColor
,
&
color
))
goto
fallback
;
if
(
SUCCEEDED
(
surface_color_fill
(
dst_surface
,
&
dst_rect
,
&
color
)))
return
WINED3D_OK
;
}
}
fallback:
...
...
@@ -2029,19 +2111,6 @@ void surface_bind(struct wined3d_surface *surface, const struct wined3d_gl_info
}
}
/* This function checks if the primary render target uses the 8bit paletted format. */
static
BOOL
primary_render_target_is_p8
(
const
struct
wined3d_device
*
device
)
{
if
(
device
->
fb
.
render_targets
&&
device
->
fb
.
render_targets
[
0
])
{
const
struct
wined3d_surface
*
render_target
=
device
->
fb
.
render_targets
[
0
];
if
((
render_target
->
resource
.
usage
&
WINED3DUSAGE_RENDERTARGET
)
&&
(
render_target
->
resource
.
format
->
id
==
WINED3DFMT_P8_UINT
))
return
TRUE
;
}
return
FALSE
;
}
/* This call just downloads data, the caller is responsible for binding the
* correct texture. */
/* Context activation is done by the caller. */
...
...
@@ -2523,60 +2592,6 @@ void surface_add_dirty_rect(struct wined3d_surface *surface, const WINED3DBOX *d
}
}
static
BOOL
surface_convert_color_to_float
(
const
struct
wined3d_surface
*
surface
,
DWORD
color
,
WINED3DCOLORVALUE
*
float_color
)
{
const
struct
wined3d_format
*
format
=
surface
->
resource
.
format
;
const
struct
wined3d_device
*
device
=
surface
->
resource
.
device
;
switch
(
format
->
id
)
{
case
WINED3DFMT_P8_UINT
:
if
(
surface
->
palette
)
{
float_color
->
r
=
surface
->
palette
->
palents
[
color
].
peRed
/
255
.
0
f
;
float_color
->
g
=
surface
->
palette
->
palents
[
color
].
peGreen
/
255
.
0
f
;
float_color
->
b
=
surface
->
palette
->
palents
[
color
].
peBlue
/
255
.
0
f
;
}
else
{
float_color
->
r
=
0
.
0
f
;
float_color
->
g
=
0
.
0
f
;
float_color
->
b
=
0
.
0
f
;
}
float_color
->
a
=
primary_render_target_is_p8
(
device
)
?
color
/
255
.
0
f
:
1
.
0
f
;
break
;
case
WINED3DFMT_B5G6R5_UNORM
:
float_color
->
r
=
((
color
>>
11
)
&
0x1f
)
/
31
.
0
f
;
float_color
->
g
=
((
color
>>
5
)
&
0x3f
)
/
63
.
0
f
;
float_color
->
b
=
(
color
&
0x1f
)
/
31
.
0
f
;
float_color
->
a
=
1
.
0
f
;
break
;
case
WINED3DFMT_B8G8R8_UNORM
:
case
WINED3DFMT_B8G8R8X8_UNORM
:
float_color
->
r
=
D3DCOLOR_R
(
color
);
float_color
->
g
=
D3DCOLOR_G
(
color
);
float_color
->
b
=
D3DCOLOR_B
(
color
);
float_color
->
a
=
1
.
0
f
;
break
;
case
WINED3DFMT_B8G8R8A8_UNORM
:
float_color
->
r
=
D3DCOLOR_R
(
color
);
float_color
->
g
=
D3DCOLOR_G
(
color
);
float_color
->
b
=
D3DCOLOR_B
(
color
);
float_color
->
a
=
D3DCOLOR_A
(
color
);
break
;
default:
ERR
(
"Unhandled conversion from %s to floating point.
\n
"
,
debug_d3dformat
(
format
->
id
));
return
FALSE
;
}
return
TRUE
;
}
HRESULT
surface_load
(
struct
wined3d_surface
*
surface
,
BOOL
srgb
)
{
DWORD
flag
=
srgb
?
SFLAG_INSRGBTEX
:
SFLAG_INTEXTURE
;
...
...
@@ -5552,22 +5567,6 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(struct wined3d_surface *dst_surfa
return
WINED3D_OK
;
}
else
{
/* Source-Less Blit to render target */
if
(
flags
&
WINEDDBLT_COLORFILL
)
{
WINED3DCOLORVALUE
color
;
TRACE
(
"Colorfill
\n
"
);
/* The color as given in the Blt function is in the surface format. */
if
(
!
surface_convert_color_to_float
(
dst_surface
,
DDBltFx
->
u5
.
dwFillColor
,
&
color
))
return
WINED3DERR_INVALIDCALL
;
return
surface_color_fill
(
dst_surface
,
dst_rect
,
&
color
);
}
}
/* Default: Fall back to the generic blt. Not an error, a TRACE is enough */
TRACE
(
"Didn't find any usable render target setup for hw blit, falling back to software
\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