[PATCH 2/4] wined3d: Remove IWineD3DSurface::LoadTexture() from the public interface.

Henri Verbeet hverbeet at codeweavers.com
Thu Jan 20 12:51:59 CST 2011


---
 dlls/wined3d/cubetexture.c     |    2 +-
 dlls/wined3d/surface.c         |  111 +++++++++++++++++++--------------------
 dlls/wined3d/surface_gdi.c     |   17 ------
 dlls/wined3d/texture.c         |    2 +-
 dlls/wined3d/wined3d_private.h |    1 +
 include/wine/wined3d.idl       |    3 -
 6 files changed, 57 insertions(+), 79 deletions(-)

diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c
index cc2c6e9..feefebc 100644
--- a/dlls/wined3d/cubetexture.c
+++ b/dlls/wined3d/cubetexture.c
@@ -122,7 +122,7 @@ static void cubetexture_preload(IWineD3DBaseTextureImpl *texture, enum WINED3DSR
     {
         for (i = 0; i < sub_count; ++i)
         {
-            IWineD3DSurface_LoadTexture((IWineD3DSurface *)texture->baseTexture.sub_resources[i], srgb_mode);
+            surface_load((IWineD3DSurfaceImpl *)texture->baseTexture.sub_resources[i], srgb_mode);
         }
     }
     else
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index cacf062..d6734a7 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1087,6 +1087,59 @@ static BOOL surface_convert_color_to_float(IWineD3DSurfaceImpl *surface, DWORD c
     return TRUE;
 }
 
+HRESULT surface_load(IWineD3DSurfaceImpl *surface, BOOL srgb)
+{
+    DWORD flag = srgb ? SFLAG_INSRGBTEX : SFLAG_INTEXTURE;
+
+    TRACE("surface %p, srgb %#x.\n", surface, srgb);
+
+    if (surface->resource.pool == WINED3DPOOL_SCRATCH)
+    {
+        ERR("Not supported on scratch surfaces.\n");
+        return WINED3DERR_INVALIDCALL;
+    }
+
+    if (!(surface->flags & flag))
+    {
+        TRACE("Reloading because surface is dirty\n");
+    }
+    /* Reload if either the texture and sysmem have different ideas about the
+     * color key, or the actual key values changed. */
+    else if (!(surface->flags & SFLAG_GLCKEY) != !(surface->CKeyFlags & WINEDDSD_CKSRCBLT)
+            || ((surface->CKeyFlags & WINEDDSD_CKSRCBLT)
+            && (surface->glCKey.dwColorSpaceLowValue != surface->SrcBltCKey.dwColorSpaceLowValue
+            || surface->glCKey.dwColorSpaceHighValue != surface->SrcBltCKey.dwColorSpaceHighValue)))
+    {
+        TRACE("Reloading because of color keying\n");
+        /* To perform the color key conversion we need a sysmem copy of
+         * the surface. Make sure we have it. */
+
+        surface_load_location(surface, SFLAG_INSYSMEM, NULL);
+        /* Make sure the texture is reloaded because of the color key change,
+         * this kills performance though :( */
+        /* TODO: This is not necessarily needed with hw palettized texture support. */
+        surface_modify_location(surface, SFLAG_INSYSMEM, TRUE);
+    }
+    else
+    {
+        TRACE("surface is already in texture\n");
+        return WINED3D_OK;
+    }
+
+    /* No partial locking for textures yet. */
+    surface_load_location(surface, flag, NULL);
+
+    if (!(surface->flags & SFLAG_DONOTFREE))
+    {
+        HeapFree(GetProcessHeap(), 0, surface->resource.heapMemory);
+        surface->resource.allocatedMemory = NULL;
+        surface->resource.heapMemory = NULL;
+        surface_modify_location(surface, SFLAG_INSYSMEM, FALSE);
+    }
+
+    return WINED3D_OK;
+}
+
 /* Do not call while under the GL lock. */
 static ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface)
 {
@@ -1145,7 +1198,7 @@ void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srg
             }
         }
 
-        IWineD3DSurface_LoadTexture((IWineD3DSurface *)surface, srgb == SRGB_SRGB ? TRUE : FALSE);
+        surface_load(surface, srgb == SRGB_SRGB ? TRUE : FALSE);
 
         if (surface->resource.pool == WINED3DPOOL_DEFAULT)
         {
@@ -2489,61 +2542,6 @@ BOOL palette9_changed(IWineD3DSurfaceImpl *This)
     return TRUE;
 }
 
-static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, BOOL srgb_mode) {
-    IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
-    DWORD flag = srgb_mode ? SFLAG_INSRGBTEX : SFLAG_INTEXTURE;
-
-    TRACE("iface %p, srgb %#x.\n", iface, srgb_mode);
-
-    if (!(This->flags & flag))
-    {
-        TRACE("Reloading because surface is dirty\n");
-    }
-    /* Reload if either the texture and sysmem have different ideas about the
-     * color key, or the actual key values changed. */
-    else if (!(This->flags & SFLAG_GLCKEY) != !(This->CKeyFlags & WINEDDSD_CKSRCBLT)
-            || ((This->CKeyFlags & WINEDDSD_CKSRCBLT)
-            && (This->glCKey.dwColorSpaceLowValue != This->SrcBltCKey.dwColorSpaceLowValue
-            || This->glCKey.dwColorSpaceHighValue != This->SrcBltCKey.dwColorSpaceHighValue)))
-    {
-        TRACE("Reloading because of color keying\n");
-        /* To perform the color key conversion we need a sysmem copy of
-         * the surface. Make sure we have it
-         */
-
-        surface_load_location(This, SFLAG_INSYSMEM, NULL);
-        /* Make sure the texture is reloaded because of the color key change, this kills performance though :( */
-        /* TODO: This is not necessarily needed with hw palettized texture support */
-        surface_modify_location(This, SFLAG_INSYSMEM, TRUE);
-    } else {
-        TRACE("surface is already in texture\n");
-        return WINED3D_OK;
-    }
-
-    /* Resources are placed in system RAM and do not need to be recreated when a device is lost.
-     *  These resources are not bound by device size or format restrictions. Because of this,
-     *  these resources cannot be accessed by the Direct3D device nor set as textures or render targets.
-     *  However, these resources can always be created, locked, and copied.
-     */
-    if (This->resource.pool == WINED3DPOOL_SCRATCH )
-    {
-        FIXME("(%p) Operation not supported for scratch textures\n",This);
-        return WINED3DERR_INVALIDCALL;
-    }
-
-    surface_load_location(This, flag, NULL /* no partial locking for textures yet */);
-
-    if (!(This->flags & SFLAG_DONOTFREE))
-    {
-        HeapFree(GetProcessHeap(), 0, This->resource.heapMemory);
-        This->resource.allocatedMemory = NULL;
-        This->resource.heapMemory = NULL;
-        surface_modify_location(This, SFLAG_INSYSMEM, FALSE);
-    }
-
-    return WINED3D_OK;
-}
-
 static HRESULT WINAPI IWineD3DSurfaceImpl_SetFormat(IWineD3DSurface *iface, enum wined3d_format_id format)
 {
     IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
@@ -4714,7 +4712,6 @@ const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =
     IWineD3DBaseSurfaceImpl_SetClipper,
     IWineD3DBaseSurfaceImpl_GetClipper,
     /* Internal use: */
-    IWineD3DSurfaceImpl_LoadTexture,
     IWineD3DBaseSurfaceImpl_GetData,
     IWineD3DSurfaceImpl_SetFormat,
     IWineD3DSurfaceImpl_PrivateSetup,
diff --git a/dlls/wined3d/surface_gdi.c b/dlls/wined3d/surface_gdi.c
index 28a465c..9616489 100644
--- a/dlls/wined3d/surface_gdi.c
+++ b/dlls/wined3d/surface_gdi.c
@@ -193,22 +193,6 @@ static HRESULT WINAPI IWineGDISurfaceImpl_Flip(IWineD3DSurface *iface, IWineD3DS
     return hr;
 }
 
-/*****************************************************************************
- * IWineD3DSurface::LoadTexture, GDI version
- *
- * This is mutually unsupported by GDI surfaces
- *
- * Returns:
- *  D3DERR_INVALIDCALL
- *
- *****************************************************************************/
-static HRESULT WINAPI
-IWineGDISurfaceImpl_LoadTexture(IWineD3DSurface *iface, BOOL srgb_mode)
-{
-    ERR("Unsupported on X11 surfaces\n");
-    return WINED3DERR_INVALIDCALL;
-}
-
 static HRESULT WINAPI IWineGDISurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) {
     IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
     WINED3DLOCKED_RECT lock;
@@ -496,7 +480,6 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
     IWineD3DBaseSurfaceImpl_SetClipper,
     IWineD3DBaseSurfaceImpl_GetClipper,
     /* Internal use: */
-    IWineGDISurfaceImpl_LoadTexture,
     IWineD3DBaseSurfaceImpl_GetData,
     IWineD3DBaseSurfaceImpl_SetFormat,
     IWineGDISurfaceImpl_PrivateSetup,
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 036fa2e..02909b3 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -146,7 +146,7 @@ static void texture_preload(IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB s
     {
         for (i = 0; i < texture->baseTexture.level_count; ++i)
         {
-            IWineD3DSurface_LoadTexture((IWineD3DSurface *)texture->baseTexture.sub_resources[i], srgb_mode);
+            surface_load((IWineD3DSurfaceImpl *)texture->baseTexture.sub_resources[i], srgb_mode);
         }
     }
     else
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index a409f05..5cd4bb6 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2165,6 +2165,7 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type,
 BOOL surface_init_sysmem(IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
 void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srgb) DECLSPEC_HIDDEN;
 BOOL surface_is_offscreen(IWineD3DSurfaceImpl *iface) DECLSPEC_HIDDEN;
+HRESULT surface_load(IWineD3DSurfaceImpl *surface, BOOL srgb) DECLSPEC_HIDDEN;
 void surface_load_ds_location(IWineD3DSurfaceImpl *surface,
         struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
 HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RECT *rect) DECLSPEC_HIDDEN;
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index 9c1a04a..10d41d1 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -2462,9 +2462,6 @@ interface IWineD3DSurface : IWineD3DResource
     HRESULT GetClipper(
         [out] IWineD3DClipper **clipper
     );
-    HRESULT LoadTexture(
-        [in] BOOL srgb_mode
-    );
     const void *GetData(
     );
     HRESULT SetFormat(
-- 
1.7.3.4




More information about the wine-patches mailing list