Stefan Dösinger : wined3d: Only swap system memory resources of front and back buffer if they have the same size .
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Jun 14 07:47:03 CDT 2007
Module: wine
Branch: master
Commit: 43fda1f4f0d4b88003b2ac1ff092aa9ba8783b95
URL: http://source.winehq.org/git/wine.git/?a=commit;h=43fda1f4f0d4b88003b2ac1ff092aa9ba8783b95
Author: Stefan Dösinger <stefandoesinger at gmx.at>
Date: Mon May 28 21:21:43 2007 +0200
wined3d: Only swap system memory resources of front and back buffer if they have the same size.
---
dlls/wined3d/swapchain.c | 85 ++++++++++++++++++++++++---------------------
1 files changed, 45 insertions(+), 40 deletions(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 18d9b3d..262eb7f 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -321,52 +321,57 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
BOOL frontuptodate = front->Flags & SFLAG_INSYSMEM;
BOOL backuptodate = back->Flags & SFLAG_INSYSMEM;
- /* Flip the DC */
- {
- HDC tmp;
- tmp = front->hDC;
- front->hDC = back->hDC;
- back->hDC = tmp;
- }
+ if(front->resource.size == back->resource.size) {
+ /* Flip the DC */
+ {
+ HDC tmp;
+ tmp = front->hDC;
+ front->hDC = back->hDC;
+ back->hDC = tmp;
+ }
- /* Flip the DIBsection */
- {
- HBITMAP tmp;
- BOOL hasDib = front->Flags & SFLAG_DIBSECTION;
- tmp = front->dib.DIBsection;
- front->dib.DIBsection = back->dib.DIBsection;
- back->dib.DIBsection = tmp;
-
- if(back->Flags & SFLAG_DIBSECTION) front->Flags |= SFLAG_DIBSECTION;
- else front->Flags &= ~SFLAG_DIBSECTION;
- if(hasDib) back->Flags |= SFLAG_DIBSECTION;
- else back->Flags &= ~SFLAG_DIBSECTION;
- }
+ /* Flip the DIBsection */
+ {
+ HBITMAP tmp;
+ BOOL hasDib = front->Flags & SFLAG_DIBSECTION;
+ tmp = front->dib.DIBsection;
+ front->dib.DIBsection = back->dib.DIBsection;
+ back->dib.DIBsection = tmp;
+
+ if(back->Flags & SFLAG_DIBSECTION) front->Flags |= SFLAG_DIBSECTION;
+ else front->Flags &= ~SFLAG_DIBSECTION;
+ if(hasDib) back->Flags |= SFLAG_DIBSECTION;
+ else back->Flags &= ~SFLAG_DIBSECTION;
+ }
- /* Flip the surface data */
- {
- void* tmp;
+ /* Flip the surface data */
+ {
+ void* tmp;
- tmp = front->dib.bitmap_data;
- front->dib.bitmap_data = back->dib.bitmap_data;
- back->dib.bitmap_data = tmp;
+ tmp = front->dib.bitmap_data;
+ front->dib.bitmap_data = back->dib.bitmap_data;
+ back->dib.bitmap_data = tmp;
- tmp = front->resource.allocatedMemory;
- front->resource.allocatedMemory = back->resource.allocatedMemory;
- back->resource.allocatedMemory = tmp;
- }
+ tmp = front->resource.allocatedMemory;
+ front->resource.allocatedMemory = back->resource.allocatedMemory;
+ back->resource.allocatedMemory = tmp;
+ }
- /* client_memory should not be different, but just in case */
- {
- BOOL tmp;
- tmp = front->dib.client_memory;
- front->dib.client_memory = back->dib.client_memory;
- back->dib.client_memory = tmp;
+ /* client_memory should not be different, but just in case */
+ {
+ BOOL tmp;
+ tmp = front->dib.client_memory;
+ front->dib.client_memory = back->dib.client_memory;
+ back->dib.client_memory = tmp;
+ }
+ if(frontuptodate) back->Flags |= SFLAG_INSYSMEM;
+ else back->Flags &= ~SFLAG_INSYSMEM;
+ if(backuptodate) front->Flags |= SFLAG_INSYSMEM;
+ else front->Flags &= ~SFLAG_INSYSMEM;
+ } else {
+ back->Flags &= ~SFLAG_INSYSMEM;
+ front->Flags &= ~SFLAG_INSYSMEM;
}
- if(frontuptodate) back->Flags |= SFLAG_INSYSMEM;
- else back->Flags &= ~SFLAG_INSYSMEM;
- if(backuptodate) front->Flags |= SFLAG_INSYSMEM;
- else front->Flags &= ~SFLAG_INSYSMEM;
}
TRACE("returning\n");
More information about the wine-cvs
mailing list