Bug 952977: Use gfx::Matrix in ipdl r=nical
authorDavid Zbarsky <dzbarsky@gmail.com>
Thu, 26 Dec 2013 13:06:53 -0500
changeset 161795 4ce43cb764d51b7c7907e6db85848afe22b16f77
parent 161794 d706ebf6e5b14efb2e69df6dfb223ffa81976721
child 161796 b04bd18e5692e4f86815b6d0652c3843069784d7
push id37986
push userdzbarsky@gmail.com
push dateThu, 26 Dec 2013 18:07:19 +0000
treeherdermozilla-inbound@4a2a444ec574 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs952977
milestone29.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 952977: Use gfx::Matrix in ipdl r=nical
content/canvas/public/DocumentRendererChild.h
content/canvas/src/DocumentRendererChild.cpp
dom/ipc/PBrowser.ipdl
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
gfx/ipc/GfxMessageUtils.h
--- a/content/canvas/public/DocumentRendererChild.h
+++ b/content/canvas/public/DocumentRendererChild.h
@@ -14,21 +14,21 @@ class nsIDOMWindow;
 namespace mozilla {
 namespace ipc {
 
 class DocumentRendererChild : public PDocumentRendererChild
 {
 public:
     DocumentRendererChild();
     virtual ~DocumentRendererChild();
-    
+
     bool RenderDocument(nsIDOMWindow *window,
-                        const nsRect& documentRect, const gfxMatrix& transform,
+                        const nsRect& documentRect, const gfx::Matrix& transform,
                         const nsString& bgcolor,
-                        uint32_t renderFlags, bool flushLayout, 
+                        uint32_t renderFlags, bool flushLayout,
                         const nsIntSize& renderSize, nsCString& data);
 
 private:
 
     DISALLOW_EVIL_CONSTRUCTORS(DocumentRendererChild);
 };
 
 }
--- a/content/canvas/src/DocumentRendererChild.cpp
+++ b/content/canvas/src/DocumentRendererChild.cpp
@@ -1,48 +1,51 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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 "nsPIDOMWindow.h"
 #include "nsIDOMWindow.h"
 #include "nsIDocShell.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsCSSParser.h"
 #include "nsPresContext.h"
 #include "nsCOMPtr.h"
 #include "nsColor.h"
 #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::ipc;
 
 DocumentRendererChild::DocumentRendererChild()
 {}
 
 DocumentRendererChild::~DocumentRendererChild()
 {}
 
 bool
 DocumentRendererChild::RenderDocument(nsIDOMWindow *window,
                                       const nsRect& documentRect,
-                                      const gfxMatrix& transform,
+                                      const mozilla::gfx::Matrix& transform,
                                       const nsString& aBGColor,
                                       uint32_t renderFlags,
-                                      bool flushLayout, 
+                                      bool flushLayout,
                                       const nsIntSize& renderSize,
                                       nsCString& data)
 {
     if (flushLayout)
         nsContentUtils::FlushLayoutForTree(window);
 
     nsCOMPtr<nsPresContext> presContext;
     nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(window);
@@ -70,15 +73,15 @@ DocumentRendererChild::RenderDocument(ns
     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,
                             gfxImageFormatARGB32);
     nsRefPtr<gfxContext> ctx = new gfxContext(surf);
-    ctx->SetMatrix(transform);
+    ctx->SetMatrix(mozilla::gfx::ThebesMatrix(transform));
 
     nsCOMPtr<nsIPresShell> shell = presContext->PresShell();
     shell->RenderDocument(documentRect, renderFlags, bgColor, ctx);
 
     return true;
 }
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -14,17 +14,17 @@ include protocol PRenderFrame;
 include protocol POfflineCacheUpdate;
 include protocol PIndexedDB;
 include DOMTypes;
 include JavaScriptTypes;
 include URIParams;
 
 
 using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h";
-using struct gfxMatrix from "gfxMatrix.h";
+using struct mozilla::gfx::Matrix from "mozilla/gfx/Matrix.h";
 using struct gfxSize from "gfxPoint.h";
 using CSSRect from "Units.h";
 using struct mozilla::layers::FrameMetrics from "FrameMetrics.h";
 using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
 using FrameMetrics::ViewID from "FrameMetrics.h";
 using mozilla::layout::ScrollingBehavior from "mozilla/layout/RenderFrameUtils.h";
 using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
 using mozilla::WindowsHandle from "ipc/IPCMessageUtils.h";
@@ -418,17 +418,17 @@ child:
      *
      * |documentRect| is the area of the remote document to draw,
      * transformed by |transform|.  The rendered area will have the
      * default background color |bgcolor|.  |renderFlags| are the
      * nsIPresShell::RenderDocument() flags to use on the remote side,
      * and if true, |flushLayout| will do just that before rendering
      * the document.  The rendered image will be of size |renderSize|.
      */
-    PDocumentRenderer(nsRect documentRect, gfxMatrix transform,
+    PDocumentRenderer(nsRect documentRect, Matrix transform,
                       nsString bgcolor,
                       uint32_t renderFlags, bool flushLayout,
                       nsIntSize renderSize);
 
     /**
      * Sent by the chrome process when it no longer wants this remote
      * <browser>.  The child side cleans up in response, then
      * finalizing its death by sending back __delete__() to the
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -67,16 +67,17 @@
 #include "PCOMContentPermissionRequestChild.h"
 #include "PuppetWidget.h"
 #include "StructuredCloneUtils.h"
 #include "nsViewportInfo.h"
 #include "JavaScriptChild.h"
 #include "APZCCallbackHelper.h"
 #include "nsILoadContext.h"
 #include "ipc/nsGUIEventIPC.h"
+#include "mozilla/gfx/Matrix.h"
 
 #ifdef DEBUG
 #include "PCOMContentPermissionRequestChild.h"
 #endif /* DEBUG */
 
 #define BROWSER_ELEMENT_CHILD_SCRIPT \
     NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js")
 
@@ -1976,17 +1977,17 @@ TabChild::DispatchWidgetEvent(WidgetGUIE
   event.widget = mWidget;
   NS_ENSURE_SUCCESS(mWidget->DispatchEvent(&event, status),
                     nsEventStatus_eConsumeNoDefault);
   return status;
 }
 
 PDocumentRendererChild*
 TabChild::AllocPDocumentRendererChild(const nsRect& documentRect,
-                                      const gfxMatrix& transform,
+                                      const mozilla::gfx::Matrix& transform,
                                       const nsString& bgcolor,
                                       const uint32_t& renderFlags,
                                       const bool& flushLayout,
                                       const nsIntSize& renderSize)
 {
     return new DocumentRendererChild();
 }
 
@@ -1995,17 +1996,17 @@ TabChild::DeallocPDocumentRendererChild(
 {
     delete actor;
     return true;
 }
 
 bool
 TabChild::RecvPDocumentRendererConstructor(PDocumentRendererChild* actor,
                                            const nsRect& documentRect,
-                                           const gfxMatrix& transform,
+                                           const mozilla::gfx::Matrix& transform,
                                            const nsString& bgcolor,
                                            const uint32_t& renderFlags,
                                            const bool& flushLayout,
                                            const nsIntSize& renderSize)
 {
     DocumentRendererChild *render = static_cast<DocumentRendererChild *>(actor);
 
     nsCOMPtr<nsIWebBrowser> browser = do_QueryInterface(mWebNav);
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -249,24 +249,24 @@ public:
     virtual bool RecvActivateFrameEvent(const nsString& aType, const bool& capture);
     virtual bool RecvLoadRemoteScript(const nsString& aURL, const bool& aRunInGlobalScope);
     virtual bool RecvAsyncMessage(const nsString& aMessage,
                                   const ClonedMessageData& aData,
                                   const InfallibleTArray<CpowEntry>& aCpows,
                                   const IPC::Principal& aPrincipal) MOZ_OVERRIDE;
 
     virtual PDocumentRendererChild*
-    AllocPDocumentRendererChild(const nsRect& documentRect, const gfxMatrix& transform,
+    AllocPDocumentRendererChild(const nsRect& documentRect, const gfx::Matrix& transform,
                                 const nsString& bgcolor,
                                 const uint32_t& renderFlags, const bool& flushLayout,
                                 const nsIntSize& renderSize);
     virtual bool DeallocPDocumentRendererChild(PDocumentRendererChild* actor);
     virtual bool RecvPDocumentRendererConstructor(PDocumentRendererChild* actor,
                                                   const nsRect& documentRect,
-                                                  const gfxMatrix& transform,
+                                                  const gfx::Matrix& transform,
                                                   const nsString& bgcolor,
                                                   const uint32_t& renderFlags,
                                                   const bool& flushLayout,
                                                   const nsIntSize& renderSize);
 
     virtual PContentDialogChild* AllocPContentDialogChild(const uint32_t&,
                                                           const nsCString&,
                                                           const nsCString&,
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -574,17 +574,17 @@ TabParent::SetDocShell(nsIDocShell *aDoc
 {
   NS_ENSURE_ARG(aDocShell);
   NS_WARNING("No mDocShell member in TabParent so there is no docShell to set");
   return NS_OK;
 }
 
 PDocumentRendererParent*
 TabParent::AllocPDocumentRendererParent(const nsRect& documentRect,
-                                        const gfxMatrix& transform,
+                                        const gfx::Matrix& transform,
                                         const nsString& bgcolor,
                                         const uint32_t& renderFlags,
                                         const bool& flushLayout,
                                         const nsIntSize& renderSize)
 {
     return new DocumentRendererParent();
 }
 
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -216,17 +216,17 @@ public:
     bool SendRealKeyEvent(mozilla::WidgetKeyboardEvent& event);
     bool SendRealTouchEvent(WidgetTouchEvent& event);
     bool SendHandleSingleTap(const CSSIntPoint& aPoint);
     bool SendHandleLongTap(const CSSIntPoint& aPoint);
     bool SendHandleLongTapUp(const CSSIntPoint& aPoint);
     bool SendHandleDoubleTap(const CSSIntPoint& aPoint);
 
     virtual PDocumentRendererParent*
-    AllocPDocumentRendererParent(const nsRect& documentRect, const gfxMatrix& transform,
+    AllocPDocumentRendererParent(const nsRect& documentRect, const gfx::Matrix& transform,
                                  const nsString& bgcolor,
                                  const uint32_t& renderFlags, const bool& flushLayout,
                                  const nsIntSize& renderSize);
     virtual bool DeallocPDocumentRendererParent(PDocumentRendererParent* actor);
 
     virtual PContentPermissionRequestParent*
     AllocPContentPermissionRequestParent(const nsCString& aType, const nsCString& aAccess, const IPC::Principal& aPrincipal);
     virtual bool DeallocPContentPermissionRequestParent(PContentPermissionRequestParent* actor);
--- a/gfx/ipc/GfxMessageUtils.h
+++ b/gfx/ipc/GfxMessageUtils.h
@@ -10,17 +10,17 @@
 #include "base/process_util.h"
 #include "chrome/common/ipc_message_utils.h"
 #include "ipc/IPCMessageUtils.h"
 
 #include <stdint.h>
 
 #include "gfx3DMatrix.h"
 #include "gfxColor.h"
-#include "gfxMatrix.h"
+#include "mozilla/gfx/Matrix.h"
 #include "GraphicsFilter.h"
 #include "gfxPoint.h"
 #include "gfxRect.h"
 #include "nsRect.h"
 #include "nsRegion.h"
 #include "gfxTypes.h"
 #include "mozilla/layers/LayersTypes.h"
 #include "mozilla/layers/CompositorTypes.h"
@@ -41,47 +41,47 @@ typedef ::GraphicsFilter GraphicsFilterT
 typedef GraphicsFilter::Enum GraphicsFilterType;
 #endif
 
 } // namespace mozilla
 
 namespace IPC {
 
 template<>
-struct ParamTraits<gfxMatrix>
+struct ParamTraits<mozilla::gfx::Matrix>
 {
-  typedef gfxMatrix paramType;
+  typedef mozilla::gfx::Matrix paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
-    WriteParam(aMsg, aParam.xx);
-    WriteParam(aMsg, aParam.xy);
-    WriteParam(aMsg, aParam.yx);
-    WriteParam(aMsg, aParam.yy);
-    WriteParam(aMsg, aParam.x0);
-    WriteParam(aMsg, aParam.y0);
+    WriteParam(aMsg, aParam._11);
+    WriteParam(aMsg, aParam._12);
+    WriteParam(aMsg, aParam._21);
+    WriteParam(aMsg, aParam._22);
+    WriteParam(aMsg, aParam._31);
+    WriteParam(aMsg, aParam._32);
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
-    if (ReadParam(aMsg, aIter, &aResult->xx) &&
-        ReadParam(aMsg, aIter, &aResult->xy) &&
-        ReadParam(aMsg, aIter, &aResult->yx) &&
-        ReadParam(aMsg, aIter, &aResult->yy) &&
-        ReadParam(aMsg, aIter, &aResult->x0) &&
-        ReadParam(aMsg, aIter, &aResult->y0))
+    if (ReadParam(aMsg, aIter, &aResult->_11) &&
+        ReadParam(aMsg, aIter, &aResult->_12) &&
+        ReadParam(aMsg, aIter, &aResult->_21) &&
+        ReadParam(aMsg, aIter, &aResult->_22) &&
+        ReadParam(aMsg, aIter, &aResult->_31) &&
+        ReadParam(aMsg, aIter, &aResult->_32))
       return true;
 
     return false;
   }
 
   static void Log(const paramType& aParam, std::wstring* aLog)
   {
-    aLog->append(StringPrintf(L"[[%g %g] [%g %g] [%g %g]]", aParam.xx, aParam.xy, aParam.yx, aParam.yy,
-	  						    aParam.x0, aParam.y0));
+    aLog->append(StringPrintf(L"[[%g %g] [%g %g] [%g %g]]", aParam._11, aParam._12, aParam._21, aParam._22,
+                                                            aParam._31, aParam._32));
   }
 };
 
 template<>
 struct ParamTraits<gfxPoint>
 {
   typedef gfxPoint paramType;