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:44:08 -0400
changeset 183697 f5622633b23f
parent 183696 32d5b6ea4a64
child 183698 cdc64366d3f8
child 183700 b1e9827af66f
push id3450
push usermconley@mozilla.com
push date2014-04-10 14:45 +0000
treeherdermozilla-beta@f5622633b23f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel, sledru
bugs988862
milestone29.0
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
@@ -255,19 +255,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);
 
@@ -373,31 +371,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;