Bug 1158120 - Replace nsIntSize by mozilla::gfx::IntSize in gfx/layers. r=nical
authorAmanda Sambath <amanda.sambath@phelma.grenoble-inp.fr>
Wed, 03 Jun 2015 13:45:24 +0200
changeset 246990 ef8381db1873176dc88ea4c5dc9e3000870347da
parent 246989 9fffe48757f6663ae36eb747cd7e9b6f56a3a0ae
child 246991 74e541ff80e178e3c6e6da1118fd2744206e8741
push id28848
push userryanvm@gmail.com
push dateWed, 03 Jun 2015 20:00:13 +0000
treeherdermozilla-central@0920f2325a6d [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/layers. r=nical
gfx/layers/LayerScope.cpp
gfx/layers/Layers.h
gfx/layers/LayersTypes.h
gfx/layers/ReadbackProcessor.cpp
gfx/layers/RotatedBuffer.cpp
gfx/layers/composite/ContentHost.cpp
gfx/layers/composite/TiledContentHost.cpp
gfx/layers/d3d11/CompositorD3D11.cpp
gfx/layers/d3d9/CompositorD3D9.cpp
gfx/layers/d3d9/CompositorD3D9.h
gfx/layers/ipc/CompositorParent.h
gfx/layers/ipc/SharedRGBImage.cpp
gfx/layers/ipc/SharedRGBImage.h
gfx/layers/opengl/GLBlitTextureImageHelper.cpp
gfx/layers/opengl/TextureHostOGL.cpp
--- a/gfx/layers/LayerScope.cpp
+++ b/gfx/layers/LayerScope.cpp
@@ -564,17 +564,17 @@ public:
         cp->set_height(mSize.height);
 
         return WriteToStream(packet);
     }
 
 protected:
     uint64_t mLayerRef;
     uint32_t mColor;
-    nsIntSize mSize;
+    IntSize mSize;
 };
 
 class DebugGLLayersData final: public DebugGLData {
 public:
     explicit DebugGLLayersData(UniquePtr<Packet> aPacket)
         : DebugGLData(Packet::LAYERS),
           mPacket(Move(aPacket))
     { }
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -2143,17 +2143,17 @@ public:
     // One of these two must be specified for Canvas2D, but never both
     mozilla::gfx::DrawTarget* mDrawTarget; // a DrawTarget for the canvas contents
     mozilla::gl::GLContext* mGLContext; // or this, for GL.
 
     // Frontbuffer override
     uint32_t mFrontbufferGLTex;
 
     // The size of the canvas content
-    nsIntSize mSize;
+    gfx::IntSize mSize;
 
     // Whether the canvas drawingbuffer has an alpha channel.
     bool mHasAlpha;
 
     // Whether mGLContext contains data that is alpha-premultiplied.
     bool mIsGLAlphaPremult;
   };
 
--- a/gfx/layers/LayersTypes.h
+++ b/gfx/layers/LayersTypes.h
@@ -2,17 +2,17 @@
  * 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 GFX_LAYERSTYPES_H
 #define GFX_LAYERSTYPES_H
 
 #include <stdint.h>                     // for uint32_t
-#include "nsPoint.h"                    // for nsIntPoint
+#include "mozilla/gfx/Point.h"          // for IntPoint
 #include "nsRegion.h"
 
 #include "mozilla/TypedEnumBits.h"
 
 #ifdef MOZ_WIDGET_GONK
 #include <ui/GraphicBuffer.h>
 #endif
 #include <stdio.h>            // FILE
