Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
b8f6c9cd
Commit
b8f6c9cd
authored
12 years ago
by
Henri Verbeet
Committed by
Alexandre Julliard
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
d3dx9: Cleanup parameter names for D3DXLoadSurfaceFromMemory().
parent
02cb4fe2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/d3dx9_36/surface.c
+50
-49
50 additions, 49 deletions
dlls/d3dx9_36/surface.c
include/d3dx9tex.h
+4
-10
4 additions, 10 deletions
include/d3dx9tex.h
with
54 additions
and
59 deletions
dlls/d3dx9_36/surface.c
+
50
−
49
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
=
pSrcR
ect
->
right
-
pSrcR
ect
->
left
;
src_size
.
cy
=
pSrcR
ect
->
bottom
-
pSrcR
ect
->
top
;
if
(
!
pDestR
ect
)
src_size
.
cx
=
src_r
ect
->
right
-
src_r
ect
->
left
;
src_size
.
cy
=
src_r
ect
->
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
(
S
rc
F
ormat
);
srcformatdesc
=
get_format_info
(
s
rc
_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
(
S
rc
F
ormat
==
surfdesc
.
Format
if
(
s
rc
_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
(
pDestS
urface
,
&
lockrect
,
pDestR
ect
,
0
)))
if
(
FAILED
(
hr
=
IDirect3DSurface9_LockRect
(
dst_s
urface
,
&
lockrect
,
dst_r
ect
,
0
)))
return
D3DXERR_INVALIDDATA
;
src_addr
=
pSrcM
emory
;
src_addr
+=
(
pSrcR
ect
->
top
/
srcformatdesc
->
block_height
)
*
S
rc
P
itch
;
src_addr
+=
(
pSrcR
ect
->
left
/
srcformatdesc
->
block_width
)
*
srcformatdesc
->
block_byte_count
;
src_addr
=
src_m
emory
;
src_addr
+=
(
src_r
ect
->
top
/
srcformatdesc
->
block_height
)
*
s
rc
_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
+=
S
rc
P
itch
;
src_addr
+=
s
rc
_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
(
pDestS
urface
,
&
lockrect
,
pDestR
ect
,
0
)))
if
(
FAILED
(
hr
=
IDirect3DSurface9_LockRect
(
dst_s
urface
,
&
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
;
...
...
This diff is collapsed.
Click to expand it.
include/d3dx9tex.h
+
4
−
10
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
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment