Bug 1360511 - Move SVGDrawingParameters to a header file to allow it to be shared. r=longsonr
authorJonathan Watt <jwatt@jwatt.org>
Tue, 18 Apr 2017 12:46:19 +0100
changeset 356351 69ceb4c8dbb84e0e9c1a0869eb60499681aca92d
parent 356350 fd8a7fa66ebd344525a8812354d09bb7fa191f2b
child 356352 657e214ca5280eb8b626b230864125389d25459d
push id89877
push userjwatt@jwatt.org
push dateWed, 03 May 2017 23:13:50 +0000
treeherdermozilla-inbound@13b354344cf7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslongsonr
bugs1360511
milestone55.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 1360511 - Move SVGDrawingParameters to a header file to allow it to be shared. r=longsonr MozReview-Commit-ID: I1EU0AlLLHU
image/SVGDrawingParameters.h
image/VectorImage.cpp
new file mode 100644
--- /dev/null
+++ b/image/SVGDrawingParameters.h
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* 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/. */
+
+#ifndef mozilla_image_SVGDrawingParameters_h
+#define mozilla_image_SVGDrawingParameters_h
+
+#include "gfxContext.h"
+#include "gfxTypes.h"
+#include "ImageRegion.h"
+#include "mozilla/gfx/Point.h"
+#include "mozilla/gfx/Types.h"
+#include "mozilla/Maybe.h"
+#include "nsSize.h"
+#include "SVGImageContext.h"
+
+namespace mozilla {
+namespace image {
+
+struct SVGDrawingParameters
+{
+  typedef mozilla::gfx::IntSize IntSize;
+  typedef mozilla::gfx::SamplingFilter SamplingFilter;
+
+  SVGDrawingParameters(gfxContext* aContext,
+                       const nsIntSize& aSize,
+                       const ImageRegion& aRegion,
+                       SamplingFilter aSamplingFilter,
+                       const Maybe<SVGImageContext>& aSVGContext,
+                       float aAnimationTime,
+                       uint32_t aFlags,
+                       float aOpacity)
+    : context(aContext)
+    , size(aSize.width, aSize.height)
+    , region(aRegion)
+    , samplingFilter(aSamplingFilter)
+    , svgContext(aSVGContext)
+    , viewportSize(aSize)
+    , animationTime(aAnimationTime)
+    , flags(aFlags)
+    , opacity(aOpacity)
+  {
+    if (aSVGContext) {
+      auto sz = aSVGContext->GetViewportSize();
+      if (sz) {
+        viewportSize = nsIntSize(sz->width, sz->height); // XXX losing unit
+      }
+    }
+  }
+
+  gfxContext*                   context;
+  IntSize                       size;
+  ImageRegion                   region;
+  SamplingFilter                samplingFilter;
+  const Maybe<SVGImageContext>& svgContext;
+  nsIntSize                     viewportSize;
+  float                         animationTime;
+  uint32_t                      flags;
+  gfxFloat                      opacity;
+};
+
+} // namespace image
+} // namespace mozilla
+
+#endif // mozilla_image_SVGDrawingParameters_h
+
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -26,16 +26,17 @@
 #include "nsStubDocumentObserver.h"
 #include "nsSVGEffects.h" // for nsSVGRenderingObserver
 #include "nsWindowMemoryReporter.h"
 #include "ImageRegion.h"
 #include "ISurfaceProvider.h"
 #include "LookupResult.h"
 #include "Orientation.h"
 #include "SVGDocumentWrapper.h"
+#include "SVGDrawingParameters.h"
 #include "nsIDOMEventListener.h"
 #include "SurfaceCache.h"
 #include "nsDocument.h"
 
 // undef the GetCurrentTime macro defined in WinBase.h from the MS Platform SDK
 #undef GetCurrentTime
 
 namespace mozilla {
@@ -770,55 +771,16 @@ VectorImage::IsImageContainerAvailable(L
 
 //******************************************************************************
 NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
 VectorImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags)
 {
   return nullptr;
 }
 
-struct SVGDrawingParameters
-{
-  SVGDrawingParameters(gfxContext* aContext,
-                       const nsIntSize& aSize,
-                       const ImageRegion& aRegion,
-                       SamplingFilter aSamplingFilter,
-                       const Maybe<SVGImageContext>& aSVGContext,
-                       float aAnimationTime,
-                       uint32_t aFlags,
-                       float aOpacity)
-    : context(aContext)
-    , size(aSize.width, aSize.height)
-    , region(aRegion)
-    , samplingFilter(aSamplingFilter)
-    , svgContext(aSVGContext)
-    , viewportSize(aSize)
-    , animationTime(aAnimationTime)
-    , flags(aFlags)
-    , opacity(aOpacity)
-  {
-    if (aSVGContext) {
-      auto sz = aSVGContext->GetViewportSize();
-      if (sz) {
-        viewportSize = nsIntSize(sz->width, sz->height); // XXX losing unit
-      }
-    }
-  }
-
-  gfxContext*                   context;
-  IntSize                       size;
-  ImageRegion                   region;
-  SamplingFilter                samplingFilter;
-  const Maybe<SVGImageContext>& svgContext;
-  nsIntSize                     viewportSize;
-  float                         animationTime;
-  uint32_t                      flags;
-  gfxFloat                      opacity;
-};
-
 //******************************************************************************
 NS_IMETHODIMP_(DrawResult)
 VectorImage::Draw(gfxContext* aContext,
                   const nsIntSize& aSize,
                   const ImageRegion& aRegion,
                   uint32_t aWhichFrame,
                   SamplingFilter aSamplingFilter,
                   const Maybe<SVGImageContext>& aSVGContext,