mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1006198 - Use Moz2D for WebGL snapshot readback. r=jgilbert
This commit is contained in:
parent
dbc26acf88
commit
3f0708c419
@ -1337,10 +1337,10 @@ WebGLContext::GetSurfaceSnapshot(bool* aPremultAlpha)
|
|||||||
if (!gl)
|
if (!gl)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
nsRefPtr<gfxImageSurface> surf = new gfxImageSurface(gfxIntSize(mWidth, mHeight),
|
RefPtr<DataSourceSurface> surf = Factory::CreateDataSourceSurfaceWithStride(IntSize(mWidth, mHeight),
|
||||||
gfxImageFormat::ARGB32,
|
SurfaceFormat::B8G8R8A8,
|
||||||
mWidth * 4, 0, false);
|
mWidth * 4);
|
||||||
if (surf->CairoStatus() != 0) {
|
if (!surf) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1348,7 +1348,7 @@ WebGLContext::GetSurfaceSnapshot(bool* aPremultAlpha)
|
|||||||
{
|
{
|
||||||
ScopedBindFramebuffer autoFB(gl, 0);
|
ScopedBindFramebuffer autoFB(gl, 0);
|
||||||
ClearBackbufferIfNeeded();
|
ClearBackbufferIfNeeded();
|
||||||
ReadPixelsIntoImageSurface(gl, surf);
|
ReadPixelsIntoDataSurface(gl, surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aPremultAlpha) {
|
if (aPremultAlpha) {
|
||||||
@ -1359,8 +1359,7 @@ WebGLContext::GetSurfaceSnapshot(bool* aPremultAlpha)
|
|||||||
if (aPremultAlpha) {
|
if (aPremultAlpha) {
|
||||||
*aPremultAlpha = false;
|
*aPremultAlpha = false;
|
||||||
} else {
|
} else {
|
||||||
gfxUtils::PremultiplyImageSurface(surf);
|
gfxUtils::PremultiplyDataSurface(surf);
|
||||||
surf->MarkDirty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1373,14 +1372,12 @@ WebGLContext::GetSurfaceSnapshot(bool* aPremultAlpha)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<SourceSurface> source = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(dt, surf);
|
|
||||||
|
|
||||||
Matrix m;
|
Matrix m;
|
||||||
m.Translate(0.0, mHeight);
|
m.Translate(0.0, mHeight);
|
||||||
m.Scale(1.0, -1.0);
|
m.Scale(1.0, -1.0);
|
||||||
dt->SetTransform(m);
|
dt->SetTransform(m);
|
||||||
|
|
||||||
dt->DrawSurface(source,
|
dt->DrawSurface(surf,
|
||||||
Rect(0, 0, mWidth, mHeight),
|
Rect(0, 0, mWidth, mHeight),
|
||||||
Rect(0, 0, mWidth, mHeight),
|
Rect(0, 0, mWidth, mHeight),
|
||||||
DrawSurfaceOptions(),
|
DrawSurfaceOptions(),
|
||||||
|
Loading…
Reference in New Issue
Block a user