diff --git a/gfx/layers/Compositor.h b/gfx/layers/Compositor.h index 7f148973f125..4386d66852b9 100644 --- a/gfx/layers/Compositor.h +++ b/gfx/layers/Compositor.h @@ -125,8 +125,7 @@ class CompositingRenderTarget; enum SurfaceInitMode { INIT_MODE_NONE, - INIT_MODE_CLEAR, - INIT_MODE_COPY + INIT_MODE_CLEAR }; /** diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp index a263b055377b..442f0a60b856 100644 --- a/gfx/layers/basic/BasicCompositor.cpp +++ b/gfx/layers/basic/BasicCompositor.cpp @@ -250,7 +250,6 @@ void BasicCompositor::Destroy() TemporaryRef BasicCompositor::CreateRenderTarget(const IntRect& aRect, SurfaceInitMode aInit) { - MOZ_ASSERT(aInit != INIT_MODE_COPY); RefPtr target = mDrawTarget->CreateSimilarDrawTarget(aRect.Size(), FORMAT_B8G8R8A8); RefPtr rt = new BasicCompositingRenderTarget(target, aRect.Size()); diff --git a/gfx/layers/composite/ContainerLayerComposite.cpp b/gfx/layers/composite/ContainerLayerComposite.cpp index 8bdbd855343f..3171643be794 100644 --- a/gfx/layers/composite/ContainerLayerComposite.cpp +++ b/gfx/layers/composite/ContainerLayerComposite.cpp @@ -131,9 +131,7 @@ ContainerRender(ContainerT* aContainer, // not safe. if (HasOpaqueAncestorLayer(aContainer) && transform3D.Is2D(&transform) && !transform.HasNonIntegerTranslation()) { - mode = gfxPlatform::ComponentAlphaEnabled() ? - INIT_MODE_COPY : INIT_MODE_CLEAR; - surfaceCopyNeeded = (mode == INIT_MODE_COPY); + surfaceCopyNeeded = gfxPlatform::ComponentAlphaEnabled(); surfaceRect.x += transform.x0; surfaceRect.y += transform.y0; aContainer->mSupportsComponentAlphaChildren diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index 55f3f1306ae5..d8f835783fd6 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -659,7 +659,7 @@ CompositorOGL::CreateRenderTarget(const IntRect &aRect, SurfaceInitMode aInit) { GLuint tex = 0; GLuint fbo = 0; - CreateFBOWithTexture(aRect, aInit, 0, &fbo, &tex); + CreateFBOWithTexture(aRect, false, 0, &fbo, &tex); RefPtr surface = new CompositingRenderTargetOGL(this, tex, fbo); surface->Initialize(IntSize(aRect.width, aRect.height), mFBOTextureTarget, aInit); @@ -675,10 +675,10 @@ CompositorOGL::CreateRenderTargetFromSource(const IntRect &aRect, const CompositingRenderTargetOGL* sourceSurface = static_cast(aSource); if (aSource) { - CreateFBOWithTexture(aRect, INIT_MODE_COPY, sourceSurface->GetFBO(), + CreateFBOWithTexture(aRect, true, sourceSurface->GetFBO(), &fbo, &tex); } else { - CreateFBOWithTexture(aRect, INIT_MODE_COPY, 0, + CreateFBOWithTexture(aRect, true, 0, &fbo, &tex); } @@ -686,7 +686,7 @@ CompositorOGL::CreateRenderTargetFromSource(const IntRect &aRect, = new CompositingRenderTargetOGL(this, tex, fbo); surface->Initialize(IntSize(aRect.width, aRect.height), mFBOTextureTarget, - INIT_MODE_COPY); + INIT_MODE_NONE); return surface.forget(); } @@ -841,7 +841,7 @@ CompositorOGL::BeginFrame(const Rect *aClipRectIn, const gfxMatrix& aTransform, } void -CompositorOGL::CreateFBOWithTexture(const IntRect& aRect, SurfaceInitMode aInit, +CompositorOGL::CreateFBOWithTexture(const IntRect& aRect, bool aCopyFromSource, GLuint aSourceFrameBuffer, GLuint *aFBO, GLuint *aTexture) { @@ -851,7 +851,7 @@ CompositorOGL::CreateFBOWithTexture(const IntRect& aRect, SurfaceInitMode aInit, mGLContext->fGenTextures(1, &tex); mGLContext->fBindTexture(mFBOTextureTarget, tex); - if (aInit == INIT_MODE_COPY) { + if (aCopyFromSource) { GLuint curFBO = mCurrentRenderTarget->GetFBO(); if (curFBO != aSourceFrameBuffer) { mGLContext->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, aSourceFrameBuffer); diff --git a/gfx/layers/opengl/CompositorOGL.h b/gfx/layers/opengl/CompositorOGL.h index c5c98a17ba38..be1ace30e4c5 100644 --- a/gfx/layers/opengl/CompositorOGL.h +++ b/gfx/layers/opengl/CompositorOGL.h @@ -274,7 +274,7 @@ private: * shaders are required to sample from the different * texture types. */ - void CreateFBOWithTexture(const gfx::IntRect& aRect, SurfaceInitMode aInit, + void CreateFBOWithTexture(const gfx::IntRect& aRect, bool aCopyFromSource, GLuint aSourceFrameBuffer, GLuint *aFBO, GLuint *aTexture);