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

This commit is contained in:
Thibaud Backenstrass 2015-05-07 11:07:47 +02:00
parent 71ef38da38
commit f6dc43b355
10 changed files with 50 additions and 50 deletions

View File

@ -15,7 +15,7 @@
#include "mozilla/layers/LayersTypes.h"
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
#include "nsRect.h" // for nsIntRect
#include "nsRect.h" // for mozilla::gfx::IntRect
#include "nsXULAppAPI.h" // for XRE_GetProcessType, etc
#include "gfxPrefs.h" // for WebGLForceLayersReadback

View File

@ -199,7 +199,7 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
hal::GetCurrentScreenConfiguration(&currentConfig);
orientation = currentConfig.orientation();
}
nsIntRect targetBounds = mWidget->GetNaturalBounds();
IntRect targetBounds = mWidget->GetNaturalBounds();
targetBounds.x = targetBounds.y = 0;
mForwarder->BeginTransaction(targetBounds, mTargetRotation, orientation);
@ -466,10 +466,10 @@ ClientLayerManager::MakeSnapshotIfRequired()
// The compositor doesn't draw to a different sized surface
// when there's a rotation. Instead we rotate the result
// when drawing into dt
nsIntRect outerBounds;
IntRect outerBounds;
mWidget->GetBounds(outerBounds);
nsIntRect bounds = ToOutsideIntRect(mShadowTarget->GetClipExtents());
IntRect bounds = ToOutsideIntRect(mShadowTarget->GetClipExtents());
if (mTargetRotation) {
bounds = RotateRect(bounds, outerBounds, mTargetRotation);
}
@ -791,5 +791,5 @@ ClientLayer::~ClientLayer()
MOZ_COUNT_DTOR(ClientLayer);
}
} // layers
} // mozilla
} // namespace layers
} // namespace mozilla

View File

@ -21,7 +21,7 @@
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsIObserver.h" // for nsIObserver
#include "nsISupportsImpl.h" // for Layer::Release, etc
#include "nsRect.h" // for nsIntRect
#include "nsRect.h" // for mozilla::gfx::IntRect
#include "nsTArray.h" // for nsTArray
#include "nscore.h" // for nsAString
#include "mozilla/layers/TransactionIdAllocator.h"

View File

@ -21,7 +21,7 @@
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
#include "nsRect.h" // for nsIntRect
#include "nsRect.h" // for mozilla::gfx::IntRect
#include "gfx2DGlue.h"
#include "ReadbackProcessor.h"

View File

@ -136,7 +136,7 @@ ContentClientBasic::ContentClientBasic()
void
ContentClientBasic::CreateBuffer(ContentType aType,
const nsIntRect& aRect,
const IntRect& aRect,
uint32_t aFlags,
RefPtr<gfx::DrawTarget>* aBlackDT,
RefPtr<gfx::DrawTarget>* aWhiteDT)
@ -171,7 +171,7 @@ class RemoteBufferReadbackProcessor : public TextureReadbackSink
{
public:
RemoteBufferReadbackProcessor(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates,
const nsIntRect& aBufferRect, const nsIntPoint& aBufferRotation)
const IntRect& aBufferRect, const nsIntPoint& aBufferRotation)
: mReadbackUpdates(*aReadbackUpdates)
, mBufferRect(aBufferRect)
, mBufferRotation(aBufferRotation)
@ -221,7 +221,7 @@ private:
// This array is used to keep the layers alive until the callback.
vector<RefPtr<Layer>> mLayerRefs;
nsIntRect mBufferRect;
IntRect mBufferRect;
nsIntPoint mBufferRotation;
};
@ -276,7 +276,7 @@ ContentClientRemoteBuffer::EndPaint(nsTArray<ReadbackProcessor::Update>* aReadba
void
ContentClientRemoteBuffer::BuildTextureClients(SurfaceFormat aFormat,
const nsIntRect& aRect,
const IntRect& aRect,
uint32_t aFlags)
{
// If we hit this assertion, then it might be due to an empty transaction
@ -304,7 +304,7 @@ ContentClientRemoteBuffer::BuildTextureClients(SurfaceFormat aFormat,
}
void
ContentClientRemoteBuffer::CreateBackBuffer(const nsIntRect& aBufferRect)
ContentClientRemoteBuffer::CreateBackBuffer(const IntRect& aBufferRect)
{
// gfx::BackendType::NONE means fallback to the content backend
mTextureClient = CreateTextureClientForDrawing(
@ -331,7 +331,7 @@ ContentClientRemoteBuffer::CreateBackBuffer(const nsIntRect& aBufferRect)
void
ContentClientRemoteBuffer::CreateBuffer(ContentType aType,
const nsIntRect& aRect,
const IntRect& aRect,
uint32_t aFlags,
RefPtr<gfx::DrawTarget>* aBlackDT,
RefPtr<gfx::DrawTarget>* aWhiteDT)
@ -487,7 +487,7 @@ ContentClientDoubleBuffered::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
mTextureClientOnWhite = mFrontClientOnWhite;
mFrontClientOnWhite = oldBack;
nsIntRect oldBufferRect = mBufferRect;
IntRect oldBufferRect = mBufferRect;
mBufferRect = mFrontBufferRect;
mFrontBufferRect = oldBufferRect;
@ -668,5 +668,5 @@ ContentClientSingleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
}
}
}
}
} // namespace layers
} // namespace mozilla

