[1/5] d3dx9: Implement D3DXLoadVolumeFromMemory.
Matteo Bruni
matteo.mystral at gmail.com
Thu Jun 28 07:27:21 CDT 2012
2012/6/27 Józef Kucia <joseph.kucia at gmail.com>:
> ---
Hi Józef,
> +void copy_simple_data(const BYTE *src, UINT srcpitch, SIZE src_size, const PixelFormatDesc *srcformat,
> + BYTE *dest, UINT destpitch, SIZE dst_size, const PixelFormatDesc *destformat, D3DCOLOR colorkey) DECLSPEC_HIDDEN;
> +
You are not actually using this function in the patch.
> + if (dst_box->Left > dst_box->Right || dst_box->Right > desc.Width)
> + return D3DERR_INVALIDCALL;
> + if (dst_box->Top > dst_box->Bottom || dst_box->Bottom > desc.Height)
> + return D3DERR_INVALIDCALL;
> + if (dst_box->Front > dst_box->Back || dst_box->Back > desc.Depth)
> + return D3DERR_INVALIDCALL;
> +
> + dst_width = dst_box->Right - dst_box->Left;
> + dst_height = dst_box->Bottom - dst_box->Top;
> + dst_depth = dst_box->Back - dst_box->Front;
> + if (!dst_width || !dst_height || !dst_depth)
> + return D3DERR_INVALIDCALL;
You can avoid the last check by comparing e.g. (dst_box->Left >=
dst_box->Right) above, instead of using ">".
> + if (src_box->Left & (src_format_desc->block_width - 1)
> + || src_box->Top & (src_format_desc->block_height - 1)
> + || (src_box->Right & (src_format_desc->block_width - 1)
> + && src_width != desc.Width)
> + || (src_box->Bottom & (src_format_desc->block_height - 1)
> + && src_height != desc.Height))
> + {
> + WARN("Source box (%u, %u, %u, %u) is misaligned\n",
> + src_box->Left, src_box->Top, src_box->Right, src_box->Bottom);
> + return D3DXERR_INVALIDDATA;
> + }
I'm not quite sure of the right and bottom misalignment checks. If the
tests confirm that, of course that's okay.
> + for (slice = 0; slice < src_depth; slice++)
> + {
> + src_addr = src_memory;
> + src_addr += slice * src_slice_pitch;
Shouldn't you take into account src_box->Front?
More information about the wine-devel
mailing list