Module: wine Branch: master Commit: 6e5fa922994e87d5501aca6b9eb420ab73f071a1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=6e5fa922994e87d5501aca6b9e...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Fri Feb 12 11:06:07 2016 +0100
ddraw: Use wined3d_texture_get_pitch() in ddraw_surface_init().
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ddraw/ddraw.c | 2 +- dlls/ddraw/ddraw_private.h | 2 +- dlls/ddraw/surface.c | 14 ++++++-------- dlls/wined3d/surface.c | 13 ------------- dlls/wined3d/texture.c | 2 +- dlls/wined3d/wined3d.spec | 3 +-- dlls/wined3d/wined3d_private.h | 2 -- include/wine/wined3d.h | 4 ++-- 8 files changed, 12 insertions(+), 30 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 5ffc951..c5bb31c 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -4774,7 +4774,7 @@ static HRESULT CDECL device_parent_surface_created(struct wined3d_device_parent return DDERR_OUTOFVIDEOMEMORY; }
- ddraw_surface_init(ddraw_surface, ddraw, wined3d_texture, sub_resource_idx, surface, parent_ops); + ddraw_surface_init(ddraw_surface, ddraw, wined3d_texture, sub_resource_idx, parent_ops); *parent = ddraw_surface;
ddraw_update_lost_surfaces(ddraw); diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index e6d8f3a..2e7624b 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -213,7 +213,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ struct wined3d_rendertarget_view *ddraw_surface_get_rendertarget_view(struct ddraw_surface *surface) DECLSPEC_HIDDEN; void ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, - struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; + const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; ULONG ddraw_surface_release_iface(struct ddraw_surface *This) DECLSPEC_HIDDEN; HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface, const RECT *rect, BOOL read) DECLSPEC_HIDDEN; diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index ff2c85b..aa6a0d1 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -6253,9 +6253,10 @@ fail:
void ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, - struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops) + const struct wined3d_parent_ops **parent_ops) { struct ddraw_texture *texture = wined3d_texture_get_parent(wined3d_texture); + unsigned int texture_level, row_pitch, slice_pitch; DDSURFACEDESC2 *desc = &surface->surface_desc; unsigned int version = texture->version;
@@ -6290,24 +6291,21 @@ void ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, *desc = texture->surface_desc; surface->first_attached = surface;
+ texture_level = desc->ddsCaps.dwCaps & DDSCAPS_MIPMAP ? sub_resource_idx % desc->u2.dwMipMapCount : 0; + wined3d_texture_get_pitch(wined3d_texture, texture_level, &row_pitch, &slice_pitch); if (format_is_compressed(&desc->u4.ddpfPixelFormat)) { - unsigned int texture_level, row_pitch; - - texture_level = desc->ddsCaps.dwCaps & DDSCAPS_MIPMAP ? sub_resource_idx % desc->u2.dwMipMapCount : 0; - row_pitch = wined3d_surface_get_pitch(wined3d_surface); - if (desc->dwFlags & DDSD_LPSURFACE) desc->u1.dwLinearSize = ~0u; else - desc->u1.dwLinearSize = row_pitch * ((max(1, desc->dwHeight >> texture_level) + 3) / 4); + desc->u1.dwLinearSize = slice_pitch; desc->dwFlags |= DDSD_LINEARSIZE; desc->dwFlags &= ~(DDSD_LPSURFACE | DDSD_PITCH); } else { if (!(desc->dwFlags & DDSD_LPSURFACE)) - desc->u1.lPitch = wined3d_surface_get_pitch(wined3d_surface); + desc->u1.lPitch = row_pitch; desc->dwFlags |= DDSD_PITCH; desc->dwFlags &= ~(DDSD_LPSURFACE | DDSD_LINEARSIZE); } diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index be7b67c..7cb16ed 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1883,19 +1883,6 @@ static inline unsigned short float_32_to_16(const float *in) return ret; }
-DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface) -{ - unsigned int row_pitch, slice_pitch; - - TRACE("surface %p.\n", surface); - - wined3d_texture_get_pitch(surface->container, surface->texture_level, &row_pitch, &slice_pitch); - - TRACE("Returning %u.\n", row_pitch); - - return row_pitch; -} - HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info) { struct wined3d_resource *texture_resource = &surface->container->resource; diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 8b414a6..58ff5aa 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -499,7 +499,7 @@ void * CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture) return texture->resource.parent; }
-void wined3d_texture_get_pitch(const struct wined3d_texture *texture, +void CDECL wined3d_texture_get_pitch(const struct wined3d_texture *texture, unsigned int level, unsigned int *row_pitch, unsigned int *slice_pitch) { const struct wined3d_resource *resource = &texture->resource; diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 5933b48..bbd2fb5 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -220,8 +220,6 @@ @ cdecl wined3d_stateblock_decref(ptr) @ cdecl wined3d_stateblock_incref(ptr)
-@ cdecl wined3d_surface_get_pitch(ptr) - @ cdecl wined3d_swapchain_create(ptr ptr ptr ptr ptr) @ cdecl wined3d_swapchain_decref(ptr) @ cdecl wined3d_swapchain_get_back_buffer(ptr long) @@ -250,6 +248,7 @@ @ cdecl wined3d_texture_get_lod(ptr) @ cdecl wined3d_texture_get_overlay_position(ptr long ptr ptr) @ cdecl wined3d_texture_get_parent(ptr) +@ cdecl wined3d_texture_get_pitch(ptr long ptr ptr) @ cdecl wined3d_texture_get_resource(ptr) @ cdecl wined3d_texture_get_sub_resource(ptr long) @ cdecl wined3d_texture_incref(ptr) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 81c3af2..1b8d0f3 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2402,8 +2402,6 @@ void wined3d_texture_bind(struct wined3d_texture *texture, void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; void wined3d_texture_force_reload(struct wined3d_texture *texture) DECLSPEC_HIDDEN; -void wined3d_texture_get_pitch(const struct wined3d_texture *texture, - unsigned int level, unsigned int *row_pitch, unsigned int *slice_pitch) DECLSPEC_HIDDEN; void wined3d_texture_load(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; void wined3d_texture_prepare_texture(struct wined3d_texture *texture, diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index f314af3..fbecb0b 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2479,8 +2479,6 @@ HRESULT __cdecl wined3d_stateblock_create(struct wined3d_device *device, ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock); ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock);
-DWORD __cdecl wined3d_surface_get_pitch(const struct wined3d_surface *surface); - HRESULT __cdecl wined3d_swapchain_create(struct wined3d_device *device, struct wined3d_swapchain_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain); ULONG __cdecl wined3d_swapchain_decref(struct wined3d_swapchain *swapchain); @@ -2527,6 +2525,8 @@ DWORD __cdecl wined3d_texture_get_lod(const struct wined3d_texture *texture); HRESULT __cdecl wined3d_texture_get_overlay_position(const struct wined3d_texture *texture, unsigned int sub_resource_idx, LONG *x, LONG *y); void * __cdecl wined3d_texture_get_parent(const struct wined3d_texture *texture); +void __cdecl wined3d_texture_get_pitch(const struct wined3d_texture *texture, + unsigned int level, unsigned int *row_pitch, unsigned int *slice_pitch); struct wined3d_resource * __cdecl wined3d_texture_get_resource(struct wined3d_texture *texture); struct wined3d_resource * __cdecl wined3d_texture_get_sub_resource(const struct wined3d_texture *texture, UINT sub_resource_idx);