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
b8f6c9cd
Commit
b8f6c9cd
authored
Apr 30, 2012
by
Henri Verbeet
Committed by
Alexandre Julliard
May 01, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Cleanup parameter names for D3DXLoadSurfaceFromMemory().
parent
02cb4fe2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
59 deletions
+54
-59
surface.c
dlls/d3dx9_36/surface.c
+50
-49
d3dx9tex.h
include/d3dx9tex.h
+4
-10
No files found.
dlls/d3dx9_36/surface.c
View file @
b8f6c9cd
...
...
@@ -926,16 +926,10 @@ static void point_filter_simple_data(const BYTE *src, UINT srcpitch, SIZE src_si
* negative values for pSrcRect are allowed as we're only looking at the width and height anyway.
*
*/
HRESULT
WINAPI
D3DXLoadSurfaceFromMemory
(
LPDIRECT3DSURFACE9
pDestSurface
,
CONST
PALETTEENTRY
*
pDestPalette
,
CONST
RECT
*
pDestRect
,
LPCVOID
pSrcMemory
,
D3DFORMAT
SrcFormat
,
UINT
SrcPitch
,
CONST
PALETTEENTRY
*
pSrcPalette
,
CONST
RECT
*
pSrcRect
,
DWORD
dwFilter
,
D3DCOLOR
Colorkey
)
HRESULT
WINAPI
D3DXLoadSurfaceFromMemory
(
IDirect3DSurface9
*
dst_surface
,
const
PALETTEENTRY
*
dst_palette
,
const
RECT
*
dst_rect
,
const
void
*
src_memory
,
D3DFORMAT
src_format
,
UINT
src_pitch
,
const
PALETTEENTRY
*
src_palette
,
const
RECT
*
src_rect
,
DWORD
filter
,
D3DCOLOR
color_key
)
{
CONST
PixelFormatDesc
*
srcformatdesc
,
*
destformatdesc
;
D3DSURFACE_DESC
surfdesc
;
...
...
@@ -943,35 +937,44 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(LPDIRECT3DSURFACE9 pDestSurface,
SIZE
src_size
,
dst_size
;
HRESULT
hr
;
TRACE
(
"(%p, %p, %p, %p, %x, %u, %p, %p %u, %#x)
\n
"
,
pDestSurface
,
pDestPalette
,
pDestRect
,
pSrcMemory
,
SrcFormat
,
SrcPitch
,
pSrcPalette
,
pSrcRect
,
dwFilter
,
Colorkey
);
TRACE
(
"(%p, %p, %s, %p, %#x, %u, %p, %s %#x, 0x%08x)
\n
"
,
dst_surface
,
dst_palette
,
wine_dbgstr_rect
(
dst_rect
),
src_memory
,
src_format
,
src_pitch
,
src_palette
,
wine_dbgstr_rect
(
src_rect
),
filter
,
color_key
);
if
(
!
pDestSurface
||
!
pSrcMemory
||
!
pSrcRect
)
return
D3DERR_INVALIDCALL
;
if
(
SrcFormat
==
D3DFMT_UNKNOWN
||
pSrcRect
->
left
>=
pSrcRect
->
right
||
pSrcRect
->
top
>=
pSrcRect
->
bottom
)
return
E_FAIL
;
if
(
!
dst_surface
||
!
src_memory
||
!
src_rect
)
return
D3DERR_INVALIDCALL
;
if
(
src_format
==
D3DFMT_UNKNOWN
||
src_rect
->
left
>=
src_rect
->
right
||
src_rect
->
top
>=
src_rect
->
bottom
)
return
E_FAIL
;
if
(
dwFilter
==
D3DX_DEFAULT
)
dwFilter
=
D3DX_FILTER_TRIANGLE
|
D3DX_FILTER_DITHER
;
if
(
filter
==
D3DX_DEFAULT
)
filter
=
D3DX_FILTER_TRIANGLE
|
D3DX_FILTER_DITHER
;
IDirect3DSurface9_GetDesc
(
pDestS
urface
,
&
surfdesc
);
IDirect3DSurface9_GetDesc
(
dst_s
urface
,
&
surfdesc
);
src_size
.
cx
=
pSrcRect
->
right
-
pSrcR
ect
->
left
;
src_size
.
cy
=
pSrcRect
->
bottom
-
pSrcR
ect
->
top
;
if
(
!
pDestR
ect
)
src_size
.
cx
=
src_rect
->
right
-
src_r
ect
->
left
;
src_size
.
cy
=
src_rect
->
bottom
-
src_r
ect
->
top
;
if
(
!
dst_r
ect
)
{
dst_size
.
cx
=
surfdesc
.
Width
;
dst_size
.
cy
=
surfdesc
.
Height
;
}
else
{
if
(
pDestRect
->
left
>
pDestRect
->
right
||
pDestRect
->
right
>
surfdesc
.
Width
)
return
D3DERR_INVALIDCALL
;
if
(
pDestRect
->
top
>
pDestRect
->
bottom
||
pDestRect
->
bottom
>
surfdesc
.
Height
)
return
D3DERR_INVALIDCALL
;
if
(
pDestRect
->
left
<
0
||
pDestRect
->
top
<
0
)
return
D3DERR_INVALIDCALL
;
dst_size
.
cx
=
pDestRect
->
right
-
pDestRect
->
left
;
dst_size
.
cy
=
pDestRect
->
bottom
-
pDestRect
->
top
;
if
(
dst_rect
->
left
>
dst_rect
->
right
||
dst_rect
->
right
>
surfdesc
.
Width
)
return
D3DERR_INVALIDCALL
;
if
(
dst_rect
->
top
>
dst_rect
->
bottom
||
dst_rect
->
bottom
>
surfdesc
.
Height
)
return
D3DERR_INVALIDCALL
;
if
(
dst_rect
->
left
<
0
||
dst_rect
->
top
<
0
)
return
D3DERR_INVALIDCALL
;
dst_size
.
cx
=
dst_rect
->
right
-
dst_rect
->
left
;
dst_size
.
cy
=
dst_rect
->
bottom
-
dst_rect
->
top
;
if
(
!
dst_size
.
cx
||
!
dst_size
.
cy
)
return
D3D_OK
;
}
srcformatdesc
=
get_format_info
(
SrcF
ormat
);
srcformatdesc
=
get_format_info
(
src_f
ormat
);
if
(
srcformatdesc
->
type
==
FORMAT_UNKNOWN
)
return
E_NOTIMPL
;
...
...
@@ -979,7 +982,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(LPDIRECT3DSURFACE9 pDestSurface,
if
(
destformatdesc
->
type
==
FORMAT_UNKNOWN
)
return
E_NOTIMPL
;
if
(
SrcF
ormat
==
surfdesc
.
Format
if
(
src_f
ormat
==
surfdesc
.
Format
&&
dst_size
.
cx
==
src_size
.
cx
&&
dst_size
.
cy
==
src_size
.
cy
)
/* Simple copy. */
{
...
...
@@ -989,33 +992,33 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(LPDIRECT3DSURFACE9 pDestSurface,
BYTE
*
dst_addr
;
UINT
row
;
if
(
pSrcR
ect
->
left
&
(
srcformatdesc
->
block_width
-
1
)
||
pSrcR
ect
->
top
&
(
srcformatdesc
->
block_height
-
1
)
||
(
pSrcR
ect
->
right
&
(
srcformatdesc
->
block_width
-
1
)
if
(
src_r
ect
->
left
&
(
srcformatdesc
->
block_width
-
1
)
||
src_r
ect
->
top
&
(
srcformatdesc
->
block_height
-
1
)
||
(
src_r
ect
->
right
&
(
srcformatdesc
->
block_width
-
1
)
&&
src_size
.
cx
!=
surfdesc
.
Width
)
||
(
pSrcR
ect
->
bottom
&
(
srcformatdesc
->
block_height
-
1
)
||
(
src_r
ect
->
bottom
&
(
srcformatdesc
->
block_height
-
1
)
&&
src_size
.
cy
!=
surfdesc
.
Height
))
{
WARN
(
"Source rect %s is misaligned.
\n
"
,
wine_dbgstr_rect
(
pSrcR
ect
));
WARN
(
"Source rect %s is misaligned.
\n
"
,
wine_dbgstr_rect
(
src_r
ect
));
return
D3DXERR_INVALIDDATA
;
}
if
(
FAILED
(
hr
=
IDirect3DSurface9_LockRect
(
pDestSurface
,
&
lockrect
,
pDestR
ect
,
0
)))
if
(
FAILED
(
hr
=
IDirect3DSurface9_LockRect
(
dst_surface
,
&
lockrect
,
dst_r
ect
,
0
)))
return
D3DXERR_INVALIDDATA
;
src_addr
=
pSrcM
emory
;
src_addr
+=
(
pSrcRect
->
top
/
srcformatdesc
->
block_height
)
*
SrcP
itch
;
src_addr
+=
(
pSrcR
ect
->
left
/
srcformatdesc
->
block_width
)
*
srcformatdesc
->
block_byte_count
;
src_addr
=
src_m
emory
;
src_addr
+=
(
src_rect
->
top
/
srcformatdesc
->
block_height
)
*
src_p
itch
;
src_addr
+=
(
src_r
ect
->
left
/
srcformatdesc
->
block_width
)
*
srcformatdesc
->
block_byte_count
;
dst_addr
=
lockrect
.
pBits
;
for
(
row
=
0
;
row
<
row_count
;
++
row
)
{
memcpy
(
dst_addr
,
src_addr
,
row_block_count
*
srcformatdesc
->
block_byte_count
);
src_addr
+=
SrcP
itch
;
src_addr
+=
src_p
itch
;
dst_addr
+=
lockrect
.
Pitch
;
}
IDirect3DSurface9_UnlockRect
(
pDestS
urface
);
IDirect3DSurface9_UnlockRect
(
dst_s
urface
);
}
else
/* Stretching or format conversion. */
{
...
...
@@ -1028,28 +1031,26 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(LPDIRECT3DSURFACE9 pDestSurface,
if
(
destformatdesc
->
block_height
!=
1
||
destformatdesc
->
block_width
!=
1
)
return
E_NOTIMPL
;
if
(
FAILED
(
hr
=
IDirect3DSurface9_LockRect
(
pDestSurface
,
&
lockrect
,
pDestR
ect
,
0
)))
if
(
FAILED
(
hr
=
IDirect3DSurface9_LockRect
(
dst_surface
,
&
lockrect
,
dst_r
ect
,
0
)))
return
D3DXERR_INVALIDDATA
;
if
((
dwF
ilter
&
0xf
)
==
D3DX_FILTER_NONE
)
if
((
f
ilter
&
0xf
)
==
D3DX_FILTER_NONE
)
{
copy_simple_data
(
pSrcMemory
,
SrcPitch
,
src_size
,
srcformatdesc
,
lockrect
.
pBits
,
lockrect
.
Pitch
,
dst_size
,
destformatdesc
,
Colorkey
);
copy_simple_data
(
src_memory
,
src_pitch
,
src_size
,
srcformatdesc
,
lockrect
.
pBits
,
lockrect
.
Pitch
,
dst_size
,
destformatdesc
,
color_key
);
}
else
/* if ((
dwF
ilter & 0xf) == D3DX_FILTER_POINT) */
else
/* if ((
f
ilter & 0xf) == D3DX_FILTER_POINT) */
{
if
((
dwF
ilter
&
0xf
)
!=
D3DX_FILTER_POINT
)
FIXME
(
"Unhandled filter %#x.
\n
"
,
dwF
ilter
);
if
((
f
ilter
&
0xf
)
!=
D3DX_FILTER_POINT
)
FIXME
(
"Unhandled filter %#x.
\n
"
,
f
ilter
);
/* Always apply a point filter until D3DX_FILTER_LINEAR,
* D3DX_FILTER_TRIANGLE and D3DX_FILTER_BOX are implemented. */
point_filter_simple_data
(
pSrcMemory
,
SrcPitch
,
src_size
,
srcformatdesc
,
lockrect
.
pBits
,
lockrect
.
Pitch
,
dst_size
,
destformatdesc
,
Colorkey
);
point_filter_simple_data
(
src_memory
,
src_pitch
,
src_size
,
srcformatdesc
,
lockrect
.
pBits
,
lockrect
.
Pitch
,
dst_size
,
destformatdesc
,
color_key
);
}
IDirect3DSurface9_UnlockRect
(
pDestS
urface
);
IDirect3DSurface9_UnlockRect
(
dst_s
urface
);
}
return
D3D_OK
;
...
...
include/d3dx9tex.h
View file @
b8f6c9cd
...
...
@@ -163,16 +163,10 @@ HRESULT WINAPI D3DXLoadSurfaceFromSurface( LPDIRECT3DSURFACE9 destsurface,
DWORD
filter
,
D3DCOLOR
colorkey
);
HRESULT
WINAPI
D3DXLoadSurfaceFromMemory
(
LPDIRECT3DSURFACE9
destsurface
,
CONST
PALETTEENTRY
*
destpalette
,
CONST
RECT
*
destrect
,
LPCVOID
srcmemory
,
D3DFORMAT
srcformat
,
UINT
srcpitch
,
CONST
PALETTEENTRY
*
srcpalette
,
CONST
RECT
*
srcrect
,
DWORD
filter
,
D3DCOLOR
colorkey
);
HRESULT
WINAPI
D3DXLoadSurfaceFromMemory
(
IDirect3DSurface9
*
dst_surface
,
const
PALETTEENTRY
*
dst_palette
,
const
RECT
*
dst_rect
,
const
void
*
src_memory
,
D3DFORMAT
src_format
,
UINT
src_pitch
,
const
PALETTEENTRY
*
src_palette
,
const
RECT
*
src_rect
,
DWORD
filter
,
D3DCOLOR
color_key
);
HRESULT
WINAPI
D3DXSaveSurfaceToFileA
(
LPCSTR
destfile
,
D3DXIMAGE_FILEFORMAT
destformat
,
...
...
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