wined3d: Add support for partial updates of compressed surfaces to IWineD3DDeviceImpl_UpdateSurface().
This commit is contained in:
parent
941c7da08e
commit
eb064db083
|
@ -5262,12 +5262,34 @@ 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;
|
||||
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)
|
||||
{
|
||||
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;
|
||||
|
||||
/* hopefully using pointer addition will be quicker than using a point + j * rowoffset */
|
||||
const unsigned char* data =((const unsigned char *)IWineD3DSurface_GetData(pSourceSurface)) + offset;
|
||||
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)
|
||||
{
|
||||
|
@ -5275,8 +5297,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
|
|||
srcWidth, 1, dst_format_desc->glFormat, dst_format_desc->glType,data);
|
||||
data += rowoffset;
|
||||
}
|
||||
|
||||
} else { /* Full width, so just write out the whole texture */
|
||||
}
|
||||
}
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue