Bug 1158122 - Remove some occurences of nsIntRect in gfx/layers/. r=nical

This commit is contained in:
Thibaud Backenstrass 2015-05-07 11:07:35 +02:00
parent 1d59a76bc3
commit 76a5c84a1b
15 changed files with 46 additions and 46 deletions

View File

@ -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<ID3D11Texture2D> mTexture;
RefPtr<ID3D11Device> mDevice;
RefPtr<ID3D11DeviceContext> 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<ID3D11Texture2D> mTexture;
RefPtr<TextureClient> mTextureClient;
HANDLE mShareHandle;

View File

@ -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<IDirect3DTexture9> texture;
HANDLE shareHandle = nullptr;
hr = device->CreateTexture(region.width,

View File

@ -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<IDirect3DSurface9> mSurface;
nsIntRect mRegion;
gfx::IntRect mRegion;
};
D3D9SurfaceImage();

View File

@ -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"

View File

@ -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));

View File

@ -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

View File

@ -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<ParentLayerIntRect>& 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<ParentLayerIntRect>& 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<DrawTarget> untransformedDT =
gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(IntSize(bounds.width, bounds.height),
SurfaceFormat::B8G8R8A8);

View File

@ -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;

View File

@ -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);

View File

@ -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();

View File

@ -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

View File

@ -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; }

View File

@ -707,7 +707,7 @@ CompositorD3D9::PrepareViewport(const gfx::IntSize& aSize)
void
CompositorD3D9::EnsureSize()
{
nsIntRect rect;
IntRect rect;
mWidget->GetClientBounds(rect);
mSize = rect.Size();

View File

@ -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;

View File

@ -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; }