Bug 1158120 - Replace nsIntSize by mozilla::gfx::IntSize in gfx/thebes. r=nical
authorAmanda Sambath <amanda.sambath@phelma.grenoble-inp.fr>
Thu, 28 May 2015 15:00:17 +0200
changeset 277331 b66e5680a70d8d3697c5b12754c438ea250bec26
parent 277330 4f7379cd9ddd067fed8dcfbd9666f7145c3c5a7b
child 277332 ff36a419222a50e3b534aaae9a39a2e273228c5f
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1158120
milestone41.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 1158120 - Replace nsIntSize by mozilla::gfx::IntSize in gfx/thebes. r=nical
gfx/thebes/gfxASurface.cpp
gfx/thebes/gfxASurface.h
gfx/thebes/gfxGdkNativeRenderer.cpp
gfx/thebes/gfxGdkNativeRenderer.h
gfx/thebes/gfxPoint.h
gfx/thebes/gfxQtNativeRenderer.cpp
gfx/thebes/gfxQtNativeRenderer.h
gfx/thebes/gfxXlibNativeRenderer.cpp
--- a/gfx/thebes/gfxASurface.cpp
+++ b/gfx/thebes/gfxASurface.cpp
@@ -318,17 +318,17 @@ void
 gfxASurface::Finish()
 {
     // null surfaces are allowed here
     cairo_surface_finish(mSurface);
 }
 
 already_AddRefed<gfxASurface>
 gfxASurface::CreateSimilarSurface(gfxContentType aContent,
-                                  const nsIntSize& aSize)
+                                  const IntSize& aSize)
 {
     if (!mSurface || !mSurfaceValid) {
       return nullptr;
     }
     
     cairo_surface_t *surface =
         cairo_surface_create_similar(mSurface, cairo_content_t(int(aContent)),
                                      aSize.width, aSize.height);
@@ -354,17 +354,17 @@ gfxASurface::GetAsReadableARGB32ImageSur
 
 already_AddRefed<gfxImageSurface>
 gfxASurface::CopyToARGB32ImageSurface()
 {
     if (!mSurface || !mSurfaceValid) {
       return nullptr;
     }
 
-    const nsIntSize size = GetSize();
+    const IntSize size = GetSize();
     nsRefPtr<gfxImageSurface> imgSurface =
         new gfxImageSurface(size, gfxImageFormat::ARGB32);
 
     RefPtr<DrawTarget> dt = gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(imgSurface, IntSize(size.width, size.height));
     RefPtr<SourceSurface> source = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(dt, this);
 
     dt->CopySurface(source, IntRect(0, 0, size.width, size.height), IntPoint());
 
@@ -377,17 +377,17 @@ gfxASurface::CairoStatus()
     if (!mSurfaceValid)
         return -1;
 
     return cairo_surface_status(mSurface);
 }
 
 /* static */
 bool
-gfxASurface::CheckSurfaceSize(const nsIntSize& sz, int32_t limit)
+gfxASurface::CheckSurfaceSize(const IntSize& sz, int32_t limit)
 {
     if (sz.width < 0 || sz.height < 0) {
         NS_WARNING("Surface width or height < 0!");
         return false;
     }
 
     // reject images with sides bigger than limit
     if (limit && (sz.width > limit || sz.height > limit)) {
@@ -697,19 +697,19 @@ gfxASurface::SetOpaqueRect(const gfxRect
 
 /* static */const gfxRect&
 gfxASurface::GetEmptyOpaqueRect()
 {
   static const gfxRect empty(0, 0, 0, 0);
   return empty;
 }
 
-const nsIntSize
+const IntSize
 gfxASurface::GetSize() const
 {
-  return nsIntSize(-1, -1);
+  return IntSize(-1, -1);
 }
 
 already_AddRefed<gfxImageSurface>
 gfxASurface::GetAsImageSurface()
 {
   return nullptr;
 }
--- a/gfx/thebes/gfxASurface.h
+++ b/gfx/thebes/gfxASurface.h
@@ -85,17 +85,17 @@ public:
     virtual void Finish();
 
     /**
      * Create an offscreen surface that can be efficiently copied into
      * this surface (at least if tiling is not involved).
      * Returns null on error.
      */
     virtual already_AddRefed<gfxASurface> CreateSimilarSurface(gfxContentType aType,
-                                                               const nsIntSize& aSize);
+                                                               const mozilla::gfx::IntSize& aSize);
 
     /**
      * Returns an image surface for this surface, or nullptr if not supported.
      * This will not copy image data, just wraps an image surface around
      * pixel data already available in memory.
      */
     virtual already_AddRefed<gfxImageSurface> GetAsImageSurface();
 
@@ -113,17 +113,17 @@ public:
     already_AddRefed<gfxImageSurface> CopyToARGB32ImageSurface();
 
     int CairoStatus();
 
     /* Make sure that the given dimensions don't overflow a 32-bit signed int
      * using 4 bytes per pixel; optionally, make sure that either dimension
      * doesn't exceed the given limit.
      */
-    static bool CheckSurfaceSize(const nsIntSize& sz, int32_t limit = 0);
+    static bool CheckSurfaceSize(const mozilla::gfx::IntSize& sz, int32_t limit = 0);
 
     /* Provide a stride value that will respect all alignment requirements of
      * the accelerated image-rendering code.
      */
     static int32_t FormatStrideForWidth(gfxImageFormat format, int32_t width);
 
     static gfxContentType ContentFromFormat(gfxImageFormat format);
 
@@ -162,17 +162,17 @@ public:
     /**
      * Where does this surface's memory live?  By default, we say it's in this
      * process's heap.
      */
     virtual gfxMemoryLocation GetMemoryLocation() const;
 
     static int32_t BytePerPixelFromFormat(gfxImageFormat format);
 
-    virtual const nsIntSize GetSize() const;
+    virtual const mozilla::gfx::IntSize GetSize() const;
 
     void SetOpaqueRect(const gfxRect& aRect);
 
     const gfxRect& GetOpaqueRect() {
         if (!!mOpaqueRect)
             return *mOpaqueRect;
         return GetEmptyOpaqueRect();
     }
@@ -223,15 +223,15 @@ class gfxUnknownSurface : public gfxASur
 public:
     gfxUnknownSurface(cairo_surface_t *surf, const mozilla::gfx::IntSize& aSize)
         : mSize(aSize)
     {
         Init(surf, true);
     }
 
     virtual ~gfxUnknownSurface() { }
-    virtual const nsIntSize GetSize() const override { return mSize; }
+    virtual const mozilla::gfx::IntSize GetSize() const override { return mSize; }
 
 private:
-    nsIntSize mSize;
+    mozilla::gfx::IntSize mSize;
 };
 
 #endif /* GFX_ASURFACE_H */
--- a/gfx/thebes/gfxGdkNativeRenderer.cpp
+++ b/gfx/thebes/gfxGdkNativeRenderer.cpp
@@ -44,17 +44,17 @@ gfxGdkNativeRenderer::DrawWithXlib(cairo
         clipRect.height = clipRects[0].height;
     }
 
     return DrawWithGDK(drawable, offset.x, offset.y,
                        numClipRects ? &clipRect : nullptr, numClipRects);
 }
 
 void
-gfxGdkNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
+gfxGdkNativeRenderer::Draw(gfxContext* ctx, mozilla::gfx::IntSize size,
                            uint32_t flags, GdkColormap* colormap)
 {
     mColormap = colormap;
 
     Visual* visual =
         gdk_x11_visual_get_xvisual(gdk_colormap_get_visual(colormap));
     Screen* screen =
         gdk_x11_screen_get_xscreen(gdk_colormap_get_screen(colormap));
--- a/gfx/thebes/gfxGdkNativeRenderer.h
+++ b/gfx/thebes/gfxGdkNativeRenderer.h
@@ -63,17 +63,17 @@ public:
 
     /**
      * @param flags see above
      * @param bounds Draw()'s drawing is guaranteed to be restricted to
      * the rectangle (offset.x,offset.y,bounds.width,bounds.height)
      * @param dpy a display to use for the drawing if ctx doesn't have one
      */
 #if (MOZ_WIDGET_GTK == 2)
-    void Draw(gfxContext* ctx, nsIntSize size,
+    void Draw(gfxContext* ctx, mozilla::gfx::IntSize size,
               uint32_t flags, GdkColormap* colormap);
 #endif
 
 private:
 #ifdef MOZ_X11
     // for gfxXlibNativeRenderer:
     virtual nsresult DrawWithXlib(cairo_surface_t* surface,
                                   nsIntPoint offset,
--- a/gfx/thebes/gfxPoint.h
+++ b/gfx/thebes/gfxPoint.h
@@ -14,17 +14,17 @@
 
 #include "gfxTypes.h"
 
 struct gfxSize : public mozilla::gfx::BaseSize<gfxFloat, gfxSize> {
     typedef mozilla::gfx::BaseSize<gfxFloat, gfxSize> Super;
 
     gfxSize() : Super() {}
     gfxSize(gfxFloat aWidth, gfxFloat aHeight) : Super(aWidth, aHeight) {}
-    MOZ_IMPLICIT gfxSize(const nsIntSize& aSize) : Super(aSize.width, aSize.height) {}
+    MOZ_IMPLICIT gfxSize(const mozilla::gfx::IntSize& aSize) : Super(aSize.width, aSize.height) {}
 };
 
 struct gfxPoint : public mozilla::gfx::BasePoint<gfxFloat, gfxPoint> {
     typedef mozilla::gfx::BasePoint<gfxFloat, gfxPoint> Super;
 
     gfxPoint() : Super() {}
     gfxPoint(gfxFloat aX, gfxFloat aY) : Super(aX, aY) {}
     MOZ_IMPLICIT gfxPoint(const nsIntPoint& aPoint) : Super(aPoint.x, aPoint.y) {}
--- a/gfx/thebes/gfxQtNativeRenderer.cpp
+++ b/gfx/thebes/gfxQtNativeRenderer.cpp
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "gfxQtNativeRenderer.h"
 #include "gfxContext.h"
 #include "gfxUtils.h"
 #include "gfxXlibSurface.h"
 
 nsresult
-gfxQtNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
+gfxQtNativeRenderer::Draw(gfxContext* ctx, mozilla::gfx::IntSize size,
                           uint32_t flags, Screen* screen, Visual* visual)
 {
     Display *dpy = DisplayOfScreen(screen);
     bool isOpaque = (flags & DRAW_IS_OPAQUE) ? true : false;
     int screenNumber = screen - ScreenOfDisplay(dpy, 0);
 
     if (!isOpaque) {
         int depth = 32;
--- a/gfx/thebes/gfxQtNativeRenderer.h
+++ b/gfx/thebes/gfxQtNativeRenderer.h
@@ -57,13 +57,13 @@ public:
      * @param size Draw()'s drawing is guaranteed to be restricted to
      * the rectangle (offset.x,offset.y,size.width,size.height)
      * @param dpy a display to use for the drawing if ctx doesn't have one
      * @param resultSurface if non-null, we will try to capture a copy of the
      * rendered image into a surface similar to the surface of ctx; if
      * successful, a pointer to the new gfxASurface is stored in *resultSurface,
      * otherwise *resultSurface is set to nullptr.
      */
-    nsresult Draw(gfxContext* ctx, nsIntSize size,
+    nsresult Draw(gfxContext* ctx, mozilla::gfx::IntSize size,
                   uint32_t flags, Screen* screen, Visual* visual);
 };
 
 #endif /*GFXQTNATIVERENDER_H_*/
--- a/gfx/thebes/gfxXlibNativeRenderer.cpp
+++ b/gfx/thebes/gfxXlibNativeRenderer.cpp
@@ -131,17 +131,17 @@ FINISH:
 
 #define MAX_STATIC_CLIP_RECTANGLES 50
 
 /**
  * Try the direct path.
  * @return True if we took the direct path
  */
 bool
-gfxXlibNativeRenderer::DrawDirect(gfxContext *ctx, nsIntSize size,
+gfxXlibNativeRenderer::DrawDirect(gfxContext *ctx, IntSize size,
                                   uint32_t flags,
                                   Screen *screen, Visual *visual)
 {
     // We need to actually borrow the context because we want to read out the
     // clip rectangles.
     BorrowedCairoContext borrowed(ctx->GetDrawTarget());
     if (!borrowed.mCairo) {
       return false;
@@ -149,17 +149,17 @@ gfxXlibNativeRenderer::DrawDirect(gfxCon
 
     bool direct = DrawCairo(borrowed.mCairo, size, flags, screen, visual);
     borrowed.Finish();
 
     return direct;
 }
 
 bool
-gfxXlibNativeRenderer::DrawCairo(cairo_t* cr, nsIntSize size,
+gfxXlibNativeRenderer::DrawCairo(cairo_t* cr, IntSize size,
                                  uint32_t flags,
                                  Screen *screen, Visual *visual)
 {
     /* Check that the target surface is an xlib surface. */
     cairo_surface_t *target = cairo_get_group_target (cr);
     if (cairo_surface_get_type (target) != CAIRO_SURFACE_TYPE_XLIB) {
         NATIVE_DRAWING_NOTE("FALLBACK: non-X surface");
         return false;
@@ -303,17 +303,17 @@ enum DrawingMethod {
     eSimple,
     eCopyBackground,
     eAlphaExtraction
 };
 
 static cairo_surface_t*
 CreateTempXlibSurface (cairo_surface_t* cairoTarget,
                        DrawTarget* drawTarget,
-                       nsIntSize size,
+                       IntSize size,
                        bool canDrawOverBackground,
                        uint32_t flags, Screen *screen, Visual *visual,
                        DrawingMethod *method)
 {
     NS_ASSERTION(cairoTarget || drawTarget, "Must have some type");
 
     bool drawIsOpaque = (flags & gfxXlibNativeRenderer::DRAW_IS_OPAQUE) != 0;
     bool supportsAlternateVisual =
@@ -458,17 +458,17 @@ CopyXlibSurfaceToImage(cairo_surface_t *
     cairo_set_operator(copyCtx, CAIRO_OPERATOR_SOURCE);
     cairo_paint(copyCtx);
     cairo_destroy(copyCtx);
 
     return result.forget();
 }
 
 void
-gfxXlibNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
+gfxXlibNativeRenderer::Draw(gfxContext* ctx, IntSize size,
                             uint32_t flags, Screen *screen, Visual *visual)
 {
     gfxMatrix matrix = ctx->CurrentMatrix();
 
     // We can only draw direct or onto a copied background if pixels align and
     // native drawing is compatible with the current operator.  (The matrix is
     // actually also pixel-exact for flips and right-angle rotations, which
     // would permit copying the background but not drawing direct.)