Henri Verbeet : ddraw: Use wined3d_texture_blt() in copy_mipmap_chain().

Alexandre Julliard julliard at wine.codeweavers.com
Mon Feb 1 09:24:45 CST 2016


Module: wine
Branch: master
Commit: f7e9604c3eb9082d3a1b0172ec7e3b21234fe7b7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f7e9604c3eb9082d3a1b0172ec7e3b21234fe7b7

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Jan 29 18:48:55 2016 +0100

ddraw: Use wined3d_texture_blt() in copy_mipmap_chain().

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ddraw/device.c            | 33 ++++++++++++++++++---------------
 dlls/wined3d/surface.c         |  2 +-
 dlls/wined3d/wined3d.spec      |  1 -
 dlls/wined3d/wined3d_private.h |  3 +++
 include/wine/wined3d.h         |  3 ---
 5 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index e2ed277..6c1bd49 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -5950,10 +5950,10 @@ static BOOL is_mip_level_subset(struct ddraw_surface *dest, struct ddraw_surface
     return !dest_level && levelFound;
 }
 
-static void copy_mipmap_chain(struct d3d_device *device, struct ddraw_surface *dest,
+static void copy_mipmap_chain(struct d3d_device *device, struct ddraw_surface *dst,
         struct ddraw_surface *src, const POINT *DestPoint, const RECT *SrcRect)
 {
-    struct ddraw_surface *src_level, *dest_level;
+    struct ddraw_surface *dst_level, *src_level;
     IDirectDrawSurface7 *temp;
     DDSURFACEDESC2 ddsd;
     POINT point;
@@ -5965,7 +5965,7 @@ static void copy_mipmap_chain(struct d3d_device *device, struct ddraw_surface *d
 
     /* Copy palette, if possible. */
     IDirectDrawSurface7_GetPalette(&src->IDirectDrawSurface7_iface, &pal_src);
-    IDirectDrawSurface7_GetPalette(&dest->IDirectDrawSurface7_iface, &pal);
+    IDirectDrawSurface7_GetPalette(&dst->IDirectDrawSurface7_iface, &pal);
 
     if (pal_src != NULL && pal != NULL)
     {
@@ -5985,36 +5985,37 @@ static void copy_mipmap_chain(struct d3d_device *device, struct ddraw_surface *d
 
         if (SUCCEEDED(hr))
         {
-            IDirectDrawSurface7_SetColorKey(&dest->IDirectDrawSurface7_iface, ckeyflag, &ddckey);
+            IDirectDrawSurface7_SetColorKey(&dst->IDirectDrawSurface7_iface, ckeyflag, &ddckey);
         }
     }
 
     src_level = src;
-    dest_level = dest;
+    dst_level = dst;
 
     point = *DestPoint;
     src_rect = *SrcRect;
 
-    for (;src_level && dest_level;)
+    for (;src_level && dst_level;)
     {
-        if (src_level->surface_desc.dwWidth == dest_level->surface_desc.dwWidth &&
-            src_level->surface_desc.dwHeight == dest_level->surface_desc.dwHeight)
+        if (src_level->surface_desc.dwWidth == dst_level->surface_desc.dwWidth
+                && src_level->surface_desc.dwHeight == dst_level->surface_desc.dwHeight)
         {
             UINT src_w = src_rect.right - src_rect.left;
             UINT src_h = src_rect.bottom - src_rect.top;
             RECT dst_rect = {point.x, point.y, point.x + src_w, point.y + src_h};
 
-            if (FAILED(hr = wined3d_surface_blt(dest_level->wined3d_surface, &dst_rect,
-                    src_level->wined3d_surface, &src_rect, 0, NULL, WINED3D_TEXF_POINT)))
+            if (FAILED(hr = wined3d_texture_blt(dst_level->wined3d_texture, dst_level->sub_resource_idx, &dst_rect,
+                    src_level->wined3d_texture, src_level->sub_resource_idx, &src_rect, 0, NULL, WINED3D_TEXF_POINT)))
                 ERR("Blit failed, hr %#x.\n", hr);
 
             ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
             ddsd.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL;
-            IDirectDrawSurface7_GetAttachedSurface(&dest_level->IDirectDrawSurface7_iface, &ddsd.ddsCaps, &temp);
+            IDirectDrawSurface7_GetAttachedSurface(&dst_level->IDirectDrawSurface7_iface, &ddsd.ddsCaps, &temp);
 
-            if (dest_level != dest) IDirectDrawSurface7_Release(&dest_level->IDirectDrawSurface7_iface);
+            if (dst_level != dst)
+                IDirectDrawSurface7_Release(&dst_level->IDirectDrawSurface7_iface);
 
-            dest_level = unsafe_impl_from_IDirectDrawSurface7(temp);
+            dst_level = unsafe_impl_from_IDirectDrawSurface7(temp);
         }
 
         ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
@@ -6034,8 +6035,10 @@ static void copy_mipmap_chain(struct d3d_device *device, struct ddraw_surface *d
         src_rect.bottom = (src_rect.bottom + 1) / 2;
     }
 
-    if (src_level && src_level != src) IDirectDrawSurface7_Release(&src_level->IDirectDrawSurface7_iface);
-    if (dest_level && dest_level != dest) IDirectDrawSurface7_Release(&dest_level->IDirectDrawSurface7_iface);
+    if (src_level && src_level != src)
+        IDirectDrawSurface7_Release(&src_level->IDirectDrawSurface7_iface);
+    if (dst_level && dst_level != dst)
+        IDirectDrawSurface7_Release(&dst_level->IDirectDrawSurface7_iface);
 }
 
 /*****************************************************************************
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 86e5290..863eca2 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -5013,7 +5013,7 @@ const struct blit_shader cpu_blit =  {
     cpu_blit_blit_surface,
 };
 
-HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
+HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
         struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
         const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter)
 {
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index c8a172f..49041bb 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -222,7 +222,6 @@
 @ cdecl wined3d_stateblock_decref(ptr)
 @ cdecl wined3d_stateblock_incref(ptr)
 
-@ cdecl wined3d_surface_blt(ptr ptr ptr ptr long ptr long)
 @ cdecl wined3d_surface_get_overlay_position(ptr ptr ptr)
 @ cdecl wined3d_surface_get_parent(ptr)
 @ cdecl wined3d_surface_get_pitch(ptr)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 4bd019f..6e06a5e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2485,6 +2485,9 @@ static inline GLuint surface_get_texture_name(const struct wined3d_surface *surf
             ? surface->container->texture_srgb.name : surface->container->texture_rgb.name;
 }
 
+HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
+        struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
+        const WINEDDBLTFX *blt_fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
 void surface_set_dirty(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
 HRESULT surface_color_fill(struct wined3d_surface *s,
         const RECT *rect, const struct wined3d_color *color) DECLSPEC_HIDDEN;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index c502cc4..893fd67 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2472,9 +2472,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);
 
-HRESULT __cdecl wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
-        struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
-        const WINEDDBLTFX *blt_fx, enum wined3d_texture_filter_type filter);
 HRESULT __cdecl wined3d_surface_get_overlay_position(const struct wined3d_surface *surface, LONG *x, LONG *y);
 void * __cdecl wined3d_surface_get_parent(const struct wined3d_surface *surface);
 DWORD __cdecl wined3d_surface_get_pitch(const struct wined3d_surface *surface);




More information about the wine-cvs mailing list