You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-04-13 14:42:51 -07:00
d3dx9_36-DDS: Remove patch.
This was implemented upstream by e12a1d283a0d4a14c2394a05052b06f0de16f1a6.
This commit is contained in:
@@ -1,118 +0,0 @@
|
||||
From 71d1c176af87bdc48326d5883fbea608314ee0a4 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Costa <titan.costa@gmail.com>
|
||||
Date: Sun, 11 Jan 2015 16:29:30 +0100
|
||||
Subject: [PATCH] d3dx9_36: Improve D3DXSaveTextureToFile to save simple
|
||||
texture to dds file.
|
||||
|
||||
---
|
||||
dlls/d3dx9_36/d3dx9_private.h | 2 ++
|
||||
dlls/d3dx9_36/surface.c | 63 +++++++++++++++++++++++++++++++++++
|
||||
dlls/d3dx9_36/texture.c | 5 +--
|
||||
3 files changed, 66 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3dx9_36/d3dx9_private.h b/dlls/d3dx9_36/d3dx9_private.h
|
||||
index 6a9b3e12b7b..0c6374f35ca 100644
|
||||
--- a/dlls/d3dx9_36/d3dx9_private.h
|
||||
+++ b/dlls/d3dx9_36/d3dx9_private.h
|
||||
@@ -316,6 +316,8 @@ HRESULT lock_surface(IDirect3DSurface9 *surface, const RECT *surface_rect, D3DLO
|
||||
IDirect3DSurface9 **temp_surface, BOOL write);
|
||||
HRESULT unlock_surface(IDirect3DSurface9 *surface, const RECT *surface_rect,
|
||||
IDirect3DSurface9 *temp_surface, BOOL update);
|
||||
+HRESULT save_dds_texture_to_memory(ID3DXBuffer **dst_buffer, IDirect3DBaseTexture9 *src_texture,
|
||||
+ const PALETTEENTRY *src_palette);
|
||||
HRESULT d3dx_pixels_init(const void *data, uint32_t row_pitch, uint32_t slice_pitch,
|
||||
const PALETTEENTRY *palette, enum d3dx_pixel_format_id format, uint32_t left, uint32_t top, uint32_t right,
|
||||
uint32_t bottom, uint32_t front, uint32_t back, struct d3dx_pixels *pixels);
|
||||
diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c
|
||||
index 9d2dc96a979..912a3e3c849 100644
|
||||
--- a/dlls/d3dx9_36/surface.c
|
||||
+++ b/dlls/d3dx9_36/surface.c
|
||||
@@ -628,6 +628,69 @@ 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, NULL);
|
||||
+ IDirect3DSurface9_Release(surface);
|
||||
+ }
|
||||
+
|
||||
+ return hr;
|
||||
+}
|
||||
+
|
||||
static const uint8_t bmp_file_signature[] = { 'B', 'M' };
|
||||
static const uint8_t jpg_file_signature[] = { 0xff, 0xd8 };
|
||||
static const uint8_t png_file_signature[] = { 0x89, 'P', 'N', 'G', 0x0d, 0x0a, 0x1a, 0x0a };
|
||||
diff --git a/dlls/d3dx9_36/texture.c b/dlls/d3dx9_36/texture.c
|
||||
index 719a2787445..3f76ec209f9 100644
|
||||
--- a/dlls/d3dx9_36/texture.c
|
||||
+++ b/dlls/d3dx9_36/texture.c
|
||||
@@ -1866,10 +1866,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)
|
||||
--
|
||||
2.47.2
|
||||
|
@@ -1,2 +0,0 @@
|
||||
Fixes: [26898] Support for DDS file format in D3DXSaveTextureToFileInMemory
|
||||
Disabled: True
|
Reference in New Issue
Block a user