View File

@ -24,7 +24,7 @@
#include "ReadbackProcessor.h" // For ReadbackProcessor::Update
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "nsRect.h" // for mozilla::gfx::IntRect
#include "nsRegion.h" // for nsIntRegion
#include "nsTArray.h" // for nsTArray
@ -161,7 +161,7 @@ public:
aMask, aMaskTransform);
}
virtual void CreateBuffer(ContentType aType, const nsIntRect& aRect, uint32_t aFlags,
virtual void CreateBuffer(ContentType aType, const gfx::IntRect& aRect, uint32_t aFlags,
RefPtr<gfx::DrawTarget>* aBlackDT, RefPtr<gfx::DrawTarget>* aWhiteDT) override;
virtual TextureInfo GetTextureInfo() const override
@ -247,7 +247,7 @@ public:
virtual void SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) override;
// Expose these protected methods from the superclass.
virtual const nsIntRect& BufferRect() const
virtual const gfx::IntRect& BufferRect() const
{
return RotatedContentBuffer::BufferRect();
}
@ -256,7 +256,7 @@ public:
return RotatedContentBuffer::BufferRotation();
}
virtual void CreateBuffer(ContentType aType, const nsIntRect& aRect, uint32_t aFlags,
virtual void CreateBuffer(ContentType aType, const gfx::IntRect& aRect, uint32_t aFlags,
RefPtr<gfx::DrawTarget>* aBlackDT, RefPtr<gfx::DrawTarget>* aWhiteDT) override;
protected:
@ -267,10 +267,10 @@ protected:
bool aDidSelfCopy);
void BuildTextureClients(gfx::SurfaceFormat aFormat,
const nsIntRect& aRect,
const gfx::IntRect& aRect,
uint32_t aFlags);
void CreateBackBuffer(const nsIntRect& aBufferRect);
void CreateBackBuffer(const gfx::IntRect& aBufferRect);
// Ensure we have a valid back buffer if we have a valid front buffer (i.e.
// if a backbuffer has been created.)
@ -365,7 +365,7 @@ private:
RefPtr<TextureClient> mFrontClient;
RefPtr<TextureClient> mFrontClientOnWhite;
nsIntRegion mFrontUpdatedRegion;
nsIntRect mFrontBufferRect;
gfx::IntRect mFrontBufferRect;
nsIntPoint mFrontBufferRotation;
};

View File

@ -30,7 +30,7 @@
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_WARNING, NS_ASSERTION
#include "nsISupportsImpl.h" // for Image::Release, etc
#include "nsRect.h" // for nsIntRect
#include "nsRect.h" // for mozilla::gfx::IntRect
#include "mozilla/gfx/2D.h"
#ifdef MOZ_WIDGET_GONK
#include "GrallocImages.h"
@ -279,7 +279,7 @@ ImageClient::ImageClient(CompositableForwarder* aFwd, TextureFlags aFlags,
{}
void
ImageClient::UpdatePictureRect(nsIntRect aRect)
ImageClient::UpdatePictureRect(IntRect aRect)
{
if (mPictureRect == aRect) {
return;
@ -385,5 +385,5 @@ ImageClientOverlay::CreateImage(ImageFormat aFormat)
}
#endif
}
}
} // namespace layers
} // namespace mozilla

View File

