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
e8bfaf17
Commit
e8bfaf17
authored
Jul 13, 2012
by
Józef Kucia
Committed by
Alexandre Julliard
Jul 16, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Use structure to pass volume size to pixel format conversion functions.
parent
29acc315
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
73 deletions
+76
-73
d3dx9_36_private.h
dlls/d3dx9_36/d3dx9_36_private.h
+11
-4
surface.c
dlls/d3dx9_36/surface.c
+45
-42
volume.c
dlls/d3dx9_36/volume.c
+20
-27
No files found.
dlls/d3dx9_36/d3dx9_36_private.h
View file @
e8bfaf17
...
...
@@ -37,6 +37,13 @@ struct vec4
float
x
,
y
,
z
,
w
;
};
struct
volume
{
UINT
width
;
UINT
height
;
UINT
depth
;
};
/* for internal use */
typedef
enum
_FormatType
{
FORMAT_ARGB
,
/* unsigned */
...
...
@@ -64,11 +71,11 @@ HRESULT write_buffer_to_file(const WCHAR *filename, ID3DXBuffer *buffer) DECLSPE
const
PixelFormatDesc
*
get_format_info
(
D3DFORMAT
format
)
DECLSPEC_HIDDEN
;
const
PixelFormatDesc
*
get_format_info_idx
(
int
idx
)
DECLSPEC_HIDDEN
;
void
copy_simple_data
(
const
BYTE
*
src
,
UINT
src_row_pitch
,
UINT
src_slice_pitch
,
SIZE
src_size
,
UINT
src_depth
,
const
PixelFormatDesc
*
src_format
,
BYTE
*
dst
,
UINT
dst_row_pitch
,
UINT
dst_slice_pitch
,
SIZE
dst_size
,
UINT
dst_depth
,
const
PixelFormatDesc
*
dst_format
,
void
copy_simple_data
(
const
BYTE
*
src
,
UINT
src_row_pitch
,
UINT
src_slice_pitch
,
struct
volume
*
src_size
,
const
PixelFormatDesc
*
src_format
,
BYTE
*
dst
,
UINT
dst_row_pitch
,
UINT
dst_slice_pitch
,
struct
volume
*
dst_size
,
const
PixelFormatDesc
*
dst_format
,
D3DCOLOR
color_key
)
DECLSPEC_HIDDEN
;
void
point_filter_simple_data
(
const
BYTE
*
src
,
UINT
src_row_pitch
,
UINT
src_slice_pitch
,
SIZE
src_size
,
UINT
src_depth
,
const
PixelFormatDesc
*
src_format
,
BYTE
*
dst
,
UINT
dst_row_pitch
,
UINT
dst_slice_pitch
,
SIZE
dst_size
,
UINT
dst_depth
,
const
PixelFormatDesc
*
dst_format
,
void
point_filter_simple_data
(
const
BYTE
*
src
,
UINT
src_row_pitch
,
UINT
src_slice_pitch
,
struct
volume
*
src_size
,
const
PixelFormatDesc
*
src_format
,
BYTE
*
dst
,
UINT
dst_row_pitch
,
UINT
dst_slice_pitch
,
struct
volume
*
dst_size
,
const
PixelFormatDesc
*
dst_format
,
D3DCOLOR
color_key
)
DECLSPEC_HIDDEN
;
HRESULT
load_texture_from_dds
(
IDirect3DTexture9
*
texture
,
const
void
*
src_data
,
const
PALETTEENTRY
*
palette
,
...
...
dlls/d3dx9_36/surface.c
View file @
e8bfaf17
This diff is collapsed.
Click to expand it.
dlls/d3dx9_36/volume.c
View file @
e8bfaf17
...
...
@@ -95,8 +95,7 @@ HRESULT WINAPI D3DXLoadVolumeFromMemory(IDirect3DVolume9 *dst_volume,
HRESULT
hr
;
D3DVOLUME_DESC
desc
;
D3DLOCKED_BOX
locked_box
;
UINT
dst_width
,
dst_height
,
dst_depth
;
UINT
src_width
,
src_height
,
src_depth
;
struct
volume
dst_size
,
src_size
;
const
PixelFormatDesc
*
src_format_desc
,
*
dst_format_desc
;
TRACE
(
"(%p, %p, %p, %p, %#x, %u, %u, %p, %p, %x, %x)
\n
"
,
dst_volume
,
dst_palette
,
dst_box
,
...
...
@@ -116,15 +115,15 @@ HRESULT WINAPI D3DXLoadVolumeFromMemory(IDirect3DVolume9 *dst_volume,
IDirect3DVolume9_GetDesc
(
dst_volume
,
&
desc
);
src_width
=
src_box
->
Right
-
src_box
->
Left
;
src_height
=
src_box
->
Bottom
-
src_box
->
Top
;
src_depth
=
src_box
->
Back
-
src_box
->
Front
;
src_
size
.
width
=
src_box
->
Right
-
src_box
->
Left
;
src_
size
.
height
=
src_box
->
Bottom
-
src_box
->
Top
;
src_
size
.
depth
=
src_box
->
Back
-
src_box
->
Front
;
if
(
!
dst_box
)
{
dst_width
=
desc
.
Width
;
dst_height
=
desc
.
Height
;
dst_depth
=
desc
.
Depth
;
dst_
size
.
width
=
desc
.
Width
;
dst_
size
.
height
=
desc
.
Height
;
dst_
size
.
depth
=
desc
.
Depth
;
}
else
{
...
...
@@ -135,9 +134,9 @@ HRESULT WINAPI D3DXLoadVolumeFromMemory(IDirect3DVolume9 *dst_volume,
if
(
dst_box
->
Front
>=
dst_box
->
Back
||
dst_box
->
Back
>
desc
.
Depth
)
return
D3DERR_INVALIDCALL
;
dst_width
=
dst_box
->
Right
-
dst_box
->
Left
;
dst_height
=
dst_box
->
Bottom
-
dst_box
->
Top
;
dst_depth
=
dst_box
->
Back
-
dst_box
->
Front
;
dst_
size
.
width
=
dst_box
->
Right
-
dst_box
->
Left
;
dst_
size
.
height
=
dst_box
->
Bottom
-
dst_box
->
Top
;
dst_
size
.
depth
=
dst_box
->
Back
-
dst_box
->
Front
;
}
src_format_desc
=
get_format_info
(
src_format
);
...
...
@@ -149,20 +148,20 @@ HRESULT WINAPI D3DXLoadVolumeFromMemory(IDirect3DVolume9 *dst_volume,
return
E_NOTIMPL
;
if
(
desc
.
Format
==
src_format
&&
dst_
width
==
src_width
&&
dst_height
==
src_height
&&
dst_depth
==
src_
depth
)
&&
dst_
size
.
width
==
src_size
.
width
&&
dst_size
.
height
==
src_size
.
height
&&
dst_size
.
depth
==
src_size
.
depth
)
{
UINT
row
,
slice
;
BYTE
*
dst_addr
;
const
BYTE
*
src_addr
;
UINT
row_block_count
=
(
src_width
+
src_format_desc
->
block_width
-
1
)
/
src_format_desc
->
block_width
;
UINT
row_count
=
(
src_height
+
src_format_desc
->
block_height
-
1
)
/
src_format_desc
->
block_height
;
UINT
row_block_count
=
(
src_
size
.
width
+
src_format_desc
->
block_width
-
1
)
/
src_format_desc
->
block_width
;
UINT
row_count
=
(
src_
size
.
height
+
src_format_desc
->
block_height
-
1
)
/
src_format_desc
->
block_height
;
if
(
src_box
->
Left
&
(
src_format_desc
->
block_width
-
1
)
||
src_box
->
Top
&
(
src_format_desc
->
block_height
-
1
)
||
(
src_box
->
Right
&
(
src_format_desc
->
block_width
-
1
)
&&
src_width
!=
desc
.
Width
)
&&
src_
size
.
width
!=
desc
.
Width
)
||
(
src_box
->
Bottom
&
(
src_format_desc
->
block_height
-
1
)
&&
src_height
!=
desc
.
Height
))
&&
src_
size
.
height
!=
desc
.
Height
))
{
FIXME
(
"Source box (%u, %u, %u, %u) is misaligned
\n
"
,
src_box
->
Left
,
src_box
->
Top
,
src_box
->
Right
,
src_box
->
Bottom
);
...
...
@@ -172,7 +171,7 @@ HRESULT WINAPI D3DXLoadVolumeFromMemory(IDirect3DVolume9 *dst_volume,
hr
=
IDirect3DVolume9_LockBox
(
dst_volume
,
&
locked_box
,
dst_box
,
0
);
if
(
FAILED
(
hr
))
return
hr
;
for
(
slice
=
0
;
slice
<
src_depth
;
slice
++
)
for
(
slice
=
0
;
slice
<
src_
size
.
depth
;
slice
++
)
{
src_addr
=
src_memory
;
src_addr
+=
(
src_box
->
Front
+
slice
)
*
src_slice_pitch
;
...
...
@@ -195,7 +194,6 @@ HRESULT WINAPI D3DXLoadVolumeFromMemory(IDirect3DVolume9 *dst_volume,
else
{
const
BYTE
*
src_addr
;
SIZE
src_size
,
dst_size
;
if
(
src_format_desc
->
bytes_per_pixel
>
4
||
dst_format_desc
->
bytes_per_pixel
>
4
||
src_format_desc
->
block_height
!=
1
||
src_format_desc
->
block_width
!=
1
...
...
@@ -206,11 +204,6 @@ HRESULT WINAPI D3DXLoadVolumeFromMemory(IDirect3DVolume9 *dst_volume,
return
E_NOTIMPL
;
}
src_size
.
cx
=
src_width
;
src_size
.
cy
=
src_height
;
dst_size
.
cx
=
dst_width
;
dst_size
.
cy
=
dst_height
;
src_addr
=
src_memory
;
src_addr
+=
src_box
->
Front
*
src_slice_pitch
;
src_addr
+=
src_box
->
Top
*
src_row_pitch
;
...
...
@@ -221,16 +214,16 @@ HRESULT WINAPI D3DXLoadVolumeFromMemory(IDirect3DVolume9 *dst_volume,
if
((
filter
&
0xf
)
==
D3DX_FILTER_NONE
)
{
copy_simple_data
(
src_memory
,
src_row_pitch
,
src_slice_pitch
,
src_size
,
src_depth
,
src_format_desc
,
locked_box
.
pBits
,
locked_box
.
RowPitch
,
locked_box
.
SlicePitch
,
dst_size
,
dst_depth
,
dst_format_desc
,
color_key
);
copy_simple_data
(
src_memory
,
src_row_pitch
,
src_slice_pitch
,
&
src_size
,
src_format_desc
,
locked_box
.
pBits
,
locked_box
.
RowPitch
,
locked_box
.
SlicePitch
,
&
dst_size
,
dst_format_desc
,
color_key
);
}
else
{
if
((
filter
&
0xf
)
!=
D3DX_FILTER_POINT
)
FIXME
(
"Unhandled filter %#x.
\n
"
,
filter
);
point_filter_simple_data
(
src_addr
,
src_row_pitch
,
src_slice_pitch
,
src_size
,
src_depth
,
src_format_desc
,
locked_box
.
pBits
,
locked_box
.
RowPitch
,
locked_box
.
SlicePitch
,
dst_size
,
dst_depth
,
dst_format_desc
,
color_key
);
point_filter_simple_data
(
src_addr
,
src_row_pitch
,
src_slice_pitch
,
&
src_size
,
src_format_desc
,
locked_box
.
pBits
,
locked_box
.
RowPitch
,
locked_box
.
SlicePitch
,
&
dst_size
,
dst_format_desc
,
color_key
);
}
IDirect3DVolume9_UnlockBox
(
dst_volume
);
...
...
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