[PATCH 3/5] wined3d: Don't abuse conv_byte_count for color-key conversions.
Henri Verbeet
hverbeet at codeweavers.com
Mon Oct 6 01:24:19 CDT 2014
---
dlls/wined3d/surface.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 41dc2ac..9d41fef 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1653,7 +1653,7 @@ static void d3dfmt_get_conv(const struct wined3d_texture *texture, BOOL need_alp
format->rtInternal = dst_format->rtInternal;
format->glFormat = dst_format->glFormat;
format->glType = dst_format->glType;
- format->conv_byte_count = dst_format->byte_count;
+ format->byte_count = dst_format->byte_count;
}
}
@@ -4611,8 +4611,8 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
/* This code is entered for texture formats which need a fixup. */
UINT height = surface->resource.height;
- /* Stick to the alignment for the converted surface too, makes it easier to load the surface */
- dst_pitch = width * format.conv_byte_count;
+ format.byte_count = format.conv_byte_count;
+ dst_pitch = wined3d_format_calculate_pitch(&format, width);
dst_pitch = (dst_pitch + device->surface_alignment - 1) & ~(device->surface_alignment - 1);
if (!(mem = HeapAlloc(GetProcessHeap(), 0, dst_pitch * height)))
@@ -4623,7 +4623,6 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
}
format.convert(data.addr, mem, src_pitch, src_pitch * height,
dst_pitch, dst_pitch * height, width, height, 1);
- format.byte_count = format.conv_byte_count;
src_pitch = dst_pitch;
data.addr = mem;
}
@@ -4632,8 +4631,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
/* This code is only entered for color keying fixups */
UINT height = surface->resource.height;
- /* Stick to the alignment for the converted surface too, makes it easier to load the surface */
- dst_pitch = width * format.conv_byte_count;
+ dst_pitch = wined3d_format_calculate_pitch(&format, width);
dst_pitch = (dst_pitch + device->surface_alignment - 1) & ~(device->surface_alignment - 1);
if (!(mem = HeapAlloc(GetProcessHeap(), 0, dst_pitch * height)))
@@ -4644,7 +4642,6 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
}
d3dfmt_convert_surface(data.addr, mem, src_pitch,
width, height, dst_pitch, convert, surface);
- format.byte_count = format.conv_byte_count;
src_pitch = dst_pitch;
data.addr = mem;
}
--
1.7.10.4
More information about the wine-patches
mailing list