Bug 1303570 - Part 2: When using Cairo use gfxWindowsSurfaces when creating surfaces in ContentClientBasic. r=jrmuizel
authorBas Schouten <bschouten@mozilla.com>
Tue, 27 Sep 2016 11:29:10 +0200
changeset 315780 f21ffbf119bd6d7084309123be42f97743f1f7e5
parent 315779 0963e4f0247107ded32c61eaf889a5b61170303e
child 315781 d46155cc719e323b61da814f4db8e2e3bc07c9e3
push id20634
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:10:13 +0000
treeherderfx-team@afe79b010d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1303570
milestone52.0a1
Bug 1303570 - Part 2: When using Cairo use gfxWindowsSurfaces when creating surfaces in ContentClientBasic. r=jrmuizel MozReview-Commit-ID: Bf4vdtiXNf3
gfx/layers/client/ContentClient.cpp
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -127,19 +127,33 @@ ContentClientBasic::CreateBuffer(Content
                                  RefPtr<gfx::DrawTarget>* aBlackDT,
                                  RefPtr<gfx::DrawTarget>* aWhiteDT)
 {
   MOZ_ASSERT(!(aFlags & BUFFER_COMPONENT_ALPHA));
   if (aFlags & BUFFER_COMPONENT_ALPHA) {
     gfxDevCrash(LogReason::AlphaWithBasicClient) << "Asking basic content client for component alpha";
   }
 
+  IntSize size(aRect.width, aRect.height);
+#ifdef XP_WIN
+  if (mBackend == BackendType::CAIRO && 
+      (aType == gfxContentType::COLOR || aType == gfxContentType::COLOR_ALPHA)) {
+    RefPtr<gfxASurface> surf =
+      new gfxWindowsSurface(size, aType == gfxContentType::COLOR ? gfxImageFormat::X8R8G8B8_UINT32 :
+                                                                   gfxImageFormat::A8R8G8B8_UINT32);
+    *aBlackDT = gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(surf, size);
+
+    if (*aBlackDT) {
+      return;
+    }
+  }
+#endif
+
   *aBlackDT = gfxPlatform::GetPlatform()->CreateDrawTargetForBackend(
-    mBackend,
-    IntSize(aRect.width, aRect.height),
+    mBackend, size,
     gfxPlatform::GetPlatform()->Optimal2DFormatForContent(aType));
 }
 
 void
 ContentClientRemoteBuffer::DestroyBuffers()
 {
   if (!mTextureClient) {
     return;