Bug 743393: Reset scissorrect when clearing surfaces. r=jrmuizel

This commit is contained in:
Bas Schouten 2012-04-11 18:17:40 +02:00
parent a25be3f8c2
commit b926862954
2 changed files with 9 additions and 33 deletions

View File

@ -365,36 +365,6 @@ ThebesLayerD3D10::VerifyContentType(SurfaceMode aMode)
}
}
void
ThebesLayerD3D10::SetupDualViewports(const gfxIntSize &aSize)
{
D3D10_VIEWPORT viewport;
viewport.MaxDepth = 1.0f;
viewport.MinDepth = 0;
viewport.Width = aSize.width;
viewport.Height = aSize.height;
viewport.TopLeftX = 0;
viewport.TopLeftY = 0;
D3D10_VIEWPORT vps[2] = { viewport, viewport };
device()->RSSetViewports(2, vps);
gfx3DMatrix projection;
/*
* Matrix to transform to viewport space ( <-1.0, 1.0> topleft,
* <1.0, -1.0> bottomright)
*/
projection._11 = 2.0f / aSize.width;
projection._22 = -2.0f / aSize.height;
projection._33 = 0.0f;
projection._41 = -1.0f;
projection._42 = 1.0f;
projection._44 = 1.0f;
effect()->GetVariableByName("mProjection")->
SetRawValue(&projection._11, 0, 64);
}
void
ThebesLayerD3D10::FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsIntPoint& aOffset)
{
@ -410,13 +380,20 @@ ThebesLayerD3D10::FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsInt
device()->CreateRenderTargetView(mTexture, NULL, getter_AddRefs(viewBlack));
device()->CreateRenderTargetView(mTextureOnWhite, NULL, getter_AddRefs(viewWhite));
D3D10_RECT oldScissor;
UINT numRects = 1;
device()->RSGetScissorRects(&numRects, &oldScissor);
D3D10_TEXTURE2D_DESC desc;
mTexture->GetDesc(&desc);
D3D10_RECT scissor = { 0, 0, desc.Width, desc.Height };
device()->RSSetScissorRects(1, &scissor);
mD3DManager->SetupInputAssembler();
nsIntSize oldVP = mD3DManager->GetViewport();
SetupDualViewports(gfxIntSize(desc.Width, desc.Height));
mD3DManager->SetViewport(nsIntSize(desc.Width, desc.Height));
ID3D10RenderTargetView *views[2] = { viewBlack, viewWhite };
device()->OMSetRenderTargets(2, views, NULL);
@ -448,6 +425,7 @@ ThebesLayerD3D10::FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsInt
views[0] = oldRT;
device()->OMSetRenderTargets(1, views, NULL);
mD3DManager->SetViewport(oldVP);
device()->RSSetScissorRects(1, &oldScissor);
}
}

View File

@ -97,8 +97,6 @@ private:
/* Create a new texture */
void CreateNewTextures(const gfxIntSize &aSize, SurfaceMode aMode);
void SetupDualViewports(const gfxIntSize &aSize);
// Fill textures with opaque black and white in the specified region.
void FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsIntPoint& aOffset);