Bug 987010 - Fix the way that the presence of an alpha channel on a canvas drawing buffer is propagated - r=jrmuizel
This commit is contained in:
@@ -4255,6 +4255,7 @@ CanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
|
||||
data.mSize = nsIntSize(mWidth, mHeight);
|
||||
data.mHasAlpha = !mOpaque;
|
||||
|
||||
canvasLayer->Initialize(data);
|
||||
uint32_t flags = mOpaque ? Layer::CONTENT_OPAQUE : 0;
|
||||
|
||||
@@ -893,6 +893,7 @@ WebGLContext::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
|
||||
CanvasLayer::Data data;
|
||||
data.mGLContext = gl;
|
||||
data.mSize = nsIntSize(mWidth, mHeight);
|
||||
data.mHasAlpha = gl->Caps().alpha;
|
||||
data.mIsGLAlphaPremult = IsPremultAlpha();
|
||||
|
||||
canvasLayer->Initialize(data);
|
||||
|
||||
@@ -1869,6 +1869,7 @@ public:
|
||||
, mStream(nullptr)
|
||||
, mTexID(0)
|
||||
, mSize(0,0)
|
||||
, mHasAlpha(false)
|
||||
, mIsGLAlphaPremult(false)
|
||||
{ }
|
||||
|
||||
@@ -1885,6 +1886,9 @@ public:
|
||||
// The size of the canvas content
|
||||
nsIntSize mSize;
|
||||
|
||||
// Whether the canvas drawingbuffer has an alpha channel.
|
||||
bool mHasAlpha;
|
||||
|
||||
// Whether mGLContext contains data that is alpha-premultiplied.
|
||||
bool mIsGLAlphaPremult;
|
||||
};
|
||||
|
||||
@@ -55,11 +55,14 @@ ClientCanvasLayer::Initialize(const Data& aData)
|
||||
if (mGLContext) {
|
||||
GLScreenBuffer* screen = mGLContext->Screen();
|
||||
|
||||
SurfaceCaps caps = screen->Caps();
|
||||
SurfaceCaps caps;
|
||||
if (mStream) {
|
||||
// The screen caps are irrelevant if we're using a separate stream
|
||||
caps = GetContentFlags() & CONTENT_OPAQUE ? SurfaceCaps::ForRGB() : SurfaceCaps::ForRGBA();
|
||||
caps = aData.mHasAlpha ? SurfaceCaps::ForRGBA() : SurfaceCaps::ForRGB();
|
||||
} else {
|
||||
caps = screen->Caps();
|
||||
}
|
||||
MOZ_ASSERT(caps.alpha == aData.mHasAlpha);
|
||||
|
||||
SurfaceStreamType streamType =
|
||||
SurfaceStream::ChooseGLStreamType(SurfaceStream::OffMainThread,
|
||||
|
||||
Reference in New Issue
Block a user