[PATCH 7/8] wined3d: Round up to complete compressed blocks in IWineD3DDeviceImpl_UpdateSurface().

Henri Verbeet hverbeet at codeweavers.com
Sun Aug 15 16:21:48 CDT 2010


This is mostly an issue for surfaces with dimensions smaller than their
format's block width/height.
---
 dlls/wined3d/device.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 81e63ff..b9948ab 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5304,9 +5304,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
 
     if (dst_format->Flags & WINED3DFMT_FLAG_COMPRESSED)
     {
-        UINT row_length = (update_w / src_format->block_width) * src_format->block_byte_count;
-        UINT row_count = update_h / src_format->block_height;
-        UINT src_pitch = IWineD3DSurface_GetPitch(src_surface);
+        UINT row_length = wined3d_format_calculate_size(src_format, 1, update_w, 1);
+        UINT row_count = (update_h + src_format->block_height - 1) / src_format->block_height;
+        UINT src_pitch = wined3d_format_calculate_size(src_format, 1, src_w, 1);
 
         if (src_rect)
         {
-- 
1.7.1




More information about the wine-patches mailing list