Bug 988862 - Treat DIRECT2D render mode as GDI when drawing directly to the window through BasicLayers. r=jrmuizel, a=sledru.
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 10 Apr 2014 10:43:41 -0400
changeset 191665 1bbff43878e79ed9f174f063b4960431121aa4fc
parent 191664 3228aeb355eef858cd5eeb0a568bff97eb39d6a7
child 191666 80b2bb3b69cf19ab294249ad298a6d14be48ba28
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel, sledru
bugs988862
milestone30.0a2
Bug 988862 - Treat DIRECT2D render mode as GDI when drawing directly to the window through BasicLayers. r=jrmuizel, a=sledru.
widget/windows/nsWindowGfx.cpp
--- a/widget/windows/nsWindowGfx.cpp
+++ b/widget/windows/nsWindowGfx.cpp
@@ -260,19 +260,17 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t
   {
     debugPaintFlashRegion = ::CreateRectRgn(0, 0, 0, 0);
     ::GetUpdateRgn(mWnd, debugPaintFlashRegion, TRUE);
     debugPaintFlashDC = ::GetDC(mWnd);
   }
 #endif // WIDGET_DEBUG_OUTPUT
 
   HDC hDC = aDC ? aDC : (::BeginPaint(mWnd, &ps));
-  if (!IsRenderMode(gfxWindowsPlatform::RENDER_DIRECT2D)) {
-    mPaintDC = hDC;
-  }
+  mPaintDC = hDC;
 
 #ifdef MOZ_XUL
   bool forceRepaint = aDC || (eTransparencyTransparent == mTransparencyMode);
 #else
   bool forceRepaint = nullptr != aDC;
 #endif
   nsIntRegion region = GetRegionToPaint(forceRepaint, ps, hDC);
 
@@ -378,31 +376,20 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t
               gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(targetSurface,
                                                                      mozilla::gfx::IntSize(paintRect.right - paintRect.left,
                                                                                            paintRect.bottom - paintRect.top));
             thebesContext = new gfxContext(dt);
           } else {
             thebesContext = new gfxContext(targetSurface);
           }
 
-          if (IsRenderMode(gfxWindowsPlatform::RENDER_DIRECT2D)) {
-            const nsIntRect* r;
-            for (nsIntRegionRectIterator iter(region);
-                 (r = iter.Next()) != nullptr;) {
-              thebesContext->Rectangle(gfxRect(r->x, r->y, r->width, r->height), true);
-            }
-            thebesContext->Clip();
-            thebesContext->SetOperator(gfxContext::OPERATOR_CLEAR);
-            thebesContext->Paint();
-            thebesContext->SetOperator(gfxContext::OPERATOR_OVER);
-          }
-
           // don't need to double buffer with anything but GDI
           BufferMode doubleBuffering = mozilla::layers::BufferMode::BUFFER_NONE;
-          if (IsRenderMode(gfxWindowsPlatform::RENDER_GDI)) {
+          if (IsRenderMode(gfxWindowsPlatform::RENDER_GDI) ||
+              IsRenderMode(gfxWindowsPlatform::RENDER_DIRECT2D)) {
 #ifdef MOZ_XUL
             switch (mTransparencyMode) {
               case eTransparencyGlass:
               case eTransparencyBorderlessGlass:
               default:
                 // If we're not doing translucency, then double buffer
                 doubleBuffering = mozilla::layers::BufferMode::BUFFERED;
                 break;