diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 70b9d44b95e..48ff005d4f6 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -5006,14 +5006,13 @@ const struct blit_shader cpu_blit = { cpu_blit_blit_surface, }; -HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect_in, - struct wined3d_surface *src_surface, const RECT *src_rect_in, DWORD flags, +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 *fx, enum wined3d_texture_filter_type filter) { struct wined3d_swapchain *src_swapchain, *dst_swapchain; struct wined3d_device *device = dst_surface->resource.device; DWORD src_ds_flags, dst_ds_flags; - RECT src_rect, dst_rect; BOOL scale, convert; static const DWORD simple_blit = WINEDDBLT_ASYNC @@ -5025,8 +5024,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC | WINEDDBLT_DONOTWAIT | WINEDDBLT_ALPHATEST; - TRACE("dst_surface %p, dst_rect_in %s, src_surface %p, src_rect_in %s, flags %#x, fx %p, filter %s.\n", - dst_surface, wine_dbgstr_rect(dst_rect_in), src_surface, wine_dbgstr_rect(src_rect_in), + TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", + dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), flags, fx, debug_d3dtexturefiltertype(filter)); TRACE("Usage is %s.\n", debug_d3dusage(dst_surface->resource.usage)); @@ -5067,13 +5066,11 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC return WINEDDERR_SURFACEBUSY; } - surface_get_rect(dst_surface, dst_rect_in, &dst_rect); - - if (dst_rect.left >= dst_rect.right || dst_rect.top >= dst_rect.bottom - || dst_rect.left > dst_surface->resource.width || dst_rect.left < 0 - || dst_rect.top > dst_surface->resource.height || dst_rect.top < 0 - || dst_rect.right > dst_surface->resource.width || dst_rect.right < 0 - || dst_rect.bottom > dst_surface->resource.height || dst_rect.bottom < 0) + if (dst_rect->left >= dst_rect->right || dst_rect->top >= dst_rect->bottom + || dst_rect->left > dst_surface->resource.width || dst_rect->left < 0 + || dst_rect->top > dst_surface->resource.height || dst_rect->top < 0 + || dst_rect->right > dst_surface->resource.width || dst_rect->right < 0 + || dst_rect->bottom > dst_surface->resource.height || dst_rect->bottom < 0) { WARN("The application gave us a bad destination rectangle.\n"); return WINEDDERR_INVALIDRECT; @@ -5081,22 +5078,16 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC if (src_surface) { - surface_get_rect(src_surface, src_rect_in, &src_rect); - - if (src_rect.left >= src_rect.right || src_rect.top >= src_rect.bottom - || src_rect.left > src_surface->resource.width || src_rect.left < 0 - || src_rect.top > src_surface->resource.height || src_rect.top < 0 - || src_rect.right > src_surface->resource.width || src_rect.right < 0 - || src_rect.bottom > src_surface->resource.height || src_rect.bottom < 0) + if (src_rect->left >= src_rect->right || src_rect->top >= src_rect->bottom + || src_rect->left > src_surface->resource.width || src_rect->left < 0 + || src_rect->top > src_surface->resource.height || src_rect->top < 0 + || src_rect->right > src_surface->resource.width || src_rect->right < 0 + || src_rect->bottom > src_surface->resource.height || src_rect->bottom < 0) { - WARN("Application gave us bad source rectangle for Blt.\n"); + WARN("The application gave us a bad source rectangle.\n"); return WINEDDERR_INVALIDRECT; } } - else - { - memset(&src_rect, 0, sizeof(src_rect)); - } if (!fx || !(fx->dwDDFX)) flags &= ~WINEDDBLT_DDFX; @@ -5165,8 +5156,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC } scale = src_surface - && (src_rect.right - src_rect.left != dst_rect.right - dst_rect.left - || src_rect.bottom - src_rect.top != dst_rect.bottom - dst_rect.top); + && (src_rect->right - src_rect->left != dst_rect->right - dst_rect->left + || src_rect->bottom - src_rect->top != dst_rect->bottom - dst_rect->top); convert = src_surface && src_surface->resource.format->id != dst_surface->resource.format->id; dst_ds_flags = dst_surface->container->resource.format_flags @@ -5188,7 +5179,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC if (!surface_convert_depth_to_float(dst_surface, fx->u5.dwFillDepth, &depth)) return WINED3DERR_INVALIDCALL; - if (SUCCEEDED(wined3d_surface_depth_fill(dst_surface, &dst_rect, depth))) + if (SUCCEEDED(wined3d_surface_depth_fill(dst_surface, dst_rect, depth))) return WINED3D_OK; } else @@ -5200,7 +5191,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC } if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_surface->container->resource.draw_binding, - &src_rect, dst_surface, dst_surface->container->resource.draw_binding, &dst_rect))) + src_rect, dst_surface, dst_surface->container->resource.draw_binding, dst_rect))) return WINED3D_OK; } } @@ -5232,7 +5223,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC palette, fx->u5.dwFillColor, &color)) goto fallback; - if (SUCCEEDED(surface_color_fill(dst_surface, &dst_rect, &color))) + if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color))) return WINED3D_OK; } else @@ -5265,9 +5256,9 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC TRACE("Not doing upload because of format conversion.\n"); else { - POINT dst_point = {dst_rect.left, dst_rect.top}; + POINT dst_point = {dst_rect->left, dst_rect->top}; - if (SUCCEEDED(surface_upload_from_surface(dst_surface, &dst_point, src_surface, &src_rect))) + if (SUCCEEDED(surface_upload_from_surface(dst_surface, &dst_point, src_surface, src_rect))) { if (!wined3d_resource_is_offscreen(&dst_surface->container->resource)) { @@ -5303,16 +5294,16 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC } if (fbo_blit_supported(&device->adapter->gl_info, blit_op, - &src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format, - &dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format)) + src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format, + dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format)) { struct wined3d_context *context; TRACE("Using FBO blit.\n"); context = context_acquire(device, NULL); surface_blt_fbo(device, context, filter, - src_surface, src_surface->container->resource.draw_binding, &src_rect, - dst_surface, dst_surface->container->resource.draw_binding, &dst_rect); + src_surface, src_surface->container->resource.draw_binding, src_rect, + dst_surface, dst_surface->container->resource.draw_binding, dst_rect); context_release(context); surface_validate_location(dst_surface, dst_surface->container->resource.draw_binding); @@ -5322,12 +5313,12 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC } blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, blit_op, - &src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format, - &dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format); + src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format, + dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format); if (blitter) { blitter->blit_surface(device, blit_op, filter, src_surface, - &src_rect, dst_surface, &dst_rect, color_key); + src_rect, dst_surface, dst_rect, color_key); return WINED3D_OK; } } @@ -5335,15 +5326,11 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC fallback: /* Special cases for render targets. */ - if (SUCCEEDED(surface_blt_special(dst_surface, &dst_rect, src_surface, &src_rect, flags, fx, filter))) + if (SUCCEEDED(surface_blt_special(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter))) return WINED3D_OK; cpu: - - /* For the rest call the X11 surface implementation. For render targets - * this should be implemented OpenGL accelerated in surface_blt_special(), - * other blits are rather rare. */ - return surface_cpu_blt(dst_surface, &dst_rect, src_surface, &src_rect, flags, fx, filter); + return surface_cpu_blt(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter); } static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_texture *container,