diff --git a/gfx/layers/basic/BasicLayers.cpp b/gfx/layers/basic/BasicLayers.cpp index 004bff848e2..1ac88b7d3ee 100644 --- a/gfx/layers/basic/BasicLayers.cpp +++ b/gfx/layers/basic/BasicLayers.cpp @@ -910,6 +910,9 @@ BasicImageLayer::GetAndPaintCurrentImage(gfxContext* aContext, return nsnull; } + NS_ASSERTION(surface->GetContentType() != gfxASurface::CONTENT_ALPHA, + "Image layer has alpha image"); + nsRefPtr pat = new gfxPattern(surface); if (!pat) { return nsnull; diff --git a/gfx/layers/d3d10/ImageLayerD3D10.cpp b/gfx/layers/d3d10/ImageLayerD3D10.cpp index fb13993893e..34de24fb8fe 100644 --- a/gfx/layers/d3d10/ImageLayerD3D10.cpp +++ b/gfx/layers/d3d10/ImageLayerD3D10.cpp @@ -191,6 +191,10 @@ ImageLayerD3D10::RenderLayer() if (image->GetFormat() == Image::CAIRO_SURFACE || image->GetFormat() == Image::REMOTE_IMAGE_BITMAP || image->GetFormat() == Image::REMOTE_IMAGE_DXGI_TEXTURE) { + NS_ASSERTION(image->GetFormat() != Image::CAIRO_SURFACE || + !static_cast(image)->mSurface || + static_cast(image)->mSurface->GetContentType() != gfxASurface::CONTENT_ALPHA, + "Image layer has alpha image"); bool hasAlpha = false; nsRefPtr srView = GetImageSRView(image, hasAlpha, getter_AddRefs(keyedMutex)); diff --git a/gfx/layers/d3d9/ImageLayerD3D9.cpp b/gfx/layers/d3d9/ImageLayerD3D9.cpp index 96294e8335a..6e087d13b72 100644 --- a/gfx/layers/d3d9/ImageLayerD3D9.cpp +++ b/gfx/layers/d3d9/ImageLayerD3D9.cpp @@ -372,6 +372,11 @@ ImageLayerD3D9::RenderLayer() if (image->GetFormat() == Image::CAIRO_SURFACE || image->GetFormat() == Image::REMOTE_IMAGE_BITMAP) { + NS_ASSERTION(image->GetFormat() != Image::CAIRO_SURFACE || + !static_cast(image)->mSurface || + static_cast(image)->mSurface->GetContentType() != gfxASurface::CONTENT_ALPHA, + "Image layer has alpha image"); + bool hasAlpha = false; nsRefPtr texture = GetTexture(image, hasAlpha); diff --git a/gfx/layers/opengl/ImageLayerOGL.cpp b/gfx/layers/opengl/ImageLayerOGL.cpp index 315748649ce..176bc2e2acf 100644 --- a/gfx/layers/opengl/ImageLayerOGL.cpp +++ b/gfx/layers/opengl/ImageLayerOGL.cpp @@ -271,6 +271,9 @@ ImageLayerOGL::RenderLayer(int, return; } + NS_ASSERTION(cairoImage->mSurface->GetContentType() != gfxASurface::CONTENT_ALPHA, + "Image layer has alpha image"); + CairoOGLBackendData *data = static_cast(cairoImage->GetBackendData(LayerManager::LAYERS_OPENGL)); @@ -594,6 +597,9 @@ ImageLayerOGL::LoadAsTexture(GLuint aTextureUnit, gfxIntSize* aSize) cairoImage->GetBackendData(LayerManager::LAYERS_OPENGL)); if (!data) { + NS_ASSERTION(cairoImage->mSurface->GetContentType() == gfxASurface::CONTENT_ALPHA, + "OpenGL mask layers must be backed by alpha surfaces"); + // allocate a new texture and save the details in the backend data data = new CairoOGLBackendData; data->mTextureSize = CalculatePOTSize(cairoImage->mSize, gl()); @@ -775,6 +781,9 @@ ShadowImageLayerOGL::RenderLayer(int aPreviousFrameBuffer, mOGLManager->MakeCurrent(); if (mTexImage) { + NS_ASSERTION(mTexImage->GetContentType() != gfxASurface::CONTENT_ALPHA, + "Image layer has alpha image"); + ShaderProgramOGL *colorProgram = mOGLManager->GetProgram(mTexImage->GetShaderProgramType(), GetMaskLayer()); @@ -845,6 +854,9 @@ ShadowImageLayerOGL::LoadAsTexture(GLuint aTextureUnit, gfxIntSize* aSize) mTexImage->BindTextureAndApplyFilter(aTextureUnit); + NS_ASSERTION(mTexImage->GetContentType() == gfxASurface::CONTENT_ALPHA, + "OpenGL mask layers must be backed by alpha surfaces"); + // We're assuming that the gl backend won't cheat and use NPOT // textures when glContext says it can't (which seems to happen // on a mac when you force POT textures)