Alexandre Julliard : wined3d: Always create the software cursor.
Alexandre Julliard
julliard at winehq.org
Tue May 17 12:52:56 CDT 2011
Module: wine
Branch: master
Commit: 599d09b08ca88a9270c56053317ba922c6c4228a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=599d09b08ca88a9270c56053317ba922c6c4228a
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon May 16 20:18:33 2011 +0200
wined3d: Always create the software cursor.
---
dlls/wined3d/device.c | 136 +++++++++++++++++++++++-----------------------
dlls/wined3d/swapchain.c | 4 +-
2 files changed, 70 insertions(+), 70 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index fb13e02..88aac03 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5224,85 +5224,83 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
return WINED3DERR_INVALIDCALL;
}
- if (cursor_image->resource.width != 32 || cursor_image->resource.height != 32)
+ /* TODO: MSDN: Cursor sizes must be a power of 2 */
+
+ /* Do not store the surface's pointer because the application may
+ * release it after setting the cursor image. Windows doesn't
+ * addref the set surface, so we can't do this either without
+ * creating circular refcount dependencies. Copy out the gl texture
+ * instead. */
+ device->cursorWidth = cursor_image->resource.width;
+ device->cursorHeight = cursor_image->resource.height;
+ if (SUCCEEDED(wined3d_surface_map(cursor_image, &rect, NULL, WINED3DLOCK_READONLY)))
{
- /* TODO: MSDN: Cursor sizes must be a power of 2 */
-
- /* Do not store the surface's pointer because the application may
- * release it after setting the cursor image. Windows doesn't
- * addref the set surface, so we can't do this either without
- * creating circular refcount dependencies. Copy out the gl texture
- * instead. */
- device->cursorWidth = cursor_image->resource.width;
- device->cursorHeight = cursor_image->resource.height;
- if (SUCCEEDED(wined3d_surface_map(cursor_image, &rect, NULL, WINED3DLOCK_READONLY)))
- {
- const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
- const struct wined3d_format *format = wined3d_get_format(gl_info, WINED3DFMT_B8G8R8A8_UNORM);
- struct wined3d_context *context;
- char *mem, *bits = rect.pBits;
- GLint intfmt = format->glInternal;
- GLint gl_format = format->glFormat;
- GLint type = format->glType;
- INT height = device->cursorHeight;
- INT width = device->cursorWidth;
- INT bpp = format->byte_count;
- DWORD sampler;
- INT i;
-
- /* Reformat the texture memory (pitch and width can be
- * different) */
- mem = HeapAlloc(GetProcessHeap(), 0, width * height * bpp);
- for(i = 0; i < height; i++)
- memcpy(&mem[width * bpp * i], &bits[rect.Pitch * i], width * bpp);
- wined3d_surface_unmap(cursor_image);
-
- context = context_acquire(device, NULL);
-
- ENTER_GL();
+ const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
+ const struct wined3d_format *format = wined3d_get_format(gl_info, WINED3DFMT_B8G8R8A8_UNORM);
+ struct wined3d_context *context;
+ char *mem, *bits = rect.pBits;
+ GLint intfmt = format->glInternal;
+ GLint gl_format = format->glFormat;
+ GLint type = format->glType;
+ INT height = device->cursorHeight;
+ INT width = device->cursorWidth;
+ INT bpp = format->byte_count;
+ DWORD sampler;
+ INT i;
+
+ /* Reformat the texture memory (pitch and width can be
+ * different) */
+ mem = HeapAlloc(GetProcessHeap(), 0, width * height * bpp);
+ for(i = 0; i < height; i++)
+ memcpy(&mem[width * bpp * i], &bits[rect.Pitch * i], width * bpp);
+ wined3d_surface_unmap(cursor_image);
- if (gl_info->supported[APPLE_CLIENT_STORAGE])
- {
- glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
- checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)");
- }
+ context = context_acquire(device, NULL);
- /* Make sure that a proper texture unit is selected */
- GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB));
- checkGLcall("glActiveTextureARB");
- sampler = device->rev_tex_unit_map[0];
- if (sampler != WINED3D_UNMAPPED_STAGE)
- {
- IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(sampler));
- }
- /* Create a new cursor texture */
- glGenTextures(1, &device->cursorTexture);
- checkGLcall("glGenTextures");
- glBindTexture(GL_TEXTURE_2D, device->cursorTexture);
- checkGLcall("glBindTexture");
- /* Copy the bitmap memory into the cursor texture */
- glTexImage2D(GL_TEXTURE_2D, 0, intfmt, width, height, 0, gl_format, type, mem);
- checkGLcall("glTexImage2D");
- HeapFree(GetProcessHeap(), 0, mem);
-
- if (gl_info->supported[APPLE_CLIENT_STORAGE])
- {
- glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
- checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
- }
+ ENTER_GL();
- LEAVE_GL();
+ if (gl_info->supported[APPLE_CLIENT_STORAGE])
+ {
+ glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
+ checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)");
+ }
- context_release(context);
+ /* Make sure that a proper texture unit is selected */
+ GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB));
+ checkGLcall("glActiveTextureARB");
+ sampler = device->rev_tex_unit_map[0];
+ if (sampler != WINED3D_UNMAPPED_STAGE)
+ {
+ IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(sampler));
}
- else
+ /* Create a new cursor texture */
+ glGenTextures(1, &device->cursorTexture);
+ checkGLcall("glGenTextures");
+ glBindTexture(GL_TEXTURE_2D, device->cursorTexture);
+ checkGLcall("glBindTexture");
+ /* Copy the bitmap memory into the cursor texture */
+ glTexImage2D(GL_TEXTURE_2D, 0, intfmt, width, height, 0, gl_format, type, mem);
+ checkGLcall("glTexImage2D");
+ HeapFree(GetProcessHeap(), 0, mem);
+
+ if (gl_info->supported[APPLE_CLIENT_STORAGE])
{
- FIXME("A cursor texture was not returned.\n");
- device->cursorTexture = 0;
+ glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
+ checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
}
+
+ LEAVE_GL();
+
+ context_release(context);
}
else
{
+ FIXME("A cursor texture was not returned.\n");
+ device->cursorTexture = 0;
+ }
+
+ if (cursor_image->resource.width == 32 && cursor_image->resource.height == 32)
+ {
/* Draw a hardware cursor */
ICONINFO cursorInfo;
HCURSOR cursor;
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 0cfcc8e..8b0833d 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -422,7 +422,9 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
gl_info = context->gl_info;
/* Render the cursor onto the back buffer, using our nifty directdraw blitting code :-) */
- if (swapchain->device->bCursorVisible && swapchain->device->cursorTexture)
+ if (swapchain->device->bCursorVisible &&
+ swapchain->device->cursorTexture &&
+ !swapchain->device->hardwareCursor)
{
struct wined3d_surface cursor;
RECT destRect =
More information about the wine-cvs
mailing list