diff --git a/gfx/thebes/GLContextProviderCGL.mm b/gfx/thebes/GLContextProviderCGL.mm index e709215eb8e8..908a977fdc9c 100644 --- a/gfx/thebes/GLContextProviderCGL.mm +++ b/gfx/thebes/GLContextProviderCGL.mm @@ -278,6 +278,10 @@ GLContextCGL::ResizeOffscreen(const gfxIntSize& aNewSize) return false; } + if (!ResizeOffscreenFBO(aNewSize, false)) { + return false; + } + [mPBuffer release]; mPBuffer = pb; @@ -293,7 +297,7 @@ GLContextCGL::ResizeOffscreen(const gfxIntSize& aNewSize) return true; } - return ResizeOffscreenFBO(aNewSize); + return ResizeOffscreenFBO(aNewSize, true); } class TextureImageCGL : public BasicTextureImage @@ -532,8 +536,7 @@ CreateOffscreenPBufferContext(const gfxIntSize& aSize, } static already_AddRefed -CreateOffscreenFBOContext(const gfxIntSize& aSize, - const ContextFormat& aFormat, +CreateOffscreenFBOContext(const ContextFormat& aFormat, bool aShare = true) { if (!sCGLLibrary.EnsureInitialized()) { @@ -561,15 +564,19 @@ already_AddRefed GLContextProviderCGL::CreateOffscreen(const gfxIntSize& aSize, const ContextFormat& aFormat) { + ContextFormat actualFormat(aFormat); + actualFormat.samples = 0; + nsRefPtr glContext; NS_ENSURE_TRUE(Preferences::GetRootBranch(), nsnull); const bool preferFBOs = Preferences::GetBool("cgl.prefer-fbo", false); if (!preferFBOs) { - glContext = CreateOffscreenPBufferContext(aSize, aFormat); + glContext = CreateOffscreenPBufferContext(aSize, actualFormat); if (glContext && - glContext->Init()) + glContext->Init() && + glContext->ResizeOffscreenFBO(aSize, false)) { glContext->mOffscreenSize = aSize; glContext->mOffscreenActualSize = aSize; @@ -581,10 +588,10 @@ GLContextProviderCGL::CreateOffscreen(const gfxIntSize& aSize, } // try a FBO as second choice - glContext = CreateOffscreenFBOContext(aSize, aFormat); + glContext = CreateOffscreenFBOContext(actualFormat); if (glContext && glContext->Init() && - glContext->ResizeOffscreenFBO(aSize)) + glContext->ResizeOffscreenFBO(aSize, true)) { return glContext.forget(); } @@ -613,8 +620,7 @@ GLContextProviderCGL::GetGlobalContext() // than 16x16 in size; also 16x16 is POT so that we can do // a FBO with it on older video cards. A FBO context for // sharing is preferred since it has no associated target. - gGlobalContext = CreateOffscreenFBOContext(gfxIntSize(16, 16), - ContextFormat(ContextFormat::BasicRGB24), + gGlobalContext = CreateOffscreenFBOContext(ContextFormat(ContextFormat::BasicRGB24), false); if (!gGlobalContext || !static_cast(gGlobalContext.get())->Init()) { NS_WARNING("Couldn't init gGlobalContext.");