2009/5/26 Pavel Prochazka prochapa@inf.upol.cz:
+»······int i=1;
+»······/*it moves all backbuffers by 1 to left form id = 1, +»······the backbuffer swap to frontbuffer and frontbuffer swaps to the end of chain +»······Something like this: +»······»·······»·······»·······»·······»·······»·······»·······»·······»·······»·······------------^»··»······· +»······»·······»·······»·······»·······»·······»·······»·······»·······»·······»·······|»······»·······»·······| +»······|FrontBuffer| |BackBuffer0|BackBuffer1|Backbuffer2|....|BackbufferN| +»······ »····»·······»·······»·······»·······»·······»·······»·······»·······»·······»·······»·······»·······»·······»·······^ +»······»·······|---------------------------------------------------------------| +»······»·······^ +»······»·······|---------------------|
+»······»·······»·······»·······»·······»·······»·······»·······»·······»·······»······· +»······*/
+»······for(;i<This->presentParms.BackBufferCount-1;i++)· +»······{ +»······»·······hlp1 = (IWineD3DSurfaceImpl *)This->backBuffer[i]; +»······»·······hlp2 = (IWineD3DSurfaceImpl *)This->backBuffer[i+1]; +»······»·······hlp1->hDC = hlp2->hDC; +»······»·······hlp1->dib.DIBsection = hlp2->dib.DIBsection; +»······»·······hlp1->dib.bitmap_data = hlp2->dib.bitmap_data; +»······»·······hlp1->resource.allocatedMemory = hlp2->resource.allocatedMemory; +»······»·······hlp1->dib.client_memory = hlp2->dib.client_memory; +»······}
+»······hlp1 = (IWineD3DSurfaceImpl *)This->backBuffer[i]; +»······hlp1->hDC = front->hDC; +»······hlp1 = (IWineD3DSurfaceImpl *)This->backBuffer[i]; +»······hlp1->dib.DIBsection = front->dib.DIBsection; +»······hlp1->dib.bitmap_data = front->dib.bitmap_data; +»······hlp1->resource.allocatedMemory = front->resource.allocatedMemory; +»······hlp1->dib.client_memory = front->dib.client_memory; +»······ +···
Style issues aside, that's not a very efficient way to implement a swapchain.