Commit bcabae6f authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Clip software cursor blits.

This prevents the SW cursor from disappearing when it is at the edge of the screen. Signed-off-by: 's avatarStefan Dösinger <stefandoesinger@gmx.at> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 080dedaf
...@@ -467,13 +467,21 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT ...@@ -467,13 +467,21 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT
swapchain->device->xScreenSpace + swapchain->device->cursorWidth - swapchain->device->xHotSpot, swapchain->device->xScreenSpace + swapchain->device->cursorWidth - swapchain->device->xHotSpot,
swapchain->device->yScreenSpace + swapchain->device->cursorHeight - swapchain->device->yHotSpot, swapchain->device->yScreenSpace + swapchain->device->cursorHeight - swapchain->device->yHotSpot,
}; };
RECT src_rect =
{
0, 0,
swapchain->device->cursor_texture->resource.width,
swapchain->device->cursor_texture->resource.height
};
const RECT clip_rect = {0, 0, back_buffer->resource.width, back_buffer->resource.height};
TRACE("Rendering the software cursor.\n"); TRACE("Rendering the software cursor.\n");
if (swapchain->desc.windowed) if (swapchain->desc.windowed)
MapWindowPoints(NULL, swapchain->win_handle, (POINT *)&destRect, 2); MapWindowPoints(NULL, swapchain->win_handle, (POINT *)&destRect, 2);
wined3d_surface_blt(back_buffer, &destRect, cursor, NULL, WINEDDBLT_ALPHATEST, if (wined3d_clip_blit(&clip_rect, &destRect, &src_rect))
NULL, WINED3D_TEXF_POINT); wined3d_surface_blt(back_buffer, &destRect, cursor, &src_rect, WINEDDBLT_ALPHATEST,
NULL, WINED3D_TEXF_POINT);
} }
TRACE("Presenting HDC %p.\n", context->hdc); TRACE("Presenting HDC %p.\n", context->hdc);
......
...@@ -4994,3 +4994,25 @@ void wined3d_release_dc(HWND window, HDC dc) ...@@ -4994,3 +4994,25 @@ void wined3d_release_dc(HWND window, HDC dc)
else if (!ReleaseDC(window, dc)) else if (!ReleaseDC(window, dc))
ERR("Failed to release device context %p, last error %#x.\n", dc, GetLastError()); ERR("Failed to release device context %p, last error %#x.\n", dc, GetLastError());
} }
BOOL wined3d_clip_blit(const RECT *clip_rect, RECT *clipped, RECT *other)
{
RECT orig = *clipped;
float scale_x = (float)(orig.right - orig.left) / (float)(other->right - other->left);
float scale_y = (float)(orig.bottom - orig.top) / (float)(other->bottom - other->top);
IntersectRect(clipped, clipped, clip_rect);
if (IsRectEmpty(clipped))
{
SetRectEmpty(other);
return FALSE;
}
other->left += (LONG)((clipped->left - orig.left) / scale_x);
other->top += (LONG)((clipped->top - orig.top) / scale_y);
other->right -= (LONG)((orig.right - clipped->right) / scale_x);
other->bottom -= (LONG)((orig.bottom - clipped->bottom) / scale_y);
return TRUE;
}
...@@ -1396,6 +1396,7 @@ extern const struct blit_shader ffp_blit DECLSPEC_HIDDEN; ...@@ -1396,6 +1396,7 @@ extern const struct blit_shader ffp_blit DECLSPEC_HIDDEN;
extern const struct blit_shader arbfp_blit DECLSPEC_HIDDEN; extern const struct blit_shader arbfp_blit DECLSPEC_HIDDEN;
extern const struct blit_shader cpu_blit DECLSPEC_HIDDEN; extern const struct blit_shader cpu_blit DECLSPEC_HIDDEN;
BOOL wined3d_clip_blit(const RECT *clip_rect, RECT *clipped, RECT *other) DECLSPEC_HIDDEN;
const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *gl_info, const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *gl_info,
const struct wined3d_d3d_info *d3d_info, enum wined3d_blit_op blit_op, const struct wined3d_d3d_info *d3d_info, enum wined3d_blit_op blit_op,
const RECT *src_rect, DWORD src_usage, enum wined3d_pool src_pool, const struct wined3d_format *src_format, const RECT *src_rect, DWORD src_usage, enum wined3d_pool src_pool, const struct wined3d_format *src_format,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment