mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 589978 - [D3D9] 2D canvas layers always have premultiplied alpha. r=bas, a=beta5+
This commit is contained in:
parent
2bfe332d33
commit
5407e8a286
@ -58,11 +58,12 @@ CanvasLayerD3D9::Initialize(const Data& aData)
|
||||
NS_ASSERTION(aData.mGLContext == nsnull,
|
||||
"CanvasLayer can't have both surface and GLContext");
|
||||
mNeedsYFlip = PR_FALSE;
|
||||
mDataIsPremultiplied = PR_TRUE;
|
||||
} else if (aData.mGLContext) {
|
||||
NS_ASSERTION(aData.mGLContext->IsOffscreen(), "canvas gl context isn't offscreen");
|
||||
mGLContext = aData.mGLContext;
|
||||
mCanvasFramebuffer = mGLContext->GetOffscreenFBO();
|
||||
mGLBufferIsPremultiplied = aData.mGLBufferIsPremultiplied;
|
||||
mDataIsPremultiplied = aData.mGLBufferIsPremultiplied;
|
||||
mNeedsYFlip = PR_TRUE;
|
||||
} else {
|
||||
NS_ERROR("CanvasLayer created without mSurface or mGLContext?");
|
||||
@ -240,13 +241,13 @@ CanvasLayerD3D9::RenderLayer()
|
||||
|
||||
mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBLAYER);
|
||||
|
||||
if (!mGLBufferIsPremultiplied) {
|
||||
if (!mDataIsPremultiplied) {
|
||||
device()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
||||
device()->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
|
||||
}
|
||||
device()->SetTexture(0, mTexture);
|
||||
device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
if (!mGLBufferIsPremultiplied) {
|
||||
if (!mDataIsPremultiplied) {
|
||||
device()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
|
||||
device()->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, FALSE);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
: CanvasLayer(aManager, NULL),
|
||||
LayerD3D9(aManager),
|
||||
mTexture(0),
|
||||
mGLBufferIsPremultiplied(PR_FALSE),
|
||||
mDataIsPremultiplied(PR_FALSE),
|
||||
mNeedsYFlip(PR_FALSE)
|
||||
{
|
||||
mImplData = static_cast<LayerD3D9*>(this);
|
||||
@ -83,7 +83,7 @@ protected:
|
||||
|
||||
nsIntRect mBounds;
|
||||
|
||||
PRPackedBool mGLBufferIsPremultiplied;
|
||||
PRPackedBool mDataIsPremultiplied;
|
||||
PRPackedBool mNeedsYFlip;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user