From 27bf4c3747ab76deab63506d254e2372d4ae79d5 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 29 Oct 2010 12:25:19 +0200 Subject: [PATCH] wined3d: Remove some redundant state save/restore code from flush_to_framebuffer_drawpixels(). --- dlls/wined3d/surface.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 3f08155bc6a..3a18f9e863d 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1734,10 +1734,9 @@ lock_end: return IWineD3DBaseSurfaceImpl_Map(iface, pLockedRect, pRect, Flags); } -static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, GLenum fmt, GLenum type, UINT bpp, const BYTE *mem) { - GLint prev_store; - GLint prev_rasterpos[4]; - GLint skipBytes = 0; +static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, + GLenum fmt, GLenum type, UINT bpp, const BYTE *mem) +{ UINT pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *) This); /* target is argb, 4 byte */ IWineD3DDeviceImpl *device = This->resource.device; const struct wined3d_gl_info *gl_info; @@ -1763,15 +1762,6 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, GLenum fm context_set_draw_buffer(context, device->offscreenBuffer); } - glGetIntegerv(GL_PACK_SWAP_BYTES, &prev_store); - checkGLcall("glGetIntegerv"); - glGetIntegerv(GL_CURRENT_RASTER_POSITION, &prev_rasterpos[0]); - checkGLcall("glGetIntegerv"); - - /* If not fullscreen, we need to skip a number of bytes to find the next row of data */ - glGetIntegerv(GL_UNPACK_ROW_LENGTH, &skipBytes); - glPixelStorei(GL_UNPACK_ROW_LENGTH, This->currentDesc.Width); - glRasterPos3i(This->lockedRect.left, This->lockedRect.top, 1); checkGLcall("glRasterPos3i"); @@ -1791,6 +1781,9 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, GLenum fm read = This->resource.allocatedMemory[0]; } + /* If not fullscreen, we need to skip a number of bytes to find the next row of data */ + glPixelStorei(GL_UNPACK_ROW_LENGTH, This->currentDesc.Width); + if(This->Flags & SFLAG_PBO) { GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo)); checkGLcall("glBindBufferARB"); @@ -1815,12 +1808,8 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, GLenum fm checkGLcall("glBindBufferARB"); } - glRasterPos3iv(&prev_rasterpos[0]); - checkGLcall("glRasterPos3iv"); - - /* Reset to previous pack row length */ - glPixelStorei(GL_UNPACK_ROW_LENGTH, skipBytes); - checkGLcall("glPixelStorei(GL_UNPACK_ROW_LENGTH)"); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + checkGLcall("glPixelStorei(GL_UNPACK_ROW_LENGTH, 0)"); LEAVE_GL(); context_release(context);