d3dx9: Use 4 spaces per indent level in get_image_info_from_dds().

This commit is contained in:
Józef Kucia 2012-09-24 13:46:37 +02:00 committed by Alexandre Julliard
parent 00ea54f64f
commit 8f00a63161
1 changed files with 43 additions and 43 deletions

View File

@ -337,58 +337,58 @@ static UINT calculate_dds_file_size(D3DFORMAT format, UINT width, UINT height, U
*/ */
static HRESULT get_image_info_from_dds(const void *buffer, UINT length, D3DXIMAGE_INFO *info) static HRESULT get_image_info_from_dds(const void *buffer, UINT length, D3DXIMAGE_INFO *info)
{ {
UINT faces = 1; UINT faces = 1;
UINT expected_length; UINT expected_length;
const struct dds_header *header = buffer; const struct dds_header *header = buffer;
if (length < sizeof(*header) || !info) if (length < sizeof(*header) || !info)
return D3DXERR_INVALIDDATA; return D3DXERR_INVALIDDATA;
if (header->pixel_format.size != sizeof(header->pixel_format)) if (header->pixel_format.size != sizeof(header->pixel_format))
return D3DXERR_INVALIDDATA; return D3DXERR_INVALIDDATA;
info->Width = header->width; info->Width = header->width;
info->Height = header->height; info->Height = header->height;
info->Depth = 1; info->Depth = 1;
info->MipLevels = (header->flags & DDS_MIPMAPCOUNT) ? header->miplevels : 1; info->MipLevels = (header->flags & DDS_MIPMAPCOUNT) ? header->miplevels : 1;
info->Format = dds_pixel_format_to_d3dformat(&header->pixel_format); info->Format = dds_pixel_format_to_d3dformat(&header->pixel_format);
if (info->Format == D3DFMT_UNKNOWN) if (info->Format == D3DFMT_UNKNOWN)
return D3DXERR_INVALIDDATA; return D3DXERR_INVALIDDATA;
TRACE("Pixel format is %#x\n", info->Format); TRACE("Pixel format is %#x\n", info->Format);
if (header->caps2 & DDS_CAPS2_VOLUME) if (header->caps2 & DDS_CAPS2_VOLUME)
{ {
info->Depth = header->depth; info->Depth = header->depth;
info->ResourceType = D3DRTYPE_VOLUMETEXTURE; info->ResourceType = D3DRTYPE_VOLUMETEXTURE;
} }
else if (header->caps2 & DDS_CAPS2_CUBEMAP) else if (header->caps2 & DDS_CAPS2_CUBEMAP)
{ {
DWORD face; DWORD face;
faces = 0; faces = 0;
for (face = DDS_CAPS2_CUBEMAP_POSITIVEX; face <= DDS_CAPS2_CUBEMAP_NEGATIVEZ; face <<= 1) for (face = DDS_CAPS2_CUBEMAP_POSITIVEX; face <= DDS_CAPS2_CUBEMAP_NEGATIVEZ; face <<= 1)
{ {
if (header->caps2 & face) if (header->caps2 & face)
faces++; faces++;
} }
info->ResourceType = D3DRTYPE_CUBETEXTURE; info->ResourceType = D3DRTYPE_CUBETEXTURE;
} }
else else
{ {
info->ResourceType = D3DRTYPE_TEXTURE; info->ResourceType = D3DRTYPE_TEXTURE;
} }
expected_length = calculate_dds_file_size(info->Format, info->Width, info->Height, info->Depth, expected_length = calculate_dds_file_size(info->Format, info->Width, info->Height, info->Depth,
info->MipLevels, faces); info->MipLevels, faces);
if (length < expected_length) if (length < expected_length)
{ {
WARN("File is too short %u, expected at least %u bytes\n", length, expected_length); WARN("File is too short %u, expected at least %u bytes\n", length, expected_length);
return D3DXERR_INVALIDDATA; return D3DXERR_INVALIDDATA;
} }
info->ImageFileFormat = D3DXIFF_DDS; info->ImageFileFormat = D3DXIFF_DDS;
return D3D_OK; return D3D_OK;
} }
static HRESULT load_surface_from_dds(IDirect3DSurface9 *dst_surface, const PALETTEENTRY *dst_palette, static HRESULT load_surface_from_dds(IDirect3DSurface9 *dst_surface, const PALETTEENTRY *dst_palette,