Henri Verbeet : wined3d: Do not use "lockedRect" unless the surface is locked in flush_to_framebuffer_drawpixels().
Alexandre Julliard
julliard at winehq.org
Tue Nov 2 11:11:00 CDT 2010
Module: wine
Branch: master
Commit: 3f0d16c5bf9094897857c3366979b2b4a513aaa2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3f0d16c5bf9094897857c3366979b2b4a513aaa2
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Tue Nov 2 12:02:48 2010 +0100
wined3d: Do not use "lockedRect" unless the surface is locked in flush_to_framebuffer_drawpixels().
---
dlls/wined3d/surface.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 20a656c..5ac4881 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1741,6 +1741,17 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This,
IWineD3DDeviceImpl *device = This->resource.device;
const struct wined3d_gl_info *gl_info;
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 */
context = context_acquire(device, This);
@@ -1762,7 +1773,7 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This,
context_set_draw_buffer(context, device->offscreenBuffer);
}
- glRasterPos3i(This->lockedRect.left, This->lockedRect.top, 1);
+ glRasterPos3i(rect.left, rect.top, 1);
checkGLcall("glRasterPos3i");
/* Some drivers(radeon dri, others?) don't like exceptions during
@@ -1789,19 +1800,8 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This,
checkGLcall("glBindBufferARB");
}
- /* When the surface is locked we only have to refresh the locked part else we need to update the whole image */
- if(This->Flags & SFLAG_LOCKED) {
- 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");
- }
+ glDrawPixels(w, h, fmt, type, mem);
+ checkGLcall("glDrawPixels");
if(This->Flags & SFLAG_PBO) {
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0));
More information about the wine-cvs
mailing list