Bug 589097 - [D3D9] Incorrect alpha blending on canvas layers. r=bas, a=beta5+

This commit is contained in:
Matt Woodrow 2010-08-23 20:57:22 -07:00
Родитель 2b98b97a13
Коммит 5655e68bc6
2 изменённых файлов: 5 добавлений и 0 удалений

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

@ -242,11 +242,13 @@ CanvasLayerD3D9::RenderLayer()
if (!mGLBufferIsPremultiplied) { if (!mGLBufferIsPremultiplied) {
device()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); device()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
device()->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
} }
device()->SetTexture(0, mTexture); device()->SetTexture(0, mTexture);
device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
if (!mGLBufferIsPremultiplied) { if (!mGLBufferIsPremultiplied) {
device()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); device()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
device()->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, FALSE);
} }
} }

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

@ -402,6 +402,9 @@ DeviceManagerD3D9::SetupRenderState()
mDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); mDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
mDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); mDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
mDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE); mDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
mDevice->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ONE);
mDevice->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_INVSRCALPHA);
mDevice->SetRenderState(D3DRS_BLENDOPALPHA, D3DBLENDOP_ADD);
mDevice->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP); mDevice->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
mDevice->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP); mDevice->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
mDevice->SetSamplerState(1, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP); mDevice->SetSamplerState(1, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);