@ -18,7 +18,7 @@
#include "mozilla/layers/TextureClient.h" // for TextureClient, etc
#include "mozilla/mozalloc.h" // for operator delete
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsRect.h" // for nsIntRect
#include "nsRect.h" // for mozilla::gfx::IntRect
namespace mozilla {
namespace layers {
@ -59,7 +59,7 @@ public:
* The picture rect is the area of the texture which makes up the image. That
* is, the area that should be composited. In texture space.
*/
virtual void UpdatePictureRect(nsIntRect aPictureRect);
virtual void UpdatePictureRect(gfx::IntRect aPictureRect);
virtual already_AddRefed<Image> CreateImage(ImageFormat aFormat) = 0;
@ -86,7 +86,7 @@ protected:
CompositableType mType;
int32_t mLastPaintedImageSerial;
nsIntRect mPictureRect;
gfx::IntRect mPictureRect;
};
/**

View File

@ -618,7 +618,7 @@ TileClient::ValidateBackBufferFromFront(const nsIntRegion& aDirtyRegion,
{
if (mBackBuffer && mFrontBuffer) {
gfx::IntSize tileSize = mFrontBuffer->GetSize();
const nsIntRect tileRect = nsIntRect(0, 0, tileSize.width, tileSize.height);
const IntRect tileRect = IntRect(0, 0, tileSize.width, tileSize.height);
if (aDirtyRegion.Contains(tileRect)) {
// The dirty region means that we no longer need the front buffer, so
@ -640,7 +640,7 @@ TileClient::ValidateBackBufferFromFront(const nsIntRegion& aDirtyRegion,
// Copy the bounding rect of regionToCopy. As tiles are quite small, it
// is unlikely that we'd save much by copying each individual rect of the
// region, but we can reevaluate this if it becomes an issue.
const nsIntRect rectToCopy = regionToCopy.GetBounds();
const IntRect rectToCopy = regionToCopy.GetBounds();
gfx::IntRect gfxRectToCopy(rectToCopy.x, rectToCopy.y, rectToCopy.width, rectToCopy.height);
CopyFrontToBack(mFrontBuffer, mBackBuffer, gfxRectToCopy);
@ -790,7 +790,7 @@ TileClient::GetBackBuffer(const nsIntRegion& aDirtyRegion,
MOZ_ASSERT(mBackLock->IsValid());
*aCreatedTextureClient = true;
mInvalidBack = nsIntRect(0, 0, mBackBuffer->GetSize().width, mBackBuffer->GetSize().height);
mInvalidBack = IntRect(0, 0, mBackBuffer->GetSize().width, mBackBuffer->GetSize().height);
}
ValidateBackBufferFromFront(aDirtyRegion, aAddPaintedRegion);
@ -902,7 +902,7 @@ ClientTiledLayerBuffer::PaintThebes(const nsIntRegion& aNewValidRegion,
if (!gfxPrefs::TiledDrawTargetEnabled()) {
nsRefPtr<gfxContext> ctxt;
const nsIntRect bounds = aPaintRegion.GetBounds();
const IntRect bounds = aPaintRegion.GetBounds();
{
PROFILER_LABEL("ClientTiledLayerBuffer", "PaintThebesSingleBufferAlloc",
js::ProfileEntry::Category::GRAPHICS);
@ -943,12 +943,12 @@ ClientTiledLayerBuffer::PaintThebes(const nsIntRegion& aNewValidRegion,
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
if (PR_IntervalNow() - start > 30) {
const nsIntRect bounds = aPaintRegion.GetBounds();
const IntRect bounds = aPaintRegion.GetBounds();
printf_stderr("Time to draw %i: %i, %i, %i, %i\n", PR_IntervalNow() - start, bounds.x, bounds.y, bounds.width, bounds.height);
if (aPaintRegion.IsComplex()) {
printf_stderr("Complex region\n");
nsIntRegionRectIterator it(aPaintRegion);
for (const nsIntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) {
for (const IntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) {
printf_stderr(" rect %i, %i, %i, %i\n", rect->x, rect->y, rect->width, rect->height);
}
}
@ -964,7 +964,7 @@ ClientTiledLayerBuffer::PaintThebes(const nsIntRegion& aNewValidRegion,
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
if (PR_IntervalNow() - start > 10) {
const nsIntRect bounds = aPaintRegion.GetBounds();
const IntRect bounds = aPaintRegion.GetBounds();
printf_stderr("Time to tile %i: %i, %i, %i, %i\n", PR_IntervalNow() - start, bounds.x, bounds.y, bounds.width, bounds.height);
}
#endif
@ -1204,7 +1204,7 @@ ClientTiledLayerBuffer::ValidateTile(TileClient aTile,
mTilingOrigin.y = std::min(mTilingOrigin.y, moz2DTile.mTileOrigin.y);
nsIntRegionRectIterator it(aDirtyRegion);
for (const nsIntRect* dirtyRect = it.Next(); dirtyRect != nullptr; dirtyRect = it.Next()) {
for (const IntRect* dirtyRect = it.Next(); dirtyRect != nullptr; dirtyRect = it.Next()) {
gfx::Rect drawRect(dirtyRect->x - aTileOrigin.x,
dirtyRect->y - aTileOrigin.y,
dirtyRect->width,
@ -1213,7 +1213,7 @@ ClientTiledLayerBuffer::ValidateTile(TileClient aTile,
// Mark the newly updated area as invalid in the front buffer
aTile.mInvalidFront.Or(aTile.mInvalidFront,
nsIntRect(NS_lroundf(drawRect.x), NS_lroundf(drawRect.y),
IntRect(NS_lroundf(drawRect.x), NS_lroundf(drawRect.y),
drawRect.width, drawRect.height));
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
@ -1247,7 +1247,7 @@ ClientTiledLayerBuffer::ValidateTile(TileClient aTile,
// XXX Perhaps we should just copy the bounding rectangle here?
RefPtr<gfx::SourceSurface> source = mSinglePaintDrawTarget->Snapshot();
nsIntRegionRectIterator it(aDirtyRegion);
for (const nsIntRect* dirtyRect = it.Next(); dirtyRect != nullptr; dirtyRect = it.Next()) {
for (const IntRect* dirtyRect = it.Next(); dirtyRect != nullptr; dirtyRect = it.Next()) {
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
printf_stderr(" break into subdirtyRect %i, %i, %i, %i\n",
dirtyRect->x, dirtyRect->y, dirtyRect->width, dirtyRect->height);
@ -1266,14 +1266,14 @@ ClientTiledLayerBuffer::ValidateTile(TileClient aTile,
drawTarget->CopySurface(source, copyRect, copyTarget);
// Mark the newly updated area as invalid in the front buffer
aTile.mInvalidFront.Or(aTile.mInvalidFront, nsIntRect(copyTarget.x, copyTarget.y, copyRect.width, copyRect.height));
aTile.mInvalidFront.Or(aTile.mInvalidFront, IntRect(copyTarget.x, copyTarget.y, copyRect.width, copyRect.height));
}
// only worry about padding when not doing low-res
// because it simplifies the math and the artifacts
// won't be noticable
if (mResolution == 1) {
nsIntRect unscaledTile = nsIntRect(aTileOrigin.x,
IntRect unscaledTile = IntRect(aTileOrigin.x,
aTileOrigin.y,
GetTileSize().width,
GetTileSize().height);
@ -1301,7 +1301,7 @@ ClientTiledLayerBuffer::ValidateTile(TileClient aTile,
drawTarget = nullptr;
nsIntRegion tileRegion =
nsIntRect(aTileOrigin.x, aTileOrigin.y,
IntRect(aTileOrigin.x, aTileOrigin.y,
GetScaledTileSize().width, GetScaledTileSize().height);
// Intersect this area with the portion that's invalid.
tileRegion.SubOut(GetValidRegion());
@ -1445,7 +1445,7 @@ ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInval
// make the progressive paint more visible to the user while scrolling.
// On B2G uploads are cheaper and we value coherency more, especially outside
// the browser, so we always use the entire user-visible area.
nsIntRect coherentUpdateRect(LayerIntRect::ToUntyped(RoundedOut(
IntRect coherentUpdateRect(LayerIntRect::ToUntyped(RoundedOut(
#ifdef MOZ_WIDGET_ANDROID
transformedCompositionBounds.Intersect(aPaintData->mCompositionBounds)
#else
@ -1481,7 +1481,7 @@ ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInval
// The following code decides what order to draw tiles in, based on the
// current scroll direction of the primary scrollable layer.
NS_ASSERTION(!aRegionToPaint.IsEmpty(), "Unexpectedly empty paint region!");
nsIntRect paintBounds = aRegionToPaint.GetBounds();
IntRect paintBounds = aRegionToPaint.GetBounds();
int startX, incX, startY, incY;
gfx::IntSize scaledTileSize = GetScaledTileSize();
@ -1502,7 +1502,7 @@ ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInval
}
// Find a tile to draw.
nsIntRect tileBounds(startX, startY, scaledTileSize.width, scaledTileSize.height);
IntRect tileBounds(startX, startY, scaledTileSize.width, scaledTileSize.height);
int32_t scrollDiffX = aPaintData->mScrollOffset.x - aPaintData->mLastScrollOffset.x;
int32_t scrollDiffY = aPaintData->mScrollOffset.y - aPaintData->mLastScrollOffset.y;
// This loop will always terminate, as there is at least one tile area
@ -1623,5 +1623,5 @@ TiledContentClient::Dump(std::stringstream& aStream,
mTiledBuffer.Dump(aStream, aPrefix, aDumpHtml);
}
}
}
} // namespace layers
} // namespace mozilla

View File

@ -29,7 +29,7 @@
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsISupportsImpl.h" // for MOZ_COUNT_DTOR
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "nsRect.h" // for mozilla::gfx::IntRect
#include "nsRegion.h" // for nsIntRegion
#include "nsTArray.h" // for nsTArray, nsTArray_Impl, etc
#include "nsExpirationTracker.h"