wined3d: Use surface_is_offscreen() in read_from_framebuffer_texture().

This commit is contained in:
Henri Verbeet 2009-12-15 17:51:34 +01:00 committed by Alexandre Julliard
parent 51438eec46
commit bf113bd284
1 changed files with 5 additions and 6 deletions

View File

@ -1172,7 +1172,6 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb) static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
{ {
IWineD3DDeviceImpl *device = This->resource.device; IWineD3DDeviceImpl *device = This->resource.device;
IWineD3DSwapChainImpl *swapchain;
struct wined3d_context *context; struct wined3d_context *context;
int bpp; int bpp;
GLenum format, internal, type; GLenum format, internal, type;
@ -1197,18 +1196,18 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
* There is no need to keep track of the current read buffer or reset it, every part of the code * There is no need to keep track of the current read buffer or reset it, every part of the code
* that reads sets the read buffer as desired. * that reads sets the read buffer as desired.
*/ */
if (SUCCEEDED(IWineD3DSurface_GetContainer((IWineD3DSurface *)This, &IID_IWineD3DSwapChain, (void **)&swapchain))) if (!surface_is_offscreen((IWineD3DSurface *)This))
{ {
GLenum buffer = surface_get_gl_buffer((IWineD3DSurface *) This, (IWineD3DSwapChain *)swapchain); GLenum buffer = surface_get_gl_buffer((IWineD3DSurface *)This, (IWineD3DSwapChain *)This->container);
TRACE("Locking %#x buffer\n", buffer); TRACE("Locking %#x buffer\n", buffer);
ENTER_GL(); ENTER_GL();
glReadBuffer(buffer); glReadBuffer(buffer);
checkGLcall("glReadBuffer"); checkGLcall("glReadBuffer");
LEAVE_GL(); LEAVE_GL();
}
IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain); else
} else { {
/* Locking the primary render target which is not on a swapchain(=offscreen render target). /* Locking the primary render target which is not on a swapchain(=offscreen render target).
* Read from the back buffer * Read from the back buffer
*/ */