Bug 625043: Properly save and restore old clip rect. r=jrmuizel a=blocking-final

This commit is contained in:
Bas Schouten 2011-01-24 19:57:19 +01:00
Родитель bb9b6faeb6
Коммит 17a7cc5fec
1 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -169,10 +169,12 @@ ContainerLayerD3D9::RenderLayer()
nsRefPtr<IDirect3DSurface9> previousRenderTarget; nsRefPtr<IDirect3DSurface9> previousRenderTarget;
nsRefPtr<IDirect3DTexture9> renderTexture; nsRefPtr<IDirect3DTexture9> renderTexture;
float previousRenderTargetOffset[4]; float previousRenderTargetOffset[4];
RECT oldClipRect; RECT containerClipRect;
float renderTargetOffset[] = { 0, 0, 0, 0 }; float renderTargetOffset[] = { 0, 0, 0, 0 };
float oldViewMatrix[4][4]; float oldViewMatrix[4][4];
device()->GetScissorRect(&containerClipRect);
nsIntRect visibleRect = mVisibleRegion.GetBounds(); nsIntRect visibleRect = mVisibleRegion.GetBounds();
PRBool useIntermediate = UseIntermediateSurface(); PRBool useIntermediate = UseIntermediateSurface();
@ -259,7 +261,6 @@ ContainerLayerD3D9::RenderLayer()
if (clipRect || useIntermediate) { if (clipRect || useIntermediate) {
RECT r; RECT r;
device()->GetScissorRect(&oldClipRect);
if (clipRect) { if (clipRect) {
r.left = (LONG)(clipRect->x - renderTargetOffset[0]); r.left = (LONG)(clipRect->x - renderTargetOffset[0]);
r.top = (LONG)(clipRect->y - renderTargetOffset[1]); r.top = (LONG)(clipRect->y - renderTargetOffset[1]);
@ -299,10 +300,10 @@ ContainerLayerD3D9::RenderLayer()
} }
} }
// Intersect with current clip rect. // Intersect with current clip rect.
r.left = NS_MAX<PRInt32>(oldClipRect.left, r.left); r.left = NS_MAX<PRInt32>(containerClipRect.left, r.left);
r.right = NS_MIN<PRInt32>(oldClipRect.right, r.right); r.right = NS_MIN<PRInt32>(containerClipRect.right, r.right);
r.top = NS_MAX<PRInt32>(oldClipRect.top, r.top); r.top = NS_MAX<PRInt32>(containerClipRect.top, r.top);
r.bottom = NS_MIN<PRInt32>(oldClipRect.bottom, r.bottom); r.bottom = NS_MIN<PRInt32>(containerClipRect.bottom, r.bottom);
} else { } else {
// > 0 is implied during the intersection when useIntermediate == true; // > 0 is implied during the intersection when useIntermediate == true;
r.left = NS_MAX<LONG>(0, r.left); r.left = NS_MAX<LONG>(0, r.left);
@ -315,10 +316,6 @@ ContainerLayerD3D9::RenderLayer()
} }
layerToRender->RenderLayer(); layerToRender->RenderLayer();
if (clipRect || useIntermediate) {
device()->SetScissorRect(&oldClipRect);
}
} }
if (useIntermediate) { if (useIntermediate) {
@ -337,8 +334,11 @@ ContainerLayerD3D9::RenderLayer()
mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER); mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER);
device()->SetScissorRect(&containerClipRect);
device()->SetTexture(0, renderTexture); device()->SetTexture(0, renderTexture);
device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
} else {
device()->SetScissorRect(&containerClipRect);
} }
} }