From 76a5c84a1bc5ec1e08858247c99221694b030efd Mon Sep 17 00:00:00 2001 From: Thibaud Backenstrass Date: Thu, 7 May 2015 11:07:35 +0200 Subject: [PATCH] Bug 1158122 - Remove some occurences of nsIntRect in gfx/layers/. r=nical --- gfx/layers/D3D11ShareHandleImage.h | 8 +++--- gfx/layers/D3D9SurfaceImage.cpp | 2 +- gfx/layers/D3D9SurfaceImage.h | 4 +-- gfx/layers/basic/BasicColorLayer.cpp | 2 +- gfx/layers/basic/BasicCompositor.cpp | 4 +-- gfx/layers/basic/BasicImageLayer.cpp | 2 +- gfx/layers/basic/BasicLayerManager.cpp | 38 ++++++++++++------------- gfx/layers/basic/BasicPaintedLayer.cpp | 4 +-- gfx/layers/basic/X11BasicCompositor.cpp | 2 +- gfx/layers/d3d11/CompositorD3D11.cpp | 10 +++---- gfx/layers/d3d11/TextureD3D11.cpp | 6 ++-- gfx/layers/d3d11/TextureD3D11.h | 2 +- gfx/layers/d3d9/CompositorD3D9.cpp | 2 +- gfx/layers/d3d9/TextureD3D9.cpp | 4 +-- gfx/layers/d3d9/TextureD3D9.h | 2 +- 15 files changed, 46 insertions(+), 46 deletions(-) diff --git a/gfx/layers/D3D11ShareHandleImage.h b/gfx/layers/D3D11ShareHandleImage.h index 005a65a8158..b512d4f5396 100644 --- a/gfx/layers/D3D11ShareHandleImage.h +++ b/gfx/layers/D3D11ShareHandleImage.h @@ -26,7 +26,7 @@ public: Data(ID3D11Texture2D* aTexture, ID3D11Device* aDevice, ID3D11DeviceContext* aContext, - const nsIntRect& aRegion) + const gfx::IntRect& aRegion) : mTexture(aTexture), mDevice(aDevice), mContext(aContext), @@ -34,7 +34,7 @@ public: RefPtr mTexture; RefPtr mDevice; RefPtr mContext; - nsIntRect mRegion; + gfx::IntRect mRegion; }; D3D11ShareHandleImage() : Image(NULL, ImageFormat::D3D11_SHARE_HANDLE_TEXTURE), mSize(0, 0) {} @@ -52,12 +52,12 @@ public: ID3D11Texture2D* GetTexture() const; - virtual nsIntRect GetPictureRect() override { return mPictureRect; } + virtual gfx::IntRect GetPictureRect() override { return mPictureRect; } private: gfx::IntSize mSize; - nsIntRect mPictureRect; + gfx::IntRect mPictureRect; RefPtr mTexture; RefPtr mTextureClient; HANDLE mShareHandle; diff --git a/gfx/layers/D3D9SurfaceImage.cpp b/gfx/layers/D3D9SurfaceImage.cpp index f5b2f744ee1..e82953675da 100644 --- a/gfx/layers/D3D9SurfaceImage.cpp +++ b/gfx/layers/D3D9SurfaceImage.cpp @@ -107,7 +107,7 @@ D3D9SurfaceImage::SetData(const Data& aData) // DXVA surfaces aren't created sharable, so we need to copy the surface // to a sharable texture to that it's accessible to the layer manager's // device. - const nsIntRect& region = aData.mRegion; + const gfx::IntRect& region = aData.mRegion; RefPtr texture; HANDLE shareHandle = nullptr; hr = device->CreateTexture(region.width, diff --git a/gfx/layers/D3D9SurfaceImage.h b/gfx/layers/D3D9SurfaceImage.h index 7d09e68f789..cbdfec4be08 100644 --- a/gfx/layers/D3D9SurfaceImage.h +++ b/gfx/layers/D3D9SurfaceImage.h @@ -22,10 +22,10 @@ class D3D9SurfaceImage : public Image { public: struct Data { - Data(IDirect3DSurface9* aSurface, const nsIntRect& aRegion) + Data(IDirect3DSurface9* aSurface, const gfx::IntRect& aRegion) : mSurface(aSurface), mRegion(aRegion) {} RefPtr mSurface; - nsIntRect mRegion; + gfx::IntRect mRegion; }; D3D9SurfaceImage(); diff --git a/gfx/layers/basic/BasicColorLayer.cpp b/gfx/layers/basic/BasicColorLayer.cpp index 2067375efec..17ac8e2318e 100644 --- a/gfx/layers/basic/BasicColorLayer.cpp +++ b/gfx/layers/basic/BasicColorLayer.cpp @@ -15,7 +15,7 @@ #include "nsCOMPtr.h" // for already_AddRefed #include "nsDebug.h" // for NS_ASSERTION #include "nsISupportsImpl.h" // for Layer::AddRef, etc -#include "nsRect.h" // for nsIntRect +#include "nsRect.h" // for mozilla::gfx::IntRect #include "nsRegion.h" // for nsIntRegion #include "mozilla/gfx/PathHelpers.h" diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp index eafa9c0d3f8..96ee8c139c1 100644 --- a/gfx/layers/basic/BasicCompositor.cpp +++ b/gfx/layers/basic/BasicCompositor.cpp @@ -489,7 +489,7 @@ BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion, nsIntRegion invalidRegionSafe; invalidRegionSafe.And(aInvalidRegion, intRect); - nsIntRect invalidRect = invalidRegionSafe.GetBounds(); + IntRect invalidRect = invalidRegionSafe.GetBounds(); mInvalidRect = IntRect(invalidRect.x, invalidRect.y, invalidRect.width, invalidRect.height); mInvalidRegion = invalidRegionSafe; @@ -573,7 +573,7 @@ BasicCompositor::EndFrame() // to copy the individual rectangles in the region or else we'll draw blank // pixels. nsIntRegionRectIterator iter(mInvalidRegion); - for (const nsIntRect *r = iter.Next(); r; r = iter.Next()) { + for (const IntRect *r = iter.Next(); r; r = iter.Next()) { dest->CopySurface(source, IntRect(r->x - mInvalidRect.x, r->y - mInvalidRect.y, r->width, r->height), IntPoint(r->x - offset.x, r->y - offset.y)); diff --git a/gfx/layers/basic/BasicImageLayer.cpp b/gfx/layers/basic/BasicImageLayer.cpp index 25588c62076..376a8ba4214 100644 --- a/gfx/layers/basic/BasicImageLayer.cpp +++ b/gfx/layers/basic/BasicImageLayer.cpp @@ -14,7 +14,7 @@ #include "nsCOMPtr.h" // for already_AddRefed #include "nsDebug.h" // for NS_ASSERTION #include "nsISupportsImpl.h" // for gfxPattern::Release, etc -#include "nsRect.h" // for nsIntRect +#include "nsRect.h" // for mozilla::gfx::IntRect #include "nsRegion.h" // for nsIntRegion #include "mozilla/gfx/Point.h" // for IntSize diff --git a/gfx/layers/basic/BasicLayerManager.cpp b/gfx/layers/basic/BasicLayerManager.cpp index 06a2e0077a8..4d7c8739c17 100644 --- a/gfx/layers/basic/BasicLayerManager.cpp +++ b/gfx/layers/basic/BasicLayerManager.cpp @@ -43,7 +43,7 @@ #include "nsDebug.h" // for NS_ASSERTION, etc #include "nsISupportsImpl.h" // for gfxContext::Release, etc #include "nsPoint.h" // for nsIntPoint -#include "nsRect.h" // for nsIntRect +#include "nsRect.h" // for mozilla::gfx::IntRect #include "nsRegion.h" // for nsIntRegion, etc #include "nsTArray.h" // for nsAutoTArray #ifdef MOZ_ENABLE_SKIA @@ -67,7 +67,7 @@ using namespace mozilla::gfx; * aRect. */ static bool -ClipToContain(gfxContext* aContext, const nsIntRect& aRect) +ClipToContain(gfxContext* aContext, const IntRect& aRect) { gfxRect userRect(aRect.x, aRect.y, aRect.width, aRect.height); gfxRect deviceRect = aContext->UserToDevice(userRect); @@ -115,12 +115,12 @@ BasicLayerManager::PushGroupForLayer(gfxContext* aContext, Layer* aLayer, return result.forget(); } -static nsIntRect +static IntRect ToInsideIntRect(const gfxRect& aRect) { gfxRect r = aRect; r.RoundIn(); - return nsIntRect(r.X(), r.Y(), r.Width(), r.Height()); + return IntRect(r.X(), r.Y(), r.Width(), r.Height()); } // A context helper for BasicLayerManager::PaintLayer() that holds all the @@ -169,7 +169,7 @@ public: void AnnotateOpaqueRect() { const nsIntRegion& visibleRegion = mLayer->GetEffectiveVisibleRegion(); - const nsIntRect& bounds = visibleRegion.GetBounds(); + const IntRect& bounds = visibleRegion.GetBounds(); DrawTarget *dt = mTarget->GetDrawTarget(); const IntRect& targetOpaqueRect = dt->GetOpaqueRect(); @@ -281,8 +281,8 @@ BasicLayerManager::BeginTransactionWithTarget(gfxContext* aTarget) } static void -TransformIntRect(nsIntRect& aRect, const Matrix& aMatrix, - nsIntRect (*aRoundMethod)(const gfxRect&)) +TransformIntRect(IntRect& aRect, const Matrix& aMatrix, + IntRect (*aRoundMethod)(const gfxRect&)) { Rect gr = Rect(aRect.x, aRect.y, aRect.width, aRect.height); gr = aMatrix.TransformBounds(gr); @@ -309,12 +309,12 @@ enum { ALLOW_OPAQUE = 0x01, }; static void -MarkLayersHidden(Layer* aLayer, const nsIntRect& aClipRect, - const nsIntRect& aDirtyRect, +MarkLayersHidden(Layer* aLayer, const IntRect& aClipRect, + const IntRect& aDirtyRect, nsIntRegion& aOpaqueRegion, uint32_t aFlags) { - nsIntRect newClipRect(aClipRect); + IntRect newClipRect(aClipRect); uint32_t newFlags = aFlags; // Allow aLayer or aLayer's descendants to cover underlying layers @@ -326,7 +326,7 @@ MarkLayersHidden(Layer* aLayer, const nsIntRect& aClipRect, { const Maybe& clipRect = aLayer->GetEffectiveClipRect(); if (clipRect) { - nsIntRect cr = ParentLayerIntRect::ToUntyped(*clipRect); + IntRect cr = ParentLayerIntRect::ToUntyped(*clipRect); // clipRect is in the container's coordinate system. Get it into the // global coordinate system. if (aLayer->GetParent()) { @@ -356,7 +356,7 @@ MarkLayersHidden(Layer* aLayer, const nsIntRect& aClipRect, } nsIntRegion region = aLayer->GetEffectiveVisibleRegion(); - nsIntRect r = region.GetBounds(); + IntRect r = region.GetBounds(); TransformIntRect(r, transform, ToOutsideIntRect); r.IntersectRect(r, aDirtyRect); data->SetHidden(aOpaqueRegion.Contains(r)); @@ -366,7 +366,7 @@ MarkLayersHidden(Layer* aLayer, const nsIntRect& aClipRect, if ((aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE) && (newFlags & ALLOW_OPAQUE)) { nsIntRegionRectIterator it(region); - while (const nsIntRect* sr = it.Next()) { + while (const IntRect* sr = it.Next()) { r = *sr; TransformIntRect(r, transform, ToInsideIntRect); @@ -395,18 +395,18 @@ MarkLayersHidden(Layer* aLayer, const nsIntRect& aClipRect, * clipped and in the dirty rect), in the root coordinate system. */ static void -ApplyDoubleBuffering(Layer* aLayer, const nsIntRect& aVisibleRect) +ApplyDoubleBuffering(Layer* aLayer, const IntRect& aVisibleRect) { BasicImplData* data = ToData(aLayer); if (data->IsHidden()) return; - nsIntRect newVisibleRect(aVisibleRect); + IntRect newVisibleRect(aVisibleRect); { const Maybe& clipRect = aLayer->GetEffectiveClipRect(); if (clipRect) { - nsIntRect cr = ParentLayerIntRect::ToUntyped(*clipRect); + IntRect cr = ParentLayerIntRect::ToUntyped(*clipRect); // clipRect is in the container's coordinate system. Get it into the // global coordinate system. if (aLayer->GetParent()) { @@ -514,7 +514,7 @@ BasicLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback, if (mTarget && mRoot && !(aFlags & END_NO_IMMEDIATE_REDRAW) && !(aFlags & END_NO_COMPOSITE)) { - nsIntRect clipRect; + IntRect clipRect; { gfxContextMatrixAutoSaveRestore save(mTarget); @@ -533,7 +533,7 @@ BasicLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback, PaintLayer(mTarget, mRoot, aCallback, aCallbackData); if (!mRegionToClear.IsEmpty()) { nsIntRegionRectIterator iter(mRegionToClear); - const nsIntRect *r; + const IntRect *r; while ((r = iter.Next())) { mTarget->GetDrawTarget()->ClearRect(Rect(r->x, r->y, r->width, r->height)); } @@ -928,7 +928,7 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget, PaintSelfOrChildren(paintLayerContext, aTarget); } } else { - const nsIntRect& bounds = visibleRegion.GetBounds(); + const IntRect& bounds = visibleRegion.GetBounds(); RefPtr untransformedDT = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(IntSize(bounds.width, bounds.height), SurfaceFormat::B8G8R8A8); diff --git a/gfx/layers/basic/BasicPaintedLayer.cpp b/gfx/layers/basic/BasicPaintedLayer.cpp index ab7fa7e1b95..8e10c4ec911 100644 --- a/gfx/layers/basic/BasicPaintedLayer.cpp +++ b/gfx/layers/basic/BasicPaintedLayer.cpp @@ -23,7 +23,7 @@ #include "nsCOMPtr.h" // for already_AddRefed #include "nsISupportsImpl.h" // for gfxContext::Release, etc #include "nsPoint.h" // for nsIntPoint -#include "nsRect.h" // for nsIntRect +#include "nsRect.h" // for mozilla::gfx::IntRect #include "nsTArray.h" // for nsTArray, nsTArray_Impl #include "AutoMaskData.h" #include "gfx2DGlue.h" @@ -38,7 +38,7 @@ IntersectWithClip(const nsIntRegion& aRegion, gfxContext* aContext) { gfxRect clip = aContext->GetClipExtents(); clip.RoundOut(); - nsIntRect r(clip.X(), clip.Y(), clip.Width(), clip.Height()); + IntRect r(clip.X(), clip.Y(), clip.Width(), clip.Height()); nsIntRegion result; result.And(aRegion, r); return result; diff --git a/gfx/layers/basic/X11BasicCompositor.cpp b/gfx/layers/basic/X11BasicCompositor.cpp index f55ca0e19ff..01b86854f1f 100644 --- a/gfx/layers/basic/X11BasicCompositor.cpp +++ b/gfx/layers/basic/X11BasicCompositor.cpp @@ -54,7 +54,7 @@ X11DataTextureSourceBasic::Update(gfx::DataSourceSurface* aSurface, if (aDestRegion) { nsIntRegionRectIterator iter(*aDestRegion); - while (const nsIntRect* iterRect = iter.Next()) { + while (const IntRect* iterRect = iter.Next()) { IntRect srcRect(iterRect->x, iterRect->y, iterRect->width, iterRect->height); IntPoint dstPoint(iterRect->x, iterRect->y); diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index 6bb667762b8..b515d945d1e 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -1035,7 +1035,7 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, UINT offset = 0; mContext->IASetVertexBuffers(0, 1, &buffer, &size, &offset); - nsIntRect intRect = IntRect(IntPoint(0, 0), mSize); + IntRect intRect = IntRect(IntPoint(0, 0), mSize); // Sometimes the invalid region is larger than we want to draw. nsIntRegion invalidRegionSafe; @@ -1045,7 +1045,7 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, invalidRegionSafe.And(aInvalidRegion, intRect); } - nsIntRect invalidRect = invalidRegionSafe.GetBounds(); + IntRect invalidRect = invalidRegionSafe.GetBounds(); mInvalidRect = IntRect(invalidRect.x, invalidRect.y, invalidRect.width, invalidRect.height); mInvalidRegion = invalidRegionSafe; @@ -1057,7 +1057,7 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, } if (aClipRectIn) { - invalidRect.IntersectRect(invalidRect, nsIntRect(aClipRectIn->x, aClipRectIn->y, aClipRectIn->width, aClipRectIn->height)); + invalidRect.IntersectRect(invalidRect, IntRect(aClipRectIn->x, aClipRectIn->y, aClipRectIn->width, aClipRectIn->height)); } mCurrentClip = IntRect(invalidRect.x, invalidRect.y, invalidRect.width, invalidRect.height); @@ -1112,7 +1112,7 @@ CompositorD3D11::EndFrame() rects.reserve(params.DirtyRectsCount); nsIntRegionRectIterator iter(mInvalidRegion); - const nsIntRect* r; + const IntRect* r; uint32_t i = 0; while ((r = iter.Next()) != nullptr) { RECT rect; @@ -1166,7 +1166,7 @@ CompositorD3D11::PrepareViewport(const gfx::IntSize& aSize) void CompositorD3D11::EnsureSize() { - nsIntRect rect; + IntRect rect; mWidget->GetClientBounds(rect); mSize = rect.Size(); diff --git a/gfx/layers/d3d11/TextureD3D11.cpp b/gfx/layers/d3d11/TextureD3D11.cpp index 1d4e0dce1a1..7f150aa9165 100644 --- a/gfx/layers/d3d11/TextureD3D11.cpp +++ b/gfx/layers/d3d11/TextureD3D11.cpp @@ -850,7 +850,7 @@ DataTextureSourceD3D11::Update(DataSourceSurface* aSurface, if (aDestRegion) { nsIntRegionRectIterator iter(*aDestRegion); - const nsIntRect *iterRect; + const IntRect *iterRect; while ((iterRect = iter.Next())) { D3D11_BOX box; box.front = 0; @@ -924,11 +924,11 @@ DataTextureSourceD3D11::GetTileRect(uint32_t aIndex) const return GetTileRectD3D11(aIndex, mSize, mCompositor->GetMaxTextureSize()); } -nsIntRect +IntRect DataTextureSourceD3D11::GetTileRect() { IntRect rect = GetTileRect(mCurrentTile); - return nsIntRect(rect.x, rect.y, rect.width, rect.height); + return IntRect(rect.x, rect.y, rect.width, rect.height); } void diff --git a/gfx/layers/d3d11/TextureD3D11.h b/gfx/layers/d3d11/TextureD3D11.h index f54e829f40c..1125d3efab6 100644 --- a/gfx/layers/d3d11/TextureD3D11.h +++ b/gfx/layers/d3d11/TextureD3D11.h @@ -209,7 +209,7 @@ public: virtual bool NextTile() override { return (++mCurrentTile < mTileTextures.size()); } - virtual nsIntRect GetTileRect() override; + virtual gfx::IntRect GetTileRect() override; virtual void EndBigImageIteration() override { mIterating = false; } diff --git a/gfx/layers/d3d9/CompositorD3D9.cpp b/gfx/layers/d3d9/CompositorD3D9.cpp index 911bbbadd21..221bef05271 100644 --- a/gfx/layers/d3d9/CompositorD3D9.cpp +++ b/gfx/layers/d3d9/CompositorD3D9.cpp @@ -707,7 +707,7 @@ CompositorD3D9::PrepareViewport(const gfx::IntSize& aSize) void CompositorD3D9::EnsureSize() { - nsIntRect rect; + IntRect rect; mWidget->GetClientBounds(rect); mSize = rect.Size(); diff --git a/gfx/layers/d3d9/TextureD3D9.cpp b/gfx/layers/d3d9/TextureD3D9.cpp index a77065c447e..cc3b7d54bd0 100644 --- a/gfx/layers/d3d9/TextureD3D9.cpp +++ b/gfx/layers/d3d9/TextureD3D9.cpp @@ -551,7 +551,7 @@ DataTextureSourceD3D9::GetTileRect(uint32_t aTileIndex) const verticalTile < (verticalTiles - 1) ? maxSize : mSize.height % maxSize); } -nsIntRect +IntRect DataTextureSourceD3D9::GetTileRect() { return GetTileRect(mCurrentTile); @@ -880,7 +880,7 @@ DataTextureSourceD3D9::UpdateFromTexture(IDirect3DTexture9* aTexture, if (aRegion) { nsIntRegionRectIterator iter(*aRegion); - const nsIntRect *iterRect; + const IntRect *iterRect; while ((iterRect = iter.Next())) { RECT rect; rect.left = iterRect->x; diff --git a/gfx/layers/d3d9/TextureD3D9.h b/gfx/layers/d3d9/TextureD3D9.h index b41e82b8f53..965b1456f76 100644 --- a/gfx/layers/d3d9/TextureD3D9.h +++ b/gfx/layers/d3d9/TextureD3D9.h @@ -147,7 +147,7 @@ public: virtual bool NextTile() override { return (++mCurrentTile < mTileTextures.size()); } - virtual nsIntRect GetTileRect() override; + virtual gfx::IntRect GetTileRect() override; virtual void EndBigImageIteration() override { mIterating = false; }