Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
307f78f0
Commit
307f78f0
authored
Jan 11, 2015
by
Christian Costa
Committed by
Vitaly Lipatov
Jul 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9_36: Improve D3DXSaveTextureToFile to save simple texture to dds file.
parent
a6c1d0cb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
4 deletions
+65
-4
d3dx9_private.h
dlls/d3dx9_36/d3dx9_private.h
+2
-0
surface.c
dlls/d3dx9_36/surface.c
+62
-0
texture.c
dlls/d3dx9_36/texture.c
+1
-4
No files found.
dlls/d3dx9_36/d3dx9_private.h
View file @
307f78f0
...
...
@@ -127,6 +127,8 @@ HRESULT lock_surface(IDirect3DSurface9 *surface, const RECT *surface_rect, D3DLO
IDirect3DSurface9
**
temp_surface
,
BOOL
write
)
DECLSPEC_HIDDEN
;
HRESULT
unlock_surface
(
IDirect3DSurface9
*
surface
,
const
RECT
*
surface_rect
,
IDirect3DSurface9
*
temp_surface
,
BOOL
update
)
DECLSPEC_HIDDEN
;
HRESULT
save_dds_texture_to_memory
(
ID3DXBuffer
**
dst_buffer
,
IDirect3DBaseTexture9
*
src_texture
,
const
PALETTEENTRY
*
src_palette
)
DECLSPEC_HIDDEN
;
unsigned
short
float_32_to_16
(
const
float
in
)
DECLSPEC_HIDDEN
;
float
float_16_to_32
(
const
unsigned
short
in
)
DECLSPEC_HIDDEN
;
...
...
dlls/d3dx9_36/surface.c
View file @
307f78f0
...
...
@@ -650,6 +650,68 @@ static HRESULT save_dds_surface_to_memory(ID3DXBuffer **dst_buffer, IDirect3DSur
return
D3D_OK
;
}
static
HRESULT
get_surface
(
D3DRESOURCETYPE
type
,
struct
IDirect3DBaseTexture9
*
tex
,
int
face
,
UINT
level
,
struct
IDirect3DSurface9
**
surf
)
{
switch
(
type
)
{
case
D3DRTYPE_TEXTURE
:
return
IDirect3DTexture9_GetSurfaceLevel
((
IDirect3DTexture9
*
)
tex
,
level
,
surf
);
case
D3DRTYPE_CUBETEXTURE
:
return
IDirect3DCubeTexture9_GetCubeMapSurface
((
IDirect3DCubeTexture9
*
)
tex
,
face
,
level
,
surf
);
default:
ERR
(
"Unexpected texture type
\n
"
);
return
E_NOTIMPL
;
}
}
HRESULT
save_dds_texture_to_memory
(
ID3DXBuffer
**
dst_buffer
,
IDirect3DBaseTexture9
*
src_texture
,
const
PALETTEENTRY
*
src_palette
)
{
HRESULT
hr
;
D3DRESOURCETYPE
type
;
UINT
mip_levels
;
IDirect3DSurface9
*
surface
;
type
=
IDirect3DBaseTexture9_GetType
(
src_texture
);
if
((
type
!=
D3DRTYPE_TEXTURE
)
&&
(
type
!=
D3DRTYPE_CUBETEXTURE
)
&&
(
type
!=
D3DRTYPE_VOLUMETEXTURE
))
return
D3DERR_INVALIDCALL
;
if
(
type
==
D3DRTYPE_CUBETEXTURE
)
{
FIXME
(
"Cube texture not supported yet
\n
"
);
return
E_NOTIMPL
;
}
else
if
(
type
==
D3DRTYPE_VOLUMETEXTURE
)
{
FIXME
(
"Volume texture not supported yet
\n
"
);
return
E_NOTIMPL
;
}
mip_levels
=
IDirect3DTexture9_GetLevelCount
(
src_texture
);
if
(
mip_levels
>
1
)
{
FIXME
(
"Mipmap not supported yet
\n
"
);
return
E_NOTIMPL
;
}
if
(
src_palette
)
{
FIXME
(
"Saving surfaces with palettized pixel formats not implemented yet
\n
"
);
return
E_NOTIMPL
;
}
hr
=
get_surface
(
type
,
src_texture
,
D3DCUBEMAP_FACE_POSITIVE_X
,
0
,
&
surface
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
save_dds_surface_to_memory
(
dst_buffer
,
surface
,
NULL
);
IDirect3DSurface9_Release
(
surface
);
}
return
hr
;
}
HRESULT
load_volume_from_dds
(
IDirect3DVolume9
*
dst_volume
,
const
PALETTEENTRY
*
dst_palette
,
const
D3DBOX
*
dst_box
,
const
void
*
src_data
,
const
D3DBOX
*
src_box
,
DWORD
filter
,
D3DCOLOR
color_key
,
const
D3DXIMAGE_INFO
*
src_info
)
...
...
dlls/d3dx9_36/texture.c
View file @
307f78f0
...
...
@@ -1870,10 +1870,7 @@ HRESULT WINAPI D3DXSaveTextureToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE
if
(
!
dst_buffer
||
!
src_texture
)
return
D3DERR_INVALIDCALL
;
if
(
file_format
==
D3DXIFF_DDS
)
{
FIXME
(
"DDS file format isn't supported yet
\n
"
);
return
E_NOTIMPL
;
}
return
save_dds_texture_to_memory
(
dst_buffer
,
src_texture
,
src_palette
);
type
=
IDirect3DBaseTexture9_GetType
(
src_texture
);
switch
(
type
)
...
...
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