wined3d: Add support for partial updates of compressed surfaces to IWineD3DDeviceImpl_UpdateSurface().

This commit is contained in:
Henri Verbeet 2010-03-25 22:51:26 +01:00 committed by Alexandre Julliard
parent 941c7da08e
commit eb064db083

View File

@ -5262,21 +5262,45 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
ENTER_GL();
/* TODO: Cube and volume support */
if(rowoffset != 0){
/* not a whole row so we have to do it a line at a time */
int j;
/* hopefully using pointer addition will be quicker than using a point + j * rowoffset */
const unsigned char* data =((const unsigned char *)IWineD3DSurface_GetData(pSourceSurface)) + offset;
for (j = destTop; j < (srcHeight + destTop); ++j)
if (rowoffset) /* Not a whole row so we have to do it a line at a time. */
{
if (dst_format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED)
{
glTexSubImage2D(dst_impl->texture_target, dst_impl->texture_level, destLeft, j,
srcWidth, 1, dst_format_desc->glFormat, dst_format_desc->glType,data);
data += rowoffset;
}
const unsigned char *data = ((const unsigned char *)IWineD3DSurface_GetData(pSourceSurface));
UINT row_length = (srcWidth / src_format_desc->block_width) * src_format_desc->block_byte_count;
UINT row_count = srcHeight / src_format_desc->block_height;
UINT src_pitch = IWineD3DSurface_GetPitch(pSourceSurface);
UINT y = destTop;
UINT row;
} else { /* Full width, so just write out the whole texture */
data += (pSourceRect->top / src_format_desc->block_height) * src_pitch;
data += (pSourceRect->left / src_format_desc->block_width) * src_format_desc->block_byte_count;
for (row = 0; row < row_count; ++row)
{
GL_EXTCALL(glCompressedTexSubImage2DARB(dst_impl->texture_target, dst_impl->texture_level,
destLeft, y, srcWidth, src_format_desc->block_height,
dst_format_desc->glInternal, row_length, data));
y += src_format_desc->block_height;
data += src_pitch;
}
checkGLcall("glCompressedTexSubImage2DARB");
}
else
{
const unsigned char *data = ((const unsigned char *)IWineD3DSurface_GetData(pSourceSurface)) + offset;
unsigned int j;
for (j = destTop; j < (srcHeight + destTop); ++j)
{
glTexSubImage2D(dst_impl->texture_target, dst_impl->texture_level, destLeft, j,
srcWidth, 1, dst_format_desc->glFormat, dst_format_desc->glType,data);
data += rowoffset;
}
}
}
else /* Full width, so just write out the whole texture. */
{
const unsigned char* data = ((const unsigned char *)IWineD3DSurface_GetData(pSourceSurface)) + offset;
if (dst_format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED)