d3dx9: Remove PixelFormatDesc typedef.
This commit is contained in:
parent
1a9413b98a
commit
8da8811615
|
@ -50,7 +50,7 @@ typedef enum _FormatType {
|
|||
FORMAT_UNKNOWN
|
||||
} FormatType;
|
||||
|
||||
typedef struct _PixelFormatDesc {
|
||||
struct pixel_format_desc {
|
||||
D3DFORMAT format;
|
||||
BYTE bits[4];
|
||||
BYTE shift[4];
|
||||
|
@ -61,21 +61,21 @@ typedef struct _PixelFormatDesc {
|
|||
FormatType type;
|
||||
void (*from_rgba)(const struct vec4 *src, struct vec4 *dst);
|
||||
void (*to_rgba)(const struct vec4 *src, struct vec4 *dst);
|
||||
} PixelFormatDesc;
|
||||
};
|
||||
|
||||
HRESULT map_view_of_file(LPCWSTR filename, LPVOID *buffer, DWORD *length) DECLSPEC_HIDDEN;
|
||||
HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, LPVOID *buffer, DWORD *length) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT write_buffer_to_file(const WCHAR *filename, ID3DXBuffer *buffer) DECLSPEC_HIDDEN;
|
||||
|
||||
const PixelFormatDesc *get_format_info(D3DFORMAT format) DECLSPEC_HIDDEN;
|
||||
const PixelFormatDesc *get_format_info_idx(int idx) DECLSPEC_HIDDEN;
|
||||
const struct pixel_format_desc *get_format_info(D3DFORMAT format) DECLSPEC_HIDDEN;
|
||||
const struct pixel_format_desc *get_format_info_idx(int idx) DECLSPEC_HIDDEN;
|
||||
|
||||
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,
|
||||
void copy_simple_data(const BYTE *src, UINT src_row_pitch, UINT src_slice_pitch, struct volume *src_size, const struct pixel_format_desc *src_format,
|
||||
BYTE *dst, UINT dst_row_pitch, UINT dst_slice_pitch, struct volume *dst_size, const struct pixel_format_desc *dst_format,
|
||||
D3DCOLOR color_key) DECLSPEC_HIDDEN;
|
||||
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,
|
||||
void point_filter_simple_data(const BYTE *src, UINT src_row_pitch, UINT src_slice_pitch, struct volume *src_size, const struct pixel_format_desc *src_format,
|
||||
BYTE *dst, UINT dst_row_pitch, UINT dst_slice_pitch, struct volume *dst_size, const struct pixel_format_desc *dst_format,
|
||||
D3DCOLOR color_key) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT load_texture_from_dds(IDirect3DTexture9 *texture, const void *src_data, const PALETTEENTRY *palette,
|
||||
|
|
|
@ -278,7 +278,7 @@ static D3DFORMAT dds_pixel_format_to_d3dformat(const struct dds_pixel_format *pi
|
|||
static HRESULT calculate_dds_surface_size(const D3DXIMAGE_INFO *img_info,
|
||||
UINT width, UINT height, UINT *pitch, UINT *size)
|
||||
{
|
||||
const PixelFormatDesc *format_desc = get_format_info(img_info->Format);
|
||||
const struct pixel_format_desc *format_desc = get_format_info(img_info->Format);
|
||||
if (format_desc->format == D3DFMT_UNKNOWN)
|
||||
return E_NOTIMPL;
|
||||
|
||||
|
@ -854,7 +854,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromFileInMemory(IDirect3DSurface9 *pDestSurface,
|
|||
IWICBitmapFrameDecode *bitmapframe;
|
||||
IWICStream *stream;
|
||||
|
||||
const PixelFormatDesc *formatdesc;
|
||||
const struct pixel_format_desc *formatdesc;
|
||||
WICRect wicrect;
|
||||
RECT rect;
|
||||
|
||||
|
@ -1097,15 +1097,15 @@ HRESULT WINAPI D3DXLoadSurfaceFromResourceW(IDirect3DSurface9 *dst_surface,
|
|||
*/
|
||||
struct argb_conversion_info
|
||||
{
|
||||
CONST PixelFormatDesc *srcformat;
|
||||
CONST PixelFormatDesc *destformat;
|
||||
const struct pixel_format_desc *srcformat;
|
||||
const struct pixel_format_desc *destformat;
|
||||
DWORD srcshift[4], destshift[4];
|
||||
DWORD srcmask[4], destmask[4];
|
||||
BOOL process_channel[4];
|
||||
DWORD channelmask;
|
||||
};
|
||||
|
||||
static void init_argb_conversion_info(CONST PixelFormatDesc *srcformat, CONST PixelFormatDesc *destformat, struct argb_conversion_info *info)
|
||||
static void init_argb_conversion_info(const struct pixel_format_desc *srcformat, const struct pixel_format_desc *destformat, struct argb_conversion_info *info)
|
||||
{
|
||||
UINT i;
|
||||
ZeroMemory(info->process_channel, 4 * sizeof(BOOL));
|
||||
|
@ -1196,7 +1196,7 @@ static DWORD make_argb_color(CONST struct argb_conversion_info *info, CONST DWOR
|
|||
return val;
|
||||
}
|
||||
|
||||
static void format_to_vec4(const PixelFormatDesc *format, const DWORD *src, struct vec4 *dst)
|
||||
static void format_to_vec4(const struct pixel_format_desc *format, const DWORD *src, struct vec4 *dst)
|
||||
{
|
||||
DWORD mask;
|
||||
|
||||
|
@ -1233,7 +1233,7 @@ static void format_to_vec4(const PixelFormatDesc *format, const DWORD *src, stru
|
|||
dst->w = 1.0f;
|
||||
}
|
||||
|
||||
static void format_from_vec4(const PixelFormatDesc *format, const struct vec4 *src, DWORD *dst)
|
||||
static void format_from_vec4(const struct pixel_format_desc *format, const struct vec4 *src, DWORD *dst)
|
||||
{
|
||||
*dst = 0;
|
||||
|
||||
|
@ -1255,11 +1255,12 @@ static void format_from_vec4(const PixelFormatDesc *format, const struct vec4 *s
|
|||
* Pixels outsize the source rect are blacked out.
|
||||
* Works only for ARGB formats with 1 - 4 bytes per pixel.
|
||||
*/
|
||||
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)
|
||||
void copy_simple_data(const BYTE *src, UINT src_row_pitch, UINT src_slice_pitch, struct volume *src_size,
|
||||
const struct pixel_format_desc *src_format, BYTE *dst, UINT dst_row_pitch, UINT dst_slice_pitch,
|
||||
struct volume *dst_size, const struct pixel_format_desc *dst_format, D3DCOLOR color_key)
|
||||
{
|
||||
struct argb_conversion_info conv_info, ck_conv_info;
|
||||
const PixelFormatDesc *ck_format = NULL;
|
||||
const struct pixel_format_desc *ck_format = NULL;
|
||||
DWORD channels[4], pixel;
|
||||
UINT min_width, min_height, min_depth;
|
||||
UINT x, y, z;
|
||||
|
@ -1353,11 +1354,12 @@ void copy_simple_data(const BYTE *src, UINT src_row_pitch, UINT src_slice_pitch,
|
|||
* using a point filter.
|
||||
* Works only for ARGB formats with 1 - 4 bytes per pixel.
|
||||
*/
|
||||
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)
|
||||
void point_filter_simple_data(const BYTE *src, UINT src_row_pitch, UINT src_slice_pitch, struct volume *src_size,
|
||||
const struct pixel_format_desc *src_format, BYTE *dst, UINT dst_row_pitch, UINT dst_slice_pitch,
|
||||
struct volume *dst_size, const struct pixel_format_desc *dst_format, D3DCOLOR color_key)
|
||||
{
|
||||
struct argb_conversion_info conv_info, ck_conv_info;
|
||||
const PixelFormatDesc *ck_format = NULL;
|
||||
const struct pixel_format_desc *ck_format = NULL;
|
||||
DWORD channels[4], pixel;
|
||||
UINT x, y, z;
|
||||
|
||||
|
@ -1471,7 +1473,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
|
|||
D3DFORMAT src_format, UINT src_pitch, const PALETTEENTRY *src_palette, const RECT *src_rect,
|
||||
DWORD filter, D3DCOLOR color_key)
|
||||
{
|
||||
CONST PixelFormatDesc *srcformatdesc, *destformatdesc;
|
||||
const struct pixel_format_desc *srcformatdesc, *destformatdesc;
|
||||
D3DSURFACE_DESC surfdesc;
|
||||
D3DLOCKED_RECT lockrect;
|
||||
struct volume src_size, dst_size;
|
||||
|
@ -1839,7 +1841,7 @@ HRESULT WINAPI D3DXSaveSurfaceToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE
|
|||
}
|
||||
else /* Pixel format conversion */
|
||||
{
|
||||
const PixelFormatDesc *src_format_desc, *dst_format_desc;
|
||||
const struct pixel_format_desc *src_format_desc, *dst_format_desc;
|
||||
struct volume size;
|
||||
DWORD dst_pitch;
|
||||
void *dst_data;
|
||||
|
|
|
@ -314,11 +314,11 @@ HRESULT WINAPI D3DXCheckTextureRequirements(LPDIRECT3DDEVICE9 device,
|
|||
if (FAILED(hr))
|
||||
{
|
||||
/* Heuristic to choose the fallback format */
|
||||
const PixelFormatDesc *fmt = get_format_info(usedformat);
|
||||
const struct pixel_format_desc *fmt = get_format_info(usedformat);
|
||||
BOOL allow_24bits;
|
||||
int bestscore = INT_MIN, i = 0, j;
|
||||
unsigned int channels;
|
||||
const PixelFormatDesc *curfmt;
|
||||
const struct pixel_format_desc *curfmt;
|
||||
|
||||
if (!fmt)
|
||||
{
|
||||
|
@ -1328,7 +1328,7 @@ HRESULT WINAPI D3DXFillTexture(LPDIRECT3DTEXTURE9 texture,
|
|||
D3DLOCKED_RECT lock_rect;
|
||||
D3DXVECTOR4 value;
|
||||
D3DXVECTOR2 coord, size;
|
||||
const PixelFormatDesc *format;
|
||||
const struct pixel_format_desc *format;
|
||||
BYTE *data, *pos;
|
||||
BYTE byte, mask;
|
||||
float comp_value;
|
||||
|
@ -1721,7 +1721,7 @@ HRESULT WINAPI D3DXFillCubeTexture(LPDIRECT3DCUBETEXTURE9 texture,
|
|||
D3DLOCKED_RECT lock_rect;
|
||||
D3DXVECTOR4 value;
|
||||
D3DXVECTOR3 coord, size;
|
||||
const PixelFormatDesc *format;
|
||||
const struct pixel_format_desc *format;
|
||||
BYTE *data, *pos;
|
||||
BYTE byte, mask;
|
||||
float comp_value;
|
||||
|
@ -1824,7 +1824,7 @@ HRESULT WINAPI D3DXFillVolumeTexture(LPDIRECT3DVOLUMETEXTURE9 texture,
|
|||
D3DLOCKED_BOX lock_box;
|
||||
D3DXVECTOR4 value;
|
||||
D3DXVECTOR3 coord, size;
|
||||
const PixelFormatDesc *format;
|
||||
const struct pixel_format_desc *format;
|
||||
BYTE *data, *pos;
|
||||
BYTE byte, mask;
|
||||
float comp_value;
|
||||
|
|
|
@ -42,7 +42,7 @@ static void la_to_rgba(const struct vec4 *la, struct vec4 *rgba)
|
|||
*
|
||||
* Call get_format_info to request information about a specific format.
|
||||
*/
|
||||
static const PixelFormatDesc formats[] =
|
||||
static const struct pixel_format_desc formats[] =
|
||||
{
|
||||
/* format bpc shifts bpp blocks type from_rgba to_rgba */
|
||||
{D3DFMT_R8G8B8, {0, 8, 8, 8}, { 0, 16, 8, 0}, 3, 1, 1, 3, FORMAT_ARGB, NULL, NULL },
|
||||
|
@ -186,10 +186,9 @@ HRESULT write_buffer_to_file(const WCHAR *dst_filename, ID3DXBuffer *buffer)
|
|||
*
|
||||
* PARAMS
|
||||
* format [I] format whose description is queried
|
||||
* desc [O] pointer to a StaticPixelFormatDesc structure
|
||||
*
|
||||
*/
|
||||
const PixelFormatDesc *get_format_info(D3DFORMAT format)
|
||||
const struct pixel_format_desc *get_format_info(D3DFORMAT format)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
while(formats[i].format != format && formats[i].format != D3DFMT_UNKNOWN) i++;
|
||||
|
@ -198,7 +197,7 @@ const PixelFormatDesc *get_format_info(D3DFORMAT format)
|
|||
return &formats[i];
|
||||
}
|
||||
|
||||
const PixelFormatDesc *get_format_info_idx(int idx)
|
||||
const struct pixel_format_desc *get_format_info_idx(int idx)
|
||||
{
|
||||
if(idx >= sizeof(formats) / sizeof(formats[0]))
|
||||
return NULL;
|
||||
|
|
|
@ -96,7 +96,7 @@ HRESULT WINAPI D3DXLoadVolumeFromMemory(IDirect3DVolume9 *dst_volume,
|
|||
D3DVOLUME_DESC desc;
|
||||
D3DLOCKED_BOX locked_box;
|
||||
struct volume dst_size, src_size;
|
||||
const PixelFormatDesc *src_format_desc, *dst_format_desc;
|
||||
const struct pixel_format_desc *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,
|
||||
src_memory, src_format, src_row_pitch, src_slice_pitch, src_palette, src_box,
|
||||
|
|
Loading…
Reference in New Issue