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
b413a4e2
Commit
b413a4e2
authored
Apr 06, 2015
by
Stefan Dösinger
Committed by
Alexandre Julliard
Apr 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Add more formats to wined3d_format_convert_color_to_float.
parent
fa0a9232
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
25 deletions
+38
-25
utils.c
dlls/wined3d/utils.c
+38
-25
No files found.
dlls/wined3d/utils.c
View file @
b413a4e2
...
@@ -3511,11 +3511,48 @@ DWORD wined3d_format_convert_from_float(const struct wined3d_surface *surface, c
...
@@ -3511,11 +3511,48 @@ DWORD wined3d_format_convert_from_float(const struct wined3d_surface *surface, c
return
0
;
return
0
;
}
}
static
float
color_to_float
(
DWORD
color
,
DWORD
size
,
DWORD
offset
)
{
DWORD
mask
=
(
1
<<
size
)
-
1
;
if
(
!
size
)
return
1
.
0
f
;
color
>>=
offset
;
color
&=
mask
;
return
(
float
)
color
/
(
float
)
mask
;
}
BOOL
wined3d_format_convert_color_to_float
(
const
struct
wined3d_format
*
format
,
BOOL
wined3d_format_convert_color_to_float
(
const
struct
wined3d_format
*
format
,
const
struct
wined3d_palette
*
palette
,
DWORD
color
,
struct
wined3d_color
*
float_color
)
const
struct
wined3d_palette
*
palette
,
DWORD
color
,
struct
wined3d_color
*
float_color
)
{
{
switch
(
format
->
id
)
switch
(
format
->
id
)
{
{
case
WINED3DFMT_B8G8R8_UNORM
:
case
WINED3DFMT_B8G8R8A8_UNORM
:
case
WINED3DFMT_B8G8R8X8_UNORM
:
case
WINED3DFMT_B5G6R5_UNORM
:
case
WINED3DFMT_B5G5R5X1_UNORM
:
case
WINED3DFMT_B5G5R5A1_UNORM
:
case
WINED3DFMT_B4G4R4A4_UNORM
:
case
WINED3DFMT_B2G3R3_UNORM
:
case
WINED3DFMT_R8_UNORM
:
case
WINED3DFMT_A8_UNORM
:
case
WINED3DFMT_B2G3R3A8_UNORM
:
case
WINED3DFMT_B4G4R4X4_UNORM
:
case
WINED3DFMT_R10G10B10A2_UNORM
:
case
WINED3DFMT_R10G10B10A2_SNORM
:
case
WINED3DFMT_R8G8B8A8_UNORM
:
case
WINED3DFMT_R8G8B8X8_UNORM
:
case
WINED3DFMT_R16G16_UNORM
:
case
WINED3DFMT_B10G10R10A2_UNORM
:
float_color
->
r
=
color_to_float
(
color
,
format
->
red_size
,
format
->
red_offset
);
float_color
->
g
=
color_to_float
(
color
,
format
->
green_size
,
format
->
green_size
);
float_color
->
b
=
color_to_float
(
color
,
format
->
blue_size
,
format
->
blue_offset
);
float_color
->
a
=
color_to_float
(
color
,
format
->
alpha_size
,
format
->
alpha_offset
);
return
TRUE
;
case
WINED3DFMT_P8_UINT
:
case
WINED3DFMT_P8_UINT
:
if
(
palette
)
if
(
palette
)
{
{
...
@@ -3530,36 +3567,12 @@ BOOL wined3d_format_convert_color_to_float(const struct wined3d_format *format,
...
@@ -3530,36 +3567,12 @@ BOOL wined3d_format_convert_color_to_float(const struct wined3d_format *format,
float_color
->
b
=
0
.
0
f
;
float_color
->
b
=
0
.
0
f
;
}
}
float_color
->
a
=
color
/
255
.
0
f
;
float_color
->
a
=
color
/
255
.
0
f
;
break
;
return
TRUE
;
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:
default:
ERR
(
"Unhandled conversion from %s to floating point.
\n
"
,
debug_d3dformat
(
format
->
id
));
ERR
(
"Unhandled conversion from %s to floating point.
\n
"
,
debug_d3dformat
(
format
->
id
));
return
FALSE
;
return
FALSE
;
}
}
return
TRUE
;
}
}
/* DirectDraw stuff */
/* DirectDraw stuff */
...
...
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