Commit 3f0d16c5 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Do not use "lockedRect" unless the surface is locked in flush_to_framebuffer_drawpixels().

parent b66478df
...@@ -1741,6 +1741,17 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, ...@@ -1741,6 +1741,17 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This,
IWineD3DDeviceImpl *device = This->resource.device; IWineD3DDeviceImpl *device = This->resource.device;
const struct wined3d_gl_info *gl_info; const struct wined3d_gl_info *gl_info;
struct wined3d_context *context; struct wined3d_context *context;
RECT rect;
UINT w, h;
if (This->Flags & SFLAG_LOCKED)
rect = This->lockedRect;
else
SetRect(&rect, 0, 0, This->currentDesc.Width, This->currentDesc.Height);
mem += rect.top * pitch + rect.left * bpp;
w = rect.right - rect.left;
h = rect.bottom - rect.top;
/* Activate the correct context for the render target */ /* Activate the correct context for the render target */
context = context_acquire(device, This); context = context_acquire(device, This);
...@@ -1762,7 +1773,7 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, ...@@ -1762,7 +1773,7 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This,
context_set_draw_buffer(context, device->offscreenBuffer); context_set_draw_buffer(context, device->offscreenBuffer);
} }
glRasterPos3i(This->lockedRect.left, This->lockedRect.top, 1); glRasterPos3i(rect.left, rect.top, 1);
checkGLcall("glRasterPos3i"); checkGLcall("glRasterPos3i");
/* Some drivers(radeon dri, others?) don't like exceptions during /* Some drivers(radeon dri, others?) don't like exceptions during
...@@ -1789,19 +1800,8 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, ...@@ -1789,19 +1800,8 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This,
checkGLcall("glBindBufferARB"); checkGLcall("glBindBufferARB");
} }
/* When the surface is locked we only have to refresh the locked part else we need to update the whole image */ glDrawPixels(w, h, fmt, type, mem);
if(This->Flags & SFLAG_LOCKED) { checkGLcall("glDrawPixels");
glDrawPixels(This->lockedRect.right - This->lockedRect.left,
(This->lockedRect.bottom - This->lockedRect.top)-1,
fmt, type,
mem + bpp * This->lockedRect.left + pitch * This->lockedRect.top);
checkGLcall("glDrawPixels");
} else {
glDrawPixels(This->currentDesc.Width,
This->currentDesc.Height,
fmt, type, mem);
checkGLcall("glDrawPixels");
}
if(This->Flags & SFLAG_PBO) { if(This->Flags & SFLAG_PBO) {
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0));
......
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