forked from Mirrors/wine-wine
wined3d: Change surface_translate_frontbuffer_coords() to handle all drawable coordinates.
parent
b9e7c3490f
commit
e35b6aa1a7
|
@ -7153,21 +7153,8 @@ HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_
|
||||||
context = context_acquire(device, dst_surface);
|
context = context_acquire(device, dst_surface);
|
||||||
context_apply_blit_state(context, device);
|
context_apply_blit_state(context, device);
|
||||||
|
|
||||||
/* The coordinates of the ddraw front buffer are always fullscreen ('screen coordinates',
|
|
||||||
* while OpenGL coordinates are window relative.
|
|
||||||
* Also beware of the origin difference(top left vs bottom left).
|
|
||||||
* Also beware that the front buffer's surface size is screen width x screen height,
|
|
||||||
* whereas the real gl drawable size is the size of the window. */
|
|
||||||
dst_swapchain = dst_surface->container.type == WINED3D_CONTAINER_SWAPCHAIN
|
|
||||||
? dst_surface->container.u.swapchain : NULL;
|
|
||||||
if (!surface_is_offscreen(dst_surface))
|
if (!surface_is_offscreen(dst_surface))
|
||||||
{
|
surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect);
|
||||||
if (dst_swapchain && dst_surface == dst_swapchain->front_buffer)
|
|
||||||
surface_translate_frontbuffer_coords(dst_surface, context->win_handle, &dst_rect);
|
|
||||||
|
|
||||||
dst_rect.top = dst_surface->currentDesc.Height - dst_rect.top;
|
|
||||||
dst_rect.bottom = dst_surface->currentDesc.Height - dst_rect.bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
arbfp_blit_set((IWineD3DDevice *)device, src_surface);
|
arbfp_blit_set((IWineD3DDevice *)device, src_surface);
|
||||||
|
|
||||||
|
@ -7181,6 +7168,8 @@ HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_
|
||||||
/* Leave the opengl state valid for blitting */
|
/* Leave the opengl state valid for blitting */
|
||||||
arbfp_blit_unset((IWineD3DDevice *)device);
|
arbfp_blit_unset((IWineD3DDevice *)device);
|
||||||
|
|
||||||
|
dst_swapchain = dst_surface->container.type == WINED3D_CONTAINER_SWAPCHAIN
|
||||||
|
? dst_surface->container.u.swapchain : NULL;
|
||||||
if (wined3d_settings.strict_draw_ordering || (dst_swapchain
|
if (wined3d_settings.strict_draw_ordering || (dst_swapchain
|
||||||
&& (dst_surface == dst_swapchain->front_buffer
|
&& (dst_surface == dst_swapchain->front_buffer
|
||||||
|| dst_swapchain->num_contexts > 1)))
|
|| dst_swapchain->num_contexts > 1)))
|
||||||
|
|
|
@ -3176,15 +3176,29 @@ static BOOL fbo_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_
|
||||||
* drawable is limited to the window's client area. The sysmem and texture
|
* drawable is limited to the window's client area. The sysmem and texture
|
||||||
* copies do have the full screen size. Note that GL has a bottom-left
|
* copies do have the full screen size. Note that GL has a bottom-left
|
||||||
* origin, while D3D has a top-left origin. */
|
* origin, while D3D has a top-left origin. */
|
||||||
void surface_translate_frontbuffer_coords(IWineD3DSurfaceImpl *surface, HWND window, RECT *rect)
|
void surface_translate_drawable_coords(IWineD3DSurfaceImpl *surface, HWND window, RECT *rect)
|
||||||
{
|
{
|
||||||
POINT offset = {0, surface->currentDesc.Height};
|
UINT drawable_height;
|
||||||
RECT windowsize;
|
|
||||||
|
|
||||||
GetClientRect(window, &windowsize);
|
if (surface->container.type == WINED3D_CONTAINER_SWAPCHAIN
|
||||||
offset.y -= windowsize.bottom - windowsize.top;
|
&& surface == surface->container.u.swapchain->front_buffer)
|
||||||
ScreenToClient(window, &offset);
|
{
|
||||||
OffsetRect(rect, offset.x, offset.y);
|
POINT offset = {0, 0};
|
||||||
|
RECT windowsize;
|
||||||
|
|
||||||
|
ScreenToClient(window, &offset);
|
||||||
|
OffsetRect(rect, offset.x, offset.y);
|
||||||
|
|
||||||
|
GetClientRect(window, &windowsize);
|
||||||
|
drawable_height = windowsize.bottom - windowsize.top;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
drawable_height = surface->currentDesc.Height;
|
||||||
|
}
|
||||||
|
|
||||||
|
rect->top = drawable_height - rect->top;
|
||||||
|
rect->bottom = drawable_height - rect->bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL surface_is_full_rect(IWineD3DSurfaceImpl *surface, const RECT *r)
|
static BOOL surface_is_full_rect(IWineD3DSurfaceImpl *surface, const RECT *r)
|
||||||
|
@ -3262,11 +3276,7 @@ static void surface_blt_fbo(IWineD3DDeviceImpl *device, const WINED3DTEXTUREFILT
|
||||||
|
|
||||||
TRACE("Source surface %p is onscreen.\n", src_surface);
|
TRACE("Source surface %p is onscreen.\n", src_surface);
|
||||||
|
|
||||||
if (buffer == GL_FRONT)
|
surface_translate_drawable_coords(src_surface, context->win_handle, &src_rect);
|
||||||
surface_translate_frontbuffer_coords(src_surface, context->win_handle, &src_rect);
|
|
||||||
|
|
||||||
src_rect.top = src_surface->currentDesc.Height - src_rect.top;
|
|
||||||
src_rect.bottom = src_surface->currentDesc.Height - src_rect.bottom;
|
|
||||||
|
|
||||||
ENTER_GL();
|
ENTER_GL();
|
||||||
context_bind_fbo(context, GL_READ_FRAMEBUFFER, NULL);
|
context_bind_fbo(context, GL_READ_FRAMEBUFFER, NULL);
|
||||||
|
@ -3289,11 +3299,7 @@ static void surface_blt_fbo(IWineD3DDeviceImpl *device, const WINED3DTEXTUREFILT
|
||||||
|
|
||||||
TRACE("Destination surface %p is onscreen.\n", dst_surface);
|
TRACE("Destination surface %p is onscreen.\n", dst_surface);
|
||||||
|
|
||||||
if (buffer == GL_FRONT)
|
surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect);
|
||||||
surface_translate_frontbuffer_coords(dst_surface, context->win_handle, &dst_rect);
|
|
||||||
|
|
||||||
dst_rect.top = dst_surface->currentDesc.Height - dst_rect.top;
|
|
||||||
dst_rect.bottom = dst_surface->currentDesc.Height - dst_rect.bottom;
|
|
||||||
|
|
||||||
ENTER_GL();
|
ENTER_GL();
|
||||||
context_bind_fbo(context, GL_DRAW_FRAMEBUFFER, NULL);
|
context_bind_fbo(context, GL_DRAW_FRAMEBUFFER, NULL);
|
||||||
|
@ -3353,15 +3359,7 @@ static void surface_blt_to_drawable(IWineD3DDeviceImpl *device,
|
||||||
context_apply_blit_state(context, device);
|
context_apply_blit_state(context, device);
|
||||||
|
|
||||||
if (!surface_is_offscreen(dst_surface))
|
if (!surface_is_offscreen(dst_surface))
|
||||||
{
|
surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect);
|
||||||
if (swapchain && dst_surface == swapchain->front_buffer)
|
|
||||||
{
|
|
||||||
surface_translate_frontbuffer_coords(dst_surface, context->win_handle, &dst_rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
dst_rect.top = dst_surface->currentDesc.Height - dst_rect.top;
|
|
||||||
dst_rect.bottom = dst_surface->currentDesc.Height - dst_rect.bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
device->blitter->set_shader((IWineD3DDevice *)device, src_surface);
|
device->blitter->set_shader((IWineD3DDevice *)device, src_surface);
|
||||||
|
|
||||||
|
|
|
@ -2178,7 +2178,7 @@ void surface_set_container(IWineD3DSurfaceImpl *surface,
|
||||||
enum wined3d_container_type type, IWineD3DBase *container) DECLSPEC_HIDDEN;
|
enum wined3d_container_type type, IWineD3DBase *container) DECLSPEC_HIDDEN;
|
||||||
void surface_set_texture_name(IWineD3DSurfaceImpl *surface, GLuint name, BOOL srgb_name) DECLSPEC_HIDDEN;
|
void surface_set_texture_name(IWineD3DSurfaceImpl *surface, GLuint name, BOOL srgb_name) DECLSPEC_HIDDEN;
|
||||||
void surface_set_texture_target(IWineD3DSurfaceImpl *surface, GLenum target) DECLSPEC_HIDDEN;
|
void surface_set_texture_target(IWineD3DSurfaceImpl *surface, GLenum target) DECLSPEC_HIDDEN;
|
||||||
void surface_translate_frontbuffer_coords(IWineD3DSurfaceImpl *surface, HWND window, RECT *rect) DECLSPEC_HIDDEN;
|
void surface_translate_drawable_coords(IWineD3DSurfaceImpl *surface, HWND window, RECT *rect) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* Predeclare the shared Surface functions */
|
/* Predeclare the shared Surface functions */
|
||||||
HRESULT WINAPI IWineD3DBaseSurfaceImpl_QueryInterface(IWineD3DSurface *iface,
|
HRESULT WINAPI IWineD3DBaseSurfaceImpl_QueryInterface(IWineD3DSurface *iface,
|
||||||
|
|
Loading…
Reference in New Issue