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