wined3d: Pass correctly offset pointers to surface_cpu_blt_compressed().

This was debugged by Alexey Loukianov.
This commit is contained in:
Henri Verbeet 2012-03-11 22:03:08 +01:00 committed by Alexandre Julliard
parent b39425f3cf
commit 29468906bb
1 changed files with 13 additions and 8 deletions

View File

@ -6620,6 +6620,7 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
const struct wined3d_format *src_format, *dst_format;
struct wined3d_surface *orig_src = src_surface;
struct wined3d_mapped_rect dst_map, src_map;
const BYTE *sbase = NULL;
HRESULT hr = WINED3D_OK;
const BYTE *sbuf;
RECT xdst,xsrc;
@ -6745,6 +6746,17 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
dstwidth = xdst.right - xdst.left;
width = (xdst.right - xdst.left) * bpp;
if (src_surface)
sbase = (BYTE *)src_map.data
+ ((xsrc.top / src_format->block_height) * src_map.row_pitch)
+ ((xsrc.left / src_format->block_width) * src_format->block_byte_count);
if (dst_rect && src_surface != dst_surface)
dbuf = dst_map.data;
else
dbuf = (BYTE *)dst_map.data
+ ((xdst.top / dst_format->block_height) * dst_map.row_pitch)
+ ((xdst.left / dst_format->block_width) * dst_format->block_byte_count);
if (src_format->flags & dst_format->flags & WINED3DFMT_FLAG_BLOCKS)
{
TRACE("%s -> %s copy.\n", debug_d3dformat(src_format->id), debug_d3dformat(dst_format->id));
@ -6770,17 +6782,12 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
goto release;
}
hr = surface_cpu_blt_compressed(src_map.data, dst_map.data,
hr = surface_cpu_blt_compressed(sbase, dbuf,
src_map.row_pitch, dst_map.row_pitch, dstwidth, dstheight,
src_format, flags, fx);
goto release;
}
if (dst_rect && src_surface != dst_surface)
dbuf = dst_map.data;
else
dbuf = (BYTE *)dst_map.data + (xdst.top * dst_map.row_pitch) + (xdst.left * bpp);
/* First, all the 'source-less' blits */
if (flags & WINEDDBLT_COLORFILL)
{
@ -6820,7 +6827,6 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
/* Now the 'with source' blits. */
if (src_surface)
{
const BYTE *sbase;
int sx, xinc, sy, yinc;
if (!dstwidth || !dstheight) /* Hmm... stupid program? */
@ -6833,7 +6839,6 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
FIXME("Filter %s not supported in software blit.\n", debug_d3dtexturefiltertype(filter));
}
sbase = (BYTE *)src_map.data + (xsrc.top * src_map.row_pitch) + xsrc.left * bpp;
xinc = (srcwidth << 16) / dstwidth;
yinc = (srcheight << 16) / dstheight;