Bug 988793 - Make DocumentRendererChild::RenderDocument use Moz2D. r=mattwoodrow
authorJonathan Watt <jwatt@jwatt.org>
Mon, 31 Mar 2014 12:52:33 +0100
changeset 176210 42985e47d68b622694c13fac634ea5bc158bd3c6
parent 176209 c4b3048f7ad4d1b267dc06455073886e8716897d
child 176211 97ea4b50ee3afab49452e3a0fa76401d9f79518d
push id41703
push userjwatt@jwatt.org
push dateMon, 31 Mar 2014 11:54:20 +0000
treeherdermozilla-inbound@fe53a01dab3d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs988793
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 988793 - Make DocumentRendererChild::RenderDocument use Moz2D. r=mattwoodrow
content/canvas/src/DocumentRendererChild.cpp
--- a/content/canvas/src/DocumentRendererChild.cpp
+++ b/content/canvas/src/DocumentRendererChild.cpp
@@ -2,18 +2,19 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/ipc/DocumentRendererChild.h"
 
 #include "base/basictypes.h"
 
 #include "gfx2DGlue.h"
-#include "gfxImageSurface.h"
 #include "gfxPattern.h"
+#include "mozilla/gfx/2D.h"
+#include "mozilla/RefPtr.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMWindow.h"
 #include "nsIDocShell.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsCSSParser.h"
 #include "nsPresContext.h"
 #include "nsCOMPtr.h"
@@ -21,16 +22,17 @@
 #include "gfxContext.h"
 #include "nsLayoutUtils.h"
 #include "nsContentUtils.h"
 #include "nsCSSValue.h"
 #include "nsRuleNode.h"
 #include "mozilla/gfx/Matrix.h"
 
 using namespace mozilla;
+using namespace mozilla::gfx;
 using namespace mozilla::ipc;
 
 DocumentRendererChild::DocumentRendererChild()
 {}
 
 DocumentRendererChild::~DocumentRendererChild()
 {}
 
@@ -67,21 +69,22 @@ DocumentRendererChild::RenderDocument(ns
     nscolor bgColor;
     if (!nsRuleNode::ComputeColor(bgColorValue, presContext, nullptr, bgColor)) {
         return false;
     }
 
     // Draw directly into the output array.
     data.SetLength(renderSize.width * renderSize.height * 4);
 
-    nsRefPtr<gfxImageSurface> surf =
-        new gfxImageSurface(reinterpret_cast<uint8_t*>(data.BeginWriting()),
-                            gfxIntSize(renderSize.width, renderSize.height),
-                            4 * renderSize.width,
-                            gfxImageFormat::ARGB32);
-    nsRefPtr<gfxContext> ctx = new gfxContext(surf);
+    RefPtr<DrawTarget> dt =
+        Factory::CreateDrawTargetForData(BackendType::CAIRO,
+                                         reinterpret_cast<uint8_t*>(data.BeginWriting()),
+                                         IntSize(renderSize.width, renderSize.height),
+                                         4 * renderSize.width,
+                                         SurfaceFormat::B8G8R8A8);
+    nsRefPtr<gfxContext> ctx = new gfxContext(dt);
     ctx->SetMatrix(mozilla::gfx::ThebesMatrix(transform));
 
     nsCOMPtr<nsIPresShell> shell = presContext->PresShell();
     shell->RenderDocument(documentRect, renderFlags, bgColor, ctx);
 
     return true;
 }