From 8f604d659655bcb535a25b965fffddbc10da5079 Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Tue, 11 Feb 2014 21:54:02 +0100 Subject: [PATCH] Bug 805406: Never draw directly to a window with Direct2D. r=jrmuizel --- widget/windows/nsWindow.cpp | 49 ++++++------------------------------- 1 file changed, 8 insertions(+), 41 deletions(-) diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 1544492f2490..f29699fdddaf 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -3351,26 +3351,11 @@ gfxASurface *nsWindow::GetThebesSurface() if (mPaintDC) return (new gfxWindowsSurface(mPaintDC)); -#ifdef CAIRO_HAS_D2D_SURFACE - if (gfxWindowsPlatform::GetPlatform()->GetRenderMode() == - gfxWindowsPlatform::RENDER_DIRECT2D) { - gfxContentType content = gfxContentType::COLOR; -#if defined(MOZ_XUL) - if (mTransparencyMode != eTransparencyOpaque) { - content = gfxContentType::COLOR_ALPHA; - } -#endif - return (new gfxD2DSurface(mWnd, content)); - } else { -#endif - uint32_t flags = gfxWindowsSurface::FLAG_TAKE_DC; - if (mTransparencyMode != eTransparencyOpaque) { - flags |= gfxWindowsSurface::FLAG_IS_TRANSPARENT; - } - return (new gfxWindowsSurface(mWnd, flags)); -#ifdef CAIRO_HAS_D2D_SURFACE + uint32_t flags = gfxWindowsSurface::FLAG_TAKE_DC; + if (mTransparencyMode != eTransparencyOpaque) { + flags |= gfxWindowsSurface::FLAG_IS_TRANSPARENT; } -#endif + return (new gfxWindowsSurface(mWnd, flags)); } /************************************************************** @@ -6751,21 +6736,10 @@ void nsWindow::ResizeTranslucentWindow(int32_t aNewWidth, int32_t aNewHeight, bo if (!force && aNewWidth == mBounds.width && aNewHeight == mBounds.height) return; -#ifdef CAIRO_HAS_D2D_SURFACE - if (gfxWindowsPlatform::GetPlatform()->GetRenderMode() == - gfxWindowsPlatform::RENDER_DIRECT2D) { - nsRefPtr newSurface = - new gfxD2DSurface(gfxIntSize(aNewWidth, aNewHeight), gfxImageFormat::ARGB32); - mTransparentSurface = newSurface; - mMemoryDC = nullptr; - } else -#endif - { - nsRefPtr newSurface = - new gfxWindowsSurface(gfxIntSize(aNewWidth, aNewHeight), gfxImageFormat::ARGB32); - mTransparentSurface = newSurface; - mMemoryDC = newSurface->GetDC(); - } + nsRefPtr newSurface = + new gfxWindowsSurface(gfxIntSize(aNewWidth, aNewHeight), gfxImageFormat::ARGB32); + mTransparentSurface = newSurface; + mMemoryDC = newSurface->GetDC(); } void nsWindow::SetWindowTranslucencyInner(nsTransparencyMode aMode) @@ -6857,13 +6831,6 @@ nsresult nsWindow::UpdateTranslucentWindow() RECT winRect; ::GetWindowRect(hWnd, &winRect); -#ifdef CAIRO_HAS_D2D_SURFACE - if (gfxWindowsPlatform::GetPlatform()->GetRenderMode() == - gfxWindowsPlatform::RENDER_DIRECT2D) { - mMemoryDC = static_cast(mTransparentSurface.get())-> - GetDC(true); - } -#endif // perform the alpha blend bool updateSuccesful = ::UpdateLayeredWindow(hWnd, nullptr, (POINT*)&winRect, &winSize, mMemoryDC,