@@ -92,17 +92,17 @@ struct LayerRenderState {
     , mSurface(nullptr)
     , mOverlayId(INVALID_OVERLAY)
     , mTexture(nullptr)
 #endif
   {}
 
 #ifdef MOZ_WIDGET_GONK
   LayerRenderState(android::GraphicBuffer* aSurface,
-                   const nsIntSize& aSize,
+                   const gfx::IntSize& aSize,
                    LayerRenderStateFlags aFlags,
                    TextureHost* aTexture)
     : mFlags(aFlags)
     , mHasOwnOffset(false)
     , mSurface(aSurface)
     , mOverlayId(INVALID_OVERLAY)
     , mSize(aSize)
     , mTexture(aTexture)
@@ -133,17 +133,17 @@ struct LayerRenderState {
   bool mHasOwnOffset;
   // the location of the layer's origin on mSurface
   nsIntPoint mOffset;
 #ifdef MOZ_WIDGET_GONK
   // surface to render
   android::sp<android::GraphicBuffer> mSurface;
   int32_t mOverlayId;
   // size of mSurface
-  nsIntSize mSize;
+  gfx::IntSize mSize;
   TextureHost* mTexture;
 #endif
 };
 
 enum class ScaleMode : int8_t {
   SCALE_NONE,
   STRETCH,
   SENTINEL
--- a/gfx/layers/ReadbackProcessor.cpp
+++ b/gfx/layers/ReadbackProcessor.cpp
@@ -113,17 +113,17 @@ ReadbackProcessor::BuildUpdatesForLayer(
       aLayer->mBackgroundColor = colorLayer->GetColor();
       NS_ASSERTION(aLayer->mBackgroundColor.a == 1.0,
                    "Color layer said it was opaque!");
       nsRefPtr<gfxContext> ctx =
           aLayer->mSink->BeginUpdate(aLayer->GetRect(),
                                      aLayer->AllocateSequenceNumber());
       if (ctx) {
         ColorPattern color(ToDeviceColor(aLayer->mBackgroundColor));
-        nsIntSize size = aLayer->GetSize();
+        IntSize size = aLayer->GetSize();
         ctx->GetDrawTarget()->FillRect(Rect(0, 0, size.width, size.height),
                                        color);
         aLayer->mSink->EndUpdate(ctx, aLayer->GetRect());
       }
     }
   } else {
     NS_ASSERTION(newBackground->AsPaintedLayer(), "Must be PaintedLayer");
     PaintedLayer* paintedLayer = static_cast<PaintedLayer*>(newBackground);
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -327,17 +327,17 @@ RotatedContentBuffer::BufferContentType(
     }
 
     return ContentForFormat(format);
   }
   return gfxContentType::SENTINEL;
 }
 
 bool
-RotatedContentBuffer::BufferSizeOkFor(const nsIntSize& aSize)
+RotatedContentBuffer::BufferSizeOkFor(const IntSize& aSize)
 {
   return (aSize == mBufferRect.Size() ||
           (SizedToVisibleBounds != mBufferSizePolicy &&
            aSize < mBufferRect.Size()));
 }
 
 bool
 RotatedContentBuffer::EnsureBuffer()
--- a/gfx/layers/composite/ContentHost.cpp
+++ b/gfx/layers/composite/ContentHost.cpp
@@ -296,17 +296,17 @@ ContentHostTexture::Dump(std::stringstre
   if (aDumpHtml) {
     aStream << "</ul>";
   }
 #endif
 }
 
 static inline void
 AddWrappedRegion(const nsIntRegion& aInput, nsIntRegion& aOutput,
-                 const nsIntSize& aSize, const nsIntPoint& aShift)
+                 const IntSize& aSize, const nsIntPoint& aShift)
 {
   nsIntRegion tempRegion;
   tempRegion.And(IntRect(aShift, aSize), aInput);
   tempRegion.MoveBy(-aShift);
   aOutput.Or(aOutput, tempRegion);
 }
 
 bool
@@ -336,17 +336,17 @@ ContentHostSingleBuffered::UpdateThebes(
   // destRegion is now in logical coordinates relative to the buffer, but we
   // need to account for rotation. We do that by moving the region to the
   // rotation offset and then wrapping any pixels that extend off the
   // bottom/right edges.
 
   // Shift to the rotation point
   destRegion.MoveBy(aData.rotation());
 
-  nsIntSize bufferSize = aData.rect().Size();
+  IntSize bufferSize = aData.rect().Size();
 
   // Select only the pixels that are still within the buffer.
   nsIntRegion finalRegion;
   finalRegion.And(IntRect(IntPoint(), bufferSize), destRegion);
 
   // For each of the overlap areas (right, bottom-right, bottom), select those
   // pixels and wrap them around to the opposite edge of the buffer rect.
   AddWrappedRegion(destRegion, finalRegion, bufferSize, nsIntPoint(aData.rect().width, 0));
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -430,17 +430,17 @@ TiledContentHost::RenderTile(TileHost& a
                              const gfxRGBA* aBackgroundColor,
                              EffectChain& aEffectChain,
                              float aOpacity,
                              const gfx::Matrix4x4& aTransform,
                              const gfx::Filter& aFilter,
                              const gfx::Rect& aClipRect,
                              const nsIntRegion& aScreenRegion,
                              const IntPoint& aTextureOffset,
-                             const nsIntSize& aTextureBounds,
+                             const IntSize& aTextureBounds,
                              const gfx::Rect& aVisibleRect)
 {
   if (aTile.IsPlaceholderTile()) {
     // This shouldn't ever happen, but let's fail semi-gracefully. No need
     // to warn, the texture update would have already caught this.
     return;
   }
 
@@ -578,17 +578,17 @@ TiledContentHost::RenderLayerBuffer(Tile
 
         if (!tileDrawRegion.IsEmpty()) {
           tileDrawRegion.ScaleRoundOut(resolution, resolution);
           IntPoint tileOffset((x - tileStartX) * resolution,
                                 (y - tileStartY) * resolution);
           gfx::IntSize tileSize = aLayerBuffer.GetTileSize();
           RenderTile(tileTexture, aBackgroundColor, aEffectChain, aOpacity, aTransform,
                      aFilter, aClipRect, tileDrawRegion, tileOffset,
-                     nsIntSize(tileSize.width, tileSize.height),
+                     IntSize(tileSize.width, tileSize.height),
                      gfx::Rect(visibleRect.x, visibleRect.y,
                                visibleRect.width, visibleRect.height));
           if (tileTexture.mTextureHostOnWhite) {
             componentAlphaDiagnostic = DiagnosticFlags::COMPONENT_ALPHA;
           }
         }
       }
       tileY++;
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -1014,17 +1014,17 @@ CompositorD3D11::BeginFrame(const nsIntR
   // this is important because resizing our buffers when mimised will fail and
   // cause a crash when we're restored.
   NS_ASSERTION(mHwnd, "Couldn't find an HWND when initialising?");
   if (::IsIconic(mHwnd) || mDevice->GetDeviceRemovedReason() != S_OK) {
     *aRenderBoundsOut = Rect();
     return;
   }
 
-  nsIntSize oldSize = mSize;
+  IntSize oldSize = mSize;
   UpdateRenderTarget();
 
   // Failed to create a render target or the view.
   if (!mDefaultRT || !mDefaultRT->mRTView ||
       mSize.width <= 0 || mSize.height <= 0) {
     *aRenderBoundsOut = Rect();
     return;
   }
@@ -1086,17 +1086,17 @@ CompositorD3D11::BeginFrame(const nsIntR
 
 void
 CompositorD3D11::EndFrame()
 {
   if (!mDefaultRT) {
     return;
   }
 
-  nsIntSize oldSize = mSize;
+  IntSize oldSize = mSize;
   EnsureSize();
   if (mSize.width <= 0 || mSize.height <= 0) {
     return;
   }
 
   UINT presentInterval = 0;
 
   if (gfxWindowsPlatform::GetPlatform()->IsWARP()) {
--- a/gfx/layers/d3d9/CompositorD3D9.cpp
+++ b/gfx/layers/d3d9/CompositorD3D9.cpp
@@ -659,17 +659,17 @@ CompositorD3D9::BeginFrame(const nsIntRe
 }
 
 void
 CompositorD3D9::EndFrame()
 {
   if (mDeviceManager) {
     device()->EndScene();
 
-    nsIntSize oldSize = mSize;
+    IntSize oldSize = mSize;
     EnsureSize();
     if (oldSize == mSize) {
       if (mTarget) {
         PaintToTarget();
       } else {
         mSwapChain->Present();
       }
     }
--- a/gfx/layers/d3d9/CompositorD3D9.h
+++ b/gfx/layers/d3d9/CompositorD3D9.h
@@ -2,16 +2,17 @@
  * 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_GFX_COMPOSITORD3D9_H
 #define MOZILLA_GFX_COMPOSITORD3D9_H
 
 #include "mozilla/gfx/2D.h"
+#include "mozilla/gfx/Point.h"
 #include "gfx2DGlue.h"
 #include "mozilla/layers/Compositor.h"
 #include "mozilla/layers/TextureD3D9.h"
 #include "DeviceManagerD3D9.h"
 
 class nsWidget;
 
 namespace mozilla {
@@ -163,17 +164,17 @@ private:
   nsRefPtr<SwapChainD3D9> mSwapChain;
 
   /* Widget associated with this layer manager */
   nsIWidget *mWidget;
 
   RefPtr<CompositingRenderTargetD3D9> mDefaultRT;
   RefPtr<CompositingRenderTargetD3D9> mCurrentRT;
 
-  nsIntSize mSize;
+  gfx::IntSize mSize;
 
   uint32_t mDeviceResetCount;
   uint32_t mFailedResetAttempts;
 };
 
 }
 }
 
--- a/gfx/layers/ipc/CompositorParent.h
+++ b/gfx/layers/ipc/CompositorParent.h
@@ -471,17 +471,17 @@ protected:
   TimeStamp mTestTime;
   bool mIsTesting;
 
   uint64_t mPendingTransaction;
 
   bool mPaused;
 
   bool mUseExternalSurfaceSize;
-  nsIntSize mEGLSurfaceSize;
+  gfx::IntSize mEGLSurfaceSize;
 
   mozilla::Monitor mPauseCompositionMonitor;
   mozilla::Monitor mResumeCompositionMonitor;
 
   uint64_t mCompositorID;
   uint64_t mRootLayerTreeID;
 
   bool mOverrideComposeReadiness;
--- a/gfx/layers/ipc/SharedRGBImage.cpp
+++ b/gfx/layers/ipc/SharedRGBImage.cpp
@@ -23,17 +23,17 @@
 // Just big enough for a 1080p RGBA32 frame
 #define MAX_FRAME_SIZE (16 * 1024 * 1024)
 
 namespace mozilla {
 namespace layers {
 
 already_AddRefed<Image>
 CreateSharedRGBImage(ImageContainer *aImageContainer,
-                     nsIntSize aSize,
+                     gfx::IntSize aSize,
                      gfxImageFormat aImageFormat)
 {
   NS_ASSERTION(aImageFormat == gfxImageFormat::ARGB32 ||
                aImageFormat == gfxImageFormat::RGB24 ||
                aImageFormat == gfxImageFormat::RGB16_565,
                "RGB formats supported only");
 
   if (!aImageContainer) {
--- a/gfx/layers/ipc/SharedRGBImage.h
+++ b/gfx/layers/ipc/SharedRGBImage.h
@@ -18,17 +18,17 @@
 namespace mozilla {
 namespace layers {
 
 class BufferTextureClient;
 class ImageClient;
 class TextureClient;
 
 already_AddRefed<Image> CreateSharedRGBImage(ImageContainer* aImageContainer,
-                                             nsIntSize aSize,
+                                             gfx::IntSize aSize,
                                              gfxImageFormat aImageFormat);
 
 /**
  * Stores RGB data in shared memory
  * It is assumed that the image width and stride are equal
  */
 class SharedRGBImage : public Image
 {
--- a/gfx/layers/opengl/GLBlitTextureImageHelper.cpp
+++ b/gfx/layers/opengl/GLBlitTextureImageHelper.cpp
@@ -9,16 +9,17 @@
 #include "DecomposeIntoNoRepeatTriangles.h"
 #include "GLContext.h"
 #include "GLTextureImage.h"
 #include "ScopedGLHelpers.h"
 #include "nsRect.h"
 #include "gfx2DGlue.h"
 #include "gfxUtils.h"
 #include "CompositorOGL.h"
+#include "mozilla/gfx/Point.h"
 
 using namespace mozilla::gl;
 
 namespace mozilla {
 namespace layers {
 
 GLBlitTextureImageHelper::GLBlitTextureImageHelper(CompositorOGL* aCompositor)
     : mCompositor(aCompositor)
@@ -105,33 +106,33 @@ GLBlitTextureImageHelper::BlitTextureIma
             // in destination space.
             // We need to transform this back into destination space, inverting the transform from (*)
             gfx::IntRect srcSubInDstRect(srcSubRect);
             srcSubInDstRect.MoveBy(-aSrcRect.TopLeft());
             srcSubInDstRect.ScaleRoundOut(blitScaleX, blitScaleY);
             srcSubInDstRect.MoveBy(aDstRect.TopLeft());
 
             // we transform these rectangles to be relative to the current src and dst tiles, respectively
-            nsIntSize srcSize = srcTextureRect.Size();
-            nsIntSize dstSize = dstTextureRect.Size();
+            gfx::IntSize srcSize = srcTextureRect.Size();
+            gfx::IntSize dstSize = dstTextureRect.Size();
             srcSubRect.MoveBy(-srcTextureRect.x, -srcTextureRect.y);
             srcSubInDstRect.MoveBy(-dstTextureRect.x, -dstTextureRect.y);
 
             float dx0 = 2.0f * float(srcSubInDstRect.x) / float(dstSize.width) - 1.0f;
             float dy0 = 2.0f * float(srcSubInDstRect.y) / float(dstSize.height) - 1.0f;
             float dx1 = 2.0f * float(srcSubInDstRect.x + srcSubInDstRect.width) / float(dstSize.width) - 1.0f;
             float dy1 = 2.0f * float(srcSubInDstRect.y + srcSubInDstRect.height) / float(dstSize.height) - 1.0f;
             ScopedViewportRect autoViewportRect(gl, 0, 0, dstSize.width, dstSize.height);
 
             RectTriangles rects;
 
-            nsIntSize realTexSize = srcSize;
+            gfx::IntSize realTexSize = srcSize;
             if (!CanUploadNonPowerOfTwo(gl)) {
-                realTexSize = nsIntSize(gfx::NextPowerOfTwo(srcSize.width),
-                                        gfx::NextPowerOfTwo(srcSize.height));
+                realTexSize = gfx::IntSize(gfx::NextPowerOfTwo(srcSize.width),
+                                           gfx::NextPowerOfTwo(srcSize.height));
             }
 
             if (aSrc->GetWrapMode() == LOCAL_GL_REPEAT) {
                 rects.addRect(/* dest rectangle */
                         dx0, dy0, dx1, dy1,
                         /* tex coords */
                         srcSubRect.x / float(realTexSize.width),
                         srcSubRect.y / float(realTexSize.height),
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -175,17 +175,17 @@ TextureImageTextureSourceOGL::Update(gfx
 
   if (mTexImage->InUpdate()) {
     mTexImage->EndUpdate();
   }
   return true;
 }
 
 void
-TextureImageTextureSourceOGL::EnsureBuffer(const nsIntSize& aSize,
+TextureImageTextureSourceOGL::EnsureBuffer(const IntSize& aSize,
                                            gfxContentType aContentType)
 {
   if (!mTexImage ||
       mTexImage->GetSize() != aSize ||
       mTexImage->GetContentType() != aContentType) {
     mTexImage = CreateTextureImage(mCompositor->gl(),
                                    aSize,
                                    aContentType,