wined3d: Allow SetCursorProperties on existing cursor

Erich Hoover ehoover at mines.edu
Fri Mar 9 23:10:57 CST 2007


Skipped content of type multipart/alternative-------------- next part --------------
From 198b3b745c3739ac97db6be9e32f3fff79f2949e Mon Sep 17 00:00:00 2001
From: Erich Hoover <ehoover at mediaserver.(none)>
Date: Fri, 9 Mar 2007 21:58:01 -0700
Subject: wined3d: Allow SetCursorProperties on existing cursor
---
 dlls/wined3d/device.c  |    8 +-------
 dlls/wined3d/surface.c |   10 ++++++++++
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 0998eec..0339e8d 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5207,13 +5207,6 @@ static HRESULT  WINAPI  IWineD3DDeviceIm
     TRACE("(%p) : Spot Pos(%u,%u)\n", This, XHotSpot, YHotSpot);
 
     /* some basic validation checks */
-    if(This->cursorTexture) {
-        ENTER_GL();
-        glDeleteTextures(1, &This->cursorTexture);
-        LEAVE_GL();
-        This->cursorTexture = 0;
-    }
-
     if(pCursorBitmap) {
         /* MSDN: Cursor must be A8R8G8B8 */
         if (WINED3DFMT_A8R8G8B8 != pSur->resource.format) {
@@ -5243,6 +5236,7 @@ static HRESULT  WINAPI  IWineD3DDeviceIm
         This->cursorWidth = pSur->currentDesc.Width;
         This->cursorHeight = pSur->currentDesc.Height;
         pSur->glDescription.textureName = 0; /* Prevent the texture from being changed or deleted */
+        /* NOTE: It is also important to keep the texture between SetCursorProperties calls */
     }
 
     This->xHotSpot = XHotSpot;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index c8d39f6..a63a3b7 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -349,6 +349,16 @@ void WINAPI IWineD3DSurfaceImpl_PreLoad(
     if (IWineD3DSurface_GetContainer(iface, &IID_IWineD3DBaseTexture, (void **)&baseTexture) == WINED3D_OK) {
         TRACE("Passing to conatiner\n");
         IWineD3DBaseTexture_PreLoad(baseTexture);
+        /* If the texture could not be pre-loaded then it is likely that the application is
+         * attempting to access an existing (non-dirty) texture.
+         */
+        if (!This->glDescription.textureName) {
+            IWineD3DTextureImpl *texImpl = (IWineD3DTextureImpl *)baseTexture;
+            IWineD3DTexture *tex = (IWineD3DTexture *)baseTexture;
+            
+            IWineD3DSurfaceImpl_SetGlTextureDesc(iface, texImpl->baseTexture.textureName, IWineD3DTexture_GetTextureDimensions(tex));
+            IWineD3DSurface_LoadTexture(iface);
+        }
         IWineD3DBaseTexture_Release(baseTexture);
     } else {
     TRACE("(%p) : About to load surface\n", This);
-- 
1.4.1



More information about the wine-patches mailing list