Bug 1155621 - Make nsIntRect and nsIntPoint typedefs of mozilla::gfx::IntRect and mozilla::gfx::IntPoint. r=Bas

This commit is contained in:
Nicolas Silva 2015-04-21 17:04:57 +02:00
parent 73014daec8
commit cfff5e52c5
131 changed files with 437 additions and 562 deletions

View File

@ -300,7 +300,7 @@ nsCoreUtils::ScrollFrameToPoint(nsIFrame *aScrollableFrame,
return;
nsPoint point =
aPoint.ToAppUnits(aFrame->PresContext()->AppUnitsPerDevPixel());
ToAppUnits(aPoint, aFrame->PresContext()->AppUnitsPerDevPixel());
nsRect frameRect = aFrame->GetScreenRectInAppUnits();
nsPoint deltaPoint(point.x - frameRect.x, point.y - frameRect.y);

View File

@ -15,13 +15,13 @@
#include "nsString.h"
#include "nsTArray.h"
#include "nsRefPtrHashtable.h"
#include "nsRect.h"
struct nsRoleMapEntry;
struct nsRect;
class nsIFrame;
class nsIAtom;
struct nsIntRect;
class nsIPersistentProperties;
class nsView;

View File

@ -1040,7 +1040,7 @@ HyperTextAccessible::OffsetAtPoint(int32_t aX, int32_t aY, uint32_t aCoordType)
nsPresContext* presContext = mDoc->PresContext();
nsPoint coordsInAppUnits =
coords.ToAppUnits(presContext->AppUnitsPerDevPixel());
ToAppUnits(coords, presContext->AppUnitsPerDevPixel());
nsRect frameScreenRect = hyperFrame->GetScreenRectInAppUnits();
if (!frameScreenRect.Contains(coordsInAppUnits.x, coordsInAppUnits.y))
@ -1568,7 +1568,7 @@ HyperTextAccessible::ScrollSubstringToPoint(int32_t aStartOffset,
nsPresContext* presContext = frame->PresContext();
nsPoint coordsInAppUnits =
coords.ToAppUnits(presContext->AppUnitsPerDevPixel());
ToAppUnits(coords, presContext->AppUnitsPerDevPixel());
bool initialScrolled = false;
nsIFrame *parentFrame = frame;

View File

@ -8,9 +8,9 @@ include protocol PContent;
include "mozilla/GfxMessageUtils.h";
using struct nsIntPoint from "nsRect.h";
using struct nsIntRect from "nsRect.h";
using nsIntRect from "nsRect.h";
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
namespace mozilla {
namespace a11y {
@ -135,7 +135,7 @@ child:
prio(high) sync PasteText(uint64_t aID, int32_t aPosition)
returns(bool aValid);
prio(high) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(nsIntPoint aRetVal);
prio(high) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(IntPoint aRetVal);
prio(high) sync ImageSize(uint64_t aID) returns(IntSize aRetVal);
prio(high) sync StartOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk);

View File

@ -14,9 +14,9 @@ interface nsIPrintSettings;
%{ C++
#include "nsTArray.h"
#include "nsRect.h"
class nsIWidget;
struct nsIntRect;
class nsIPresShell;
class nsPresContext;
class nsView;

View File

@ -22,7 +22,7 @@ interface nsIStructuredCloneContainer;
interface nsIBFCacheEntry;
%{C++
struct nsIntRect;
#include "nsRect.h"
class nsDocShellEditorData;
class nsSHEntryShared;
%}

View File

@ -11,12 +11,11 @@
#include "mozilla/EventForwards.h"
#include "nsCoord.h"
#include "nsIFrame.h"
#include "nsPoint.h"
class nsIScrollableFrame;
class nsITimer;
struct nsIntPoint;
namespace mozilla {
class EventStateManager;

View File

@ -37,9 +37,9 @@ using nscolor from "nsColor.h";
using class mozilla::WidgetCompositionEvent from "ipc/nsGUIEventIPC.h";
using struct mozilla::widget::IMENotification from "nsIWidget.h";
using struct nsIMEUpdatePreference from "nsIWidget.h";
using struct nsIntPoint from "nsPoint.h";
using struct nsIntRect from "nsRect.h";
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h";
using class mozilla::WidgetKeyboardEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetMouseEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetWheelEvent from "ipc/nsGUIEventIPC.h";
@ -488,11 +488,11 @@ parent:
uint64_t aObserverId);
SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
nsIntPoint aPointerScreenPoint,
IntPoint aPointerScreenPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
uint64_t aObserverId);
SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint,
SynthesizeNativeTouchTap(IntPoint aPointerScreenPoint,
bool aLongTap,
uint64_t aObserverId);
ClearNativeTouchSequence(uint64_t aObserverId);
@ -548,7 +548,7 @@ child:
CacheFileDescriptor(nsString path, FileDescriptor fd);
UpdateDimensions(nsIntRect rect, ScreenIntSize size, ScreenOrientation orientation,
UpdateDimensions(IntRect rect, ScreenIntSize size, ScreenOrientation orientation,
LayoutDeviceIntPoint chromeDisp) compress;
UpdateFrame(FrameMetrics frame);

View File

@ -6,7 +6,7 @@ include protocol PBrowser;
include "mozilla/GfxMessageUtils.h";
using struct nsIntRect from "nsRect.h";
using nsIntRect from "nsRect.h";
namespace mozilla {
namespace plugins {

View File

@ -8,7 +8,7 @@ include protocol PContent;
include "mozilla/GfxMessageUtils.h";
using struct nsIntRect from "nsRect.h";
using nsIntRect from "nsRect.h";
using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
namespace mozilla {

View File

@ -1085,7 +1085,7 @@ TabChild::Init()
}
mWidget->Create(
nullptr, 0, // no parents
nsIntRect(nsIntPoint(0, 0), nsIntSize(0, 0)),
gfx::IntRect(gfx::IntPoint(0, 0), gfx::IntSize(0, 0)),
nullptr // HandleWidgetEvent
);
@ -3179,7 +3179,7 @@ TabChild::CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut)
initData.mUnicode = false;
initData.clipChildren = true;
initData.clipSiblings = true;
nsresult rv = pluginWidget->Create(aParent, nullptr, nsIntRect(nsIntPoint(0, 0),
nsresult rv = pluginWidget->Create(aParent, nullptr, gfx::IntRect(gfx::IntPoint(0, 0),
nsIntSize(0, 0)), &initData);
if (NS_FAILED(rv)) {
NS_WARNING("Creating native plugin widget on the chrome side failed.");

View File

@ -12,6 +12,7 @@
#include "mozilla/CheckedInt.h"
#include "nsIThread.h"
#include "nsSize.h"
#include "nsRect.h"
#if !(defined(XP_WIN) || defined(XP_MACOSX) || defined(LINUX)) || \
defined(MOZ_ASAN)
@ -28,8 +29,6 @@ using mozilla::CheckedUint64;
using mozilla::CheckedInt32;
using mozilla::CheckedUint32;
struct nsIntRect;
// This file contains stuff we'd rather put elsewhere, but which is
// dependent on other changes which we don't want to wait for. We plan to
// remove this file in the near future.

View File

@ -9,8 +9,7 @@
#include "WMF.h"
#include "nsAutoPtr.h"
#include "mozilla/Mutex.h"
struct nsIntRect;
#include "nsRect.h"
namespace mozilla {

View File

@ -24,7 +24,6 @@
#endif
class nsIInputStream;
struct nsIntRect;
class nsPluginDOMContextMenuListener;
class nsPluginFrame;
class nsDisplayListBuilder;

View File

@ -26,7 +26,7 @@ using gfxIntSize from "nsSize.h";
using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
using mozilla::plugins::WindowsSharedMemoryHandle from "mozilla/plugins/PluginMessageUtils.h";
using mozilla::layers::SurfaceDescriptorX11 from "gfxipc/ShadowLayerUtils.h";
using struct nsIntRect from "nsRect.h";
using nsIntRect from "nsRect.h";
namespace mozilla {
namespace plugins {

View File

@ -15,10 +15,10 @@
#include "nsError.h"
#include "mozilla/EventForwards.h"
#include "nsSize.h"
#include "nsRect.h"
class gfxContext;
class nsCString;
struct nsIntRect;
class nsNPAPIPlugin;
namespace mozilla {

View File

@ -9,8 +9,7 @@
#include "npapi.h"
#include "mozilla/gfx/QuartzSupport.h"
struct nsIntRect;
#include "nsRect.h"
namespace mozilla {
namespace plugins {

View File

@ -8,6 +8,7 @@
#include "BaseRect.h"
#include "BaseMargin.h"
#include "NumericTools.h"
#include "Point.h"
#include "Tools.h"
@ -105,6 +106,21 @@ struct IntRectTyped :
{
return IntRectTyped<units>::IsEqualEdges(aRect);
}
void InflateToMultiple(const IntSizeTyped<units>& aTileSize)
{
int32_t yMost = this->YMost();
int32_t xMost = this->XMost();
this->x = RoundDownToMultiple(this->x, aTileSize.width);
this->y = RoundDownToMultiple(this->y, aTileSize.height);
xMost = RoundUpToMultiple(xMost, aTileSize.width);
yMost = RoundUpToMultiple(yMost, aTileSize.height);
this->width = xMost - this->x;
this->height = yMost - this->y;
}
};
typedef IntRectTyped<UnknownUnits> IntRect;

View File

@ -79,7 +79,7 @@ TextureImage::UpdateFromDataSource(gfx::DataSourceSurface *aSurface,
const gfx::IntPoint* aSrcPoint)
{
nsIntRegion destRegion = aDestRegion ? *aDestRegion
: nsIntRect(0, 0,
: IntRect(0, 0,
aSurface->GetSize().width,
aSurface->GetSize().height);
gfx::IntPoint srcPoint = aSrcPoint ? *aSrcPoint
@ -120,13 +120,13 @@ BasicTextureImage::BeginUpdate(nsIntRegion& aRegion)
if (CanUploadSubTextures(mGLContext)) {
GetUpdateRegion(aRegion);
} else {
aRegion = nsIntRect(nsIntPoint(0, 0), mSize);
aRegion = IntRect(IntPoint(0, 0), mSize);
}
mUpdateRegion = aRegion;
nsIntRect rgnSize = mUpdateRegion.GetBounds();
if (!nsIntRect(nsIntPoint(0, 0), mSize).Contains(rgnSize)) {
IntRect rgnSize = mUpdateRegion.GetBounds();
if (!IntRect(IntPoint(0, 0), mSize).Contains(rgnSize)) {
NS_ERROR("update outside of image");
return nullptr;
}
@ -147,7 +147,7 @@ BasicTextureImage::GetUpdateRegion(nsIntRegion& aForRegion)
// changed, we need to recreate our backing surface and force the
// client to paint everything
if (mTextureState != Valid) {
aForRegion = nsIntRect(nsIntPoint(0, 0), mSize);
aForRegion = IntRect(IntPoint(0, 0), mSize);
}
}
@ -169,7 +169,7 @@ BasicTextureImage::EndUpdate()
mUpdateRegion,
mTexture,
mTextureState == Created,
mUpdateOffset,
ToIntPoint(mUpdateOffset),
relative);
FinishedSurfaceUpload();
@ -205,10 +205,10 @@ BasicTextureImage::FinishedSurfaceUpload()
bool
BasicTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, const gfx::IntPoint& aFrom /* = gfx::IntPoint(0, 0) */)
{
nsIntRect bounds = aRegion.GetBounds();
IntRect bounds = aRegion.GetBounds();
nsIntRegion region;
if (mTextureState != Valid) {
bounds = nsIntRect(0, 0, mSize.width, mSize.height);
bounds = IntRect(0, 0, mSize.width, mSize.height);
region = nsIntRegion(bounds);
} else {
region = aRegion;
@ -220,7 +220,7 @@ BasicTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
region,
mTexture,
mTextureState == Created,
bounds.TopLeft() + nsIntPoint(aFrom.x, aFrom.y),
bounds.TopLeft() + IntPoint(aFrom.x, aFrom.y),
false);
mTextureState = Valid;
return true;
@ -345,7 +345,7 @@ TiledTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
nsIntRegion region;
if (mTextureState != Valid) {
nsIntRect bounds = nsIntRect(0, 0, mSize.width, mSize.height);
IntRect bounds = IntRect(0, 0, mSize.width, mSize.height);
region = nsIntRegion(bounds);
} else {
region = aRegion;
@ -355,7 +355,7 @@ TiledTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
int oldCurrentImage = mCurrentImage;
BeginBigImageIteration();
do {
nsIntRect tileRect = ThebesIntRect(GetSrcTileRect());
IntRect tileRect = ThebesIntRect(GetSrcTileRect());
int xPos = tileRect.x;
int yPos = tileRect.y;
@ -400,7 +400,7 @@ TiledTextureImage::GetUpdateRegion(nsIntRegion& aForRegion)
// if the texture hasn't been initialized yet, or something important
// changed, we need to recreate our backing surface and force the
// client to paint everything
aForRegion = nsIntRect(nsIntPoint(0, 0), mSize);
aForRegion = IntRect(IntPoint(0, 0), mSize);
return;
}
@ -411,7 +411,7 @@ TiledTextureImage::GetUpdateRegion(nsIntRegion& aForRegion)
for (unsigned i = 0; i < mImages.Length(); i++) {
int xPos = (i % mColumns) * mTileSize;
int yPos = (i / mColumns) * mTileSize;
nsIntRect imageRect = nsIntRect(nsIntPoint(xPos,yPos),
IntRect imageRect = IntRect(IntPoint(xPos,yPos),
mImages[i]->GetSize());
if (aForRegion.Intersects(imageRect)) {
@ -446,16 +446,16 @@ TiledTextureImage::BeginUpdate(nsIntRegion& aRegion)
// if the texture hasn't been initialized yet, or something important
// changed, we need to recreate our backing surface and force the
// client to paint everything
aRegion = nsIntRect(nsIntPoint(0, 0), mSize);
aRegion = IntRect(IntPoint(0, 0), mSize);
}
nsIntRect bounds = aRegion.GetBounds();
IntRect bounds = aRegion.GetBounds();
for (unsigned i = 0; i < mImages.Length(); i++) {
int xPos = (i % mColumns) * mTileSize;
int yPos = (i / mColumns) * mTileSize;
nsIntRegion imageRegion =
nsIntRegion(nsIntRect(nsIntPoint(xPos,yPos),
nsIntRegion(IntRect(IntPoint(xPos,yPos),
mImages[i]->GetSize()));
// a single Image can handle this update request
@ -510,8 +510,7 @@ TiledTextureImage::EndUpdate()
for (unsigned i = 0; i < mImages.Length(); i++) {
int xPos = (i % mColumns) * mTileSize;
int yPos = (i / mColumns) * mTileSize;
nsIntRect imageRect = nsIntRect(nsIntPoint(xPos,yPos),
mImages[i]->GetSize());
IntRect imageRect = IntRect(IntPoint(xPos,yPos), mImages[i]->GetSize());
nsIntRegion subregion;
subregion.And(mUpdateRegion, imageRect);

View File

@ -50,7 +50,7 @@ NextPowerOfTwo(int aNumber)
}
static unsigned int
DataOffset(const nsIntPoint &aPoint, int32_t aStride, SurfaceFormat aFormat)
DataOffset(const IntPoint &aPoint, int32_t aStride, SurfaceFormat aFormat)
{
unsigned int data = aPoint.y * aStride;
data += aPoint.x * BytesPerPixel(aFormat);
@ -502,10 +502,10 @@ UploadImageDataToTexture(GLContext* gl,
}
nsIntRegionRectIterator iter(paintRegion);
const nsIntRect *iterRect;
const IntRect *iterRect;
// Top left point of the region's bounding rectangle.
nsIntPoint topLeft = paintRegion.GetBounds().TopLeft();
IntPoint topLeft = paintRegion.GetBounds().TopLeft();
while ((iterRect = iter.Next())) {
// The inital data pointer is at the top left point of the region's
@ -556,7 +556,7 @@ UploadSurfaceToTexture(GLContext* gl,
const nsIntRegion& aDstRegion,
GLuint& aTexture,
bool aOverwrite,
const nsIntPoint& aSrcPoint,
const gfx::IntPoint& aSrcPoint,
bool aPixelBuffer,
GLenum aTextureUnit,
GLenum aTextureTarget)

View File

@ -74,7 +74,7 @@ UploadSurfaceToTexture(GLContext* gl,
const nsIntRegion& aDstRegion,
GLuint& aTexture,
bool aOverwrite = false,
const nsIntPoint& aSrcPoint = nsIntPoint(0, 0),
const gfx::IntPoint& aSrcPoint = gfx::IntPoint(0, 0),
bool aPixelBuffer = false,
GLenum aTextureUnit = LOCAL_GL_TEXTURE0,
GLenum aTextureTarget = LOCAL_GL_TEXTURE_2D);

View File

@ -102,7 +102,7 @@ TextureImageEGL::GetUpdateRegion(nsIntRegion& aForRegion)
if (mTextureState != Valid) {
// if the texture hasn't been initialized yet, force the
// client to paint everything
aForRegion = nsIntRect(nsIntPoint(0, 0), mSize);
aForRegion = gfx::IntRect(gfx::IntPoint(0, 0), mSize);
}
// We can only draw a rectangle, not subregions due to
@ -122,7 +122,7 @@ TextureImageEGL::BeginUpdate(nsIntRegion& aRegion)
mUpdateRect = aRegion.GetBounds();
//printf_stderr("BeginUpdate with updateRect [%d %d %d %d]\n", mUpdateRect.x, mUpdateRect.y, mUpdateRect.width, mUpdateRect.height);
if (!nsIntRect(nsIntPoint(0, 0), mSize).Contains(mUpdateRect)) {
if (!gfx::IntRect(gfx::IntPoint(0, 0), mSize).Contains(mUpdateRect)) {
NS_ERROR("update outside of image");
return nullptr;
}
@ -198,11 +198,11 @@ TextureImageEGL::EndUpdate()
bool
TextureImageEGL::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, const gfx::IntPoint& aFrom /* = gfx::IntPoint(0,0) */)
{
nsIntRect bounds = aRegion.GetBounds();
gfx::IntRect bounds = aRegion.GetBounds();
nsIntRegion region;
if (mTextureState != Valid) {
bounds = nsIntRect(0, 0, mSize.width, mSize.height);
bounds = gfx::IntRect(0, 0, mSize.width, mSize.height);
region = nsIntRegion(bounds);
} else {
region = aRegion;
@ -214,7 +214,7 @@ TextureImageEGL::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion&
region,
mTexture,
mTextureState == Created,
bounds.TopLeft() + nsIntPoint(aFrom.x, aFrom.y),
bounds.TopLeft() + gfx::IntPoint(aFrom.x, aFrom.y),
false);
mTextureState = Valid;

View File

@ -391,28 +391,6 @@ struct ParamTraits<mozilla::gfx::IntSizeTyped<T> >
}
};
template<>
struct ParamTraits<nsIntRect>
{
typedef nsIntRect paramType;
static void Write(Message* msg, const paramType& param)
{
WriteParam(msg, param.x);
WriteParam(msg, param.y);
WriteParam(msg, param.width);
WriteParam(msg, param.height);
}
static bool Read(const Message* msg, void** iter, paramType* result)
{
return (ReadParam(msg, iter, &result->x) &&
ReadParam(msg, iter, &result->y) &&
ReadParam(msg, iter, &result->width) &&
ReadParam(msg, iter, &result->height));
}
};
template<typename Region, typename Rect, typename Iter>
struct RegionParamTraits
{

View File

@ -21,8 +21,7 @@
#include "nsDebug.h" // for NS_ASSERTION
#include "nsHashKeys.h" // for nsPtrHashKey
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "nsRect.h" // for IntRect
#include "nsTArray.h" // for nsAutoTArray, nsTArray_Impl
using namespace mozilla::gfx;
@ -33,20 +32,20 @@ namespace layers {
struct LayerPropertiesBase;
UniquePtr<LayerPropertiesBase> CloneLayerTreePropertiesInternal(Layer* aRoot, bool aIsMask = false);
static nsIntRect
TransformRect(const nsIntRect& aRect, const Matrix4x4& aTransform)
static IntRect
TransformRect(const IntRect& aRect, const Matrix4x4& aTransform)
{
if (aRect.IsEmpty()) {
return nsIntRect();
return IntRect();
}
Rect rect(aRect.x, aRect.y, aRect.width, aRect.height);
rect = aTransform.TransformBounds(rect);
rect.RoundOut();
nsIntRect intRect;
IntRect intRect;
if (!gfxUtils::GfxRectToIntRect(ThebesRect(rect), &intRect)) {
return nsIntRect();
return IntRect();
}
return intRect;
@ -56,7 +55,7 @@ static void
AddTransformedRegion(nsIntRegion& aDest, const nsIntRegion& aSource, const Matrix4x4& aTransform)
{
nsIntRegionRectIterator iter(aSource);
const nsIntRect *r;
const IntRect *r;
while ((r = iter.Next())) {
aDest.Or(aDest, TransformRect(*r, aTransform));
}
@ -132,7 +131,7 @@ struct LayerPropertiesBase : public LayerProperties
NotifySubDocInvalidationFunc aCallback,
bool* aGeometryChanged);
virtual void MoveBy(const nsIntPoint& aOffset);
virtual void MoveBy(const IntPoint& aOffset);
nsIntRegion ComputeChange(NotifySubDocInvalidationFunc aCallback,
bool& aGeometryChanged)
@ -176,12 +175,12 @@ struct LayerPropertiesBase : public LayerProperties
return result;
}
nsIntRect NewTransformedBounds()
IntRect NewTransformedBounds()
{
return TransformRect(mLayer->GetVisibleRegion().GetBounds(), mLayer->GetLocalTransform());
}
nsIntRect OldTransformedBounds()
IntRect OldTransformedBounds()
{
return TransformRect(mVisibleRegion.GetBounds(), mTransform);
}
@ -189,7 +188,7 @@ struct LayerPropertiesBase : public LayerProperties
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
bool& aGeometryChanged)
{
return nsIntRect();
return IntRect();
}
nsRefPtr<Layer> mLayer;
@ -351,7 +350,7 @@ struct ColorLayerProperties : public LayerPropertiesBase
}
gfxRGBA mColor;
nsIntRect mBounds;
IntRect mBounds;
};
struct ImageLayerProperties : public LayerPropertiesBase
@ -373,7 +372,7 @@ struct ImageLayerProperties : public LayerPropertiesBase
if (!imageLayer->GetVisibleRegion().IsEqual(mVisibleRegion)) {
aGeometryChanged = true;
nsIntRect result = NewTransformedBounds();
IntRect result = NewTransformedBounds();
result = result.Union(OldTransformedBounds());
return result;
}
@ -389,7 +388,7 @@ struct ImageLayerProperties : public LayerPropertiesBase
// Mask layers have an empty visible region, so we have to
// use the image size instead.
IntSize size = container->GetCurrentSize();
nsIntRect rect(0, 0, size.width, size.height);
IntRect rect(0, 0, size.width, size.height);
return TransformRect(rect, mLayer->GetLocalTransform());
} else {
@ -397,7 +396,7 @@ struct ImageLayerProperties : public LayerPropertiesBase
}
}
return nsIntRect();
return IntRect();
}
nsRefPtr<ImageContainer> mContainer;
@ -466,7 +465,7 @@ LayerPropertiesBase::ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFu
} else {
ClearInvalidations(aRoot);
}
nsIntRect result = TransformRect(aRoot->GetVisibleRegion().GetBounds(),
IntRect result = TransformRect(aRoot->GetVisibleRegion().GetBounds(),
aRoot->GetLocalTransform());
result = result.Union(OldTransformedBounds());
if (aGeometryChanged != nullptr) {
@ -484,7 +483,7 @@ LayerPropertiesBase::ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFu
}
void
LayerPropertiesBase::MoveBy(const nsIntPoint& aOffset)
LayerPropertiesBase::MoveBy(const IntPoint& aOffset)
{
mTransform.PostTranslate(aOffset.x, aOffset.y, 0);
}

View File

@ -8,9 +8,9 @@
#include "nsRegion.h" // for nsIntRegion
#include "mozilla/UniquePtr.h" // for UniquePtr
#include "mozilla/gfx/Point.h"
class nsPresContext;
struct nsIntPoint;
namespace mozilla {
namespace layers {
@ -63,8 +63,7 @@ struct LayerProperties
NotifySubDocInvalidationFunc aCallback,
bool* aGeometryChanged = nullptr) = 0;
virtual void MoveBy(const nsIntPoint& aOffset) = 0;
virtual void MoveBy(const gfx::IntPoint& aOffset) = 0;
};
} // namespace layers

View File

@ -17,8 +17,6 @@
#include "nscore.h" // for nsACString, etc
struct gfxRGBA;
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace gfx {
@ -52,10 +50,6 @@ void
AppendToString(std::stringstream& aStream, const nsRect& r,
const char* pfx="", const char* sfx="");
void
AppendToString(std::stringstream& aStream, const nsIntPoint& p,
const char* pfx="", const char* sfx="");
template<class T>
void
AppendToString(std::stringstream& aStream, const mozilla::gfx::PointTyped<T>& p,
@ -72,10 +66,6 @@ AppendToString(std::stringstream& aStream, const mozilla::gfx::IntPointTyped<T>&
aStream << pfx << p << sfx;
}
void
AppendToString(std::stringstream& aStream, const nsIntRect& r,
const char* pfx="", const char* sfx="");
template<class T>
void
AppendToString(std::stringstream& aStream, const mozilla::gfx::RectTyped<T>& r,

View File

@ -9,14 +9,13 @@
#include <stdint.h> // for uint64_t
#include "Layers.h" // for Layer, etc
#include "gfxColor.h" // for gfxRGBA
#include "gfxRect.h" // for gfxRect
#include "mozilla/gfx/Rect.h" // for gfxRect
#include "mozilla/gfx/Point.h" // for gfxRect
#include "mozilla/mozalloc.h" // for operator delete
#include "nsAutoPtr.h" // for nsAutoPtr
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_ASSERTION
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "nsSize.h" // for nsIntSize
#include "nscore.h" // for nsACString
class gfxContext;
@ -61,14 +60,14 @@ public:
* first BeginUpdate after a SetUnknown will have the complete background.
*/
virtual already_AddRefed<gfxContext>
BeginUpdate(const nsIntRect& aRect, uint64_t aSequenceNumber) = 0;
BeginUpdate(const gfx::IntRect& aRect, uint64_t aSequenceNumber) = 0;
/**
* EndUpdate must be called immediately after BeginUpdate, without returning
* to the event loop.
* @param aContext the context returned by BeginUpdate
* Implicitly Restore()s the state of aContext.
*/
virtual void EndUpdate(gfxContext* aContext, const nsIntRect& aRect) = 0;
virtual void EndUpdate(gfxContext* aContext, const gfx::IntRect& aRect) = 0;
};
/**
@ -122,13 +121,13 @@ public:
* has its top-left at 0,0 and has size aSize.
* Can only be called while the sink is null!
*/
void SetSize(const nsIntSize& aSize)
void SetSize(const gfx::IntSize& aSize)
{
NS_ASSERTION(!mSink, "Should have no sink while changing size!");
mSize = aSize;
}
const nsIntSize& GetSize() { return mSize; }
nsIntRect GetRect() { return nsIntRect(nsIntPoint(0, 0), mSize); }
const gfx::IntSize& GetSize() { return mSize; }
gfx::IntRect GetRect() { return gfx::IntRect(gfx::IntPoint(0, 0), mSize); }
bool IsBackgroundKnown()
{
@ -180,7 +179,7 @@ protected:
uint64_t mSequenceCounter;
nsAutoPtr<ReadbackSink> mSink;
nsIntSize mSize;
gfx::IntSize mSize;
// This can refer to any (earlier) sibling PaintedLayer. That PaintedLayer
// must have mUsedForReadback set on it. If the PaintedLayer is removed

View File

@ -34,12 +34,12 @@ using namespace gfx;
namespace layers {
nsIntRect
IntRect
RotatedBuffer::GetQuadrantRectangle(XSide aXSide, YSide aYSide) const
{
// quadrantTranslation is the amount we translate the top-left
// of the quadrant by to get coordinates relative to the layer
nsIntPoint quadrantTranslation = -mBufferRotation;
IntPoint quadrantTranslation = -mBufferRotation;
quadrantTranslation.x += aXSide == LEFT ? mBufferRect.width : 0;
quadrantTranslation.y += aYSide == TOP ? mBufferRect.height : 0;
return mBufferRect + quadrantTranslation;
@ -89,8 +89,8 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
// render the buffer at mBufferRect + quadrantTranslation to get the
// pixels in the right place, but we're only going to paint within
// mBufferRect
nsIntRect quadrantRect = GetQuadrantRectangle(aXSide, aYSide);
nsIntRect fillRect;
IntRect quadrantRect = GetQuadrantRectangle(aXSide, aYSide);
IntRect fillRect;
if (!fillRect.IntersectRect(mBufferRect, quadrantRect))
return;
@ -241,11 +241,11 @@ RotatedContentBuffer::DrawTo(PaintedLayer* aLayer,
}
DrawTarget*
RotatedContentBuffer::BorrowDrawTargetForQuadrantUpdate(const nsIntRect& aBounds,
RotatedContentBuffer::BorrowDrawTargetForQuadrantUpdate(const IntRect& aBounds,
ContextSource aSource,
DrawIterator* aIter)
{
nsIntRect bounds = aBounds;
IntRect bounds = aBounds;
if (aIter) {
// If an iterator was provided, then BeginPaint must have been run with
// PAINT_CAN_DRAW_ROTATED, and the draw region might cover multiple quadrants.
@ -254,7 +254,7 @@ RotatedContentBuffer::BorrowDrawTargetForQuadrantUpdate(const nsIntRect& aBounds
// quadrants we have considered across multiple calls to this function.
aIter->mDrawRegion.SetEmpty();
while (aIter->mCount < 4) {
nsIntRect quadrant = GetQuadrantRectangle((aIter->mCount & 1) ? LEFT : RIGHT,
IntRect quadrant = GetQuadrantRectangle((aIter->mCount & 1) ? LEFT : RIGHT,
(aIter->mCount & 2) ? TOP : BOTTOM);
aIter->mDrawRegion.And(aBounds, quadrant);
aIter->mCount++;
@ -294,7 +294,7 @@ RotatedContentBuffer::BorrowDrawTargetForQuadrantUpdate(const nsIntRect& aBounds
int32_t yBoundary = mBufferRect.YMost() - mBufferRotation.y;
XSide sideX = bounds.XMost() <= xBoundary ? RIGHT : LEFT;
YSide sideY = bounds.YMost() <= yBoundary ? BOTTOM : TOP;
nsIntRect quadrantRect = GetQuadrantRectangle(sideX, sideY);
IntRect quadrantRect = GetQuadrantRectangle(sideX, sideY);
NS_ASSERTION(quadrantRect.Contains(bounds), "Messed up quadrants");
mLoanedTransform = mLoanedDrawTarget->GetTransform();
@ -390,10 +390,10 @@ WrapRotationAxis(int32_t* aRotationPoint, int32_t aSize)
}
}
static nsIntRect
ComputeBufferRect(const nsIntRect& aRequestedRect)
static IntRect
ComputeBufferRect(const IntRect& aRequestedRect)
{
nsIntRect rect(aRequestedRect);
IntRect rect(aRequestedRect);
// Set a minimum width to guarantee a minimum size of buffers we
// allocate (and work around problems on some platforms with smaller
// dimensions). 64 is the magic number needed to work around the
@ -447,7 +447,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
SurfaceMode mode;
nsIntRegion neededRegion;
nsIntRect destBufferRect;
IntRect destBufferRect;
bool canReuseBuffer = HaveBuffer();
@ -464,7 +464,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
} else if (neededRegion.GetBounds().Size() <= mBufferRect.Size()) {
// The buffer's big enough but doesn't contain everything that's
// going to be visible. We'll move it.
destBufferRect = nsIntRect(neededRegion.GetBounds().TopLeft(), mBufferRect.Size());
destBufferRect = IntRect(neededRegion.GetBounds().TopLeft(), mBufferRect.Size());
} else {
destBufferRect = neededRegion.GetBounds();
}
@ -555,7 +555,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
FinalizeFrame(result.mRegionToDraw);
}
nsIntRect drawBounds = result.mRegionToDraw.GetBounds();
IntRect drawBounds = result.mRegionToDraw.GetBounds();
RefPtr<DrawTarget> destDTBuffer;
RefPtr<DrawTarget> destDTBufferOnWhite;
uint32_t bufferFlags = 0;
@ -566,40 +566,38 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
if (!EnsureBuffer()) {
return result;
}
nsIntRect keepArea;
IntRect keepArea;
if (keepArea.IntersectRect(destBufferRect, mBufferRect)) {
// Set mBufferRotation so that the pixels currently in mDTBuffer
// will still be rendered in the right place when mBufferRect
// changes to destBufferRect.
nsIntPoint newRotation = mBufferRotation +
IntPoint newRotation = mBufferRotation +
(destBufferRect.TopLeft() - mBufferRect.TopLeft());
WrapRotationAxis(&newRotation.x, mBufferRect.width);
WrapRotationAxis(&newRotation.y, mBufferRect.height);
NS_ASSERTION(nsIntRect(nsIntPoint(0,0), mBufferRect.Size()).Contains(newRotation),
NS_ASSERTION(gfx::IntRect(gfx::IntPoint(0,0), mBufferRect.Size()).Contains(newRotation),
"newRotation out of bounds");
int32_t xBoundary = destBufferRect.XMost() - newRotation.x;
int32_t yBoundary = destBufferRect.YMost() - newRotation.y;
bool drawWrapsBuffer = (drawBounds.x < xBoundary && xBoundary < drawBounds.XMost()) ||
(drawBounds.y < yBoundary && yBoundary < drawBounds.YMost());
if ((drawWrapsBuffer && !(aFlags & PAINT_CAN_DRAW_ROTATED)) ||
(newRotation != nsIntPoint(0,0) && !canHaveRotation)) {
(newRotation != IntPoint(0,0) && !canHaveRotation)) {
// The stuff we need to redraw will wrap around an edge of the
// buffer (and the caller doesn't know how to support that), so
// move the pixels we can keep into a position that lets us
// redraw in just one quadrant.
if (mBufferRotation == nsIntPoint(0,0)) {
nsIntRect srcRect(nsIntPoint(0, 0), mBufferRect.Size());
nsIntPoint dest = mBufferRect.TopLeft() - destBufferRect.TopLeft();
if (mBufferRotation == IntPoint(0,0)) {
IntRect srcRect(IntPoint(0, 0), mBufferRect.Size());
IntPoint dest = mBufferRect.TopLeft() - destBufferRect.TopLeft();
MOZ_ASSERT(mDTBuffer);
mDTBuffer->CopyRect(IntRect(srcRect.x, srcRect.y, srcRect.width, srcRect.height),
IntPoint(dest.x, dest.y));
mDTBuffer->CopyRect(srcRect, dest);
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
if (!EnsureBufferOnWhite()) {
return result;
}
MOZ_ASSERT(mDTBufferOnWhite);
mDTBufferOnWhite->CopyRect(IntRect(srcRect.x, srcRect.y, srcRect.width, srcRect.height),
IntPoint(dest.x, dest.y));
mDTBufferOnWhite->CopyRect(srcRect, dest);
}
result.mDidSelfCopy = true;
mDidSelfCopy = true;
@ -641,7 +639,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
result.mDidSelfCopy = true;
mDidSelfCopy = true;
mBufferRect = destBufferRect;
mBufferRotation = nsIntPoint(0, 0);
mBufferRotation = IntPoint(0, 0);
}
if (!result.mDidSelfCopy) {
@ -664,7 +662,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
// will be redrawn, so we don't need to copy anything, so we don't
// set destBuffer.
mBufferRect = destBufferRect;
mBufferRotation = nsIntPoint(0,0);
mBufferRotation = IntPoint(0,0);
}
} else {
// The buffer's not big enough, so allocate a new one
@ -687,7 +685,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
if (destDTBuffer) {
if (!isClear && (mode != SurfaceMode::SURFACE_COMPONENT_ALPHA || HaveBufferOnWhite())) {
// Copy the bits
nsIntPoint offset = -destBufferRect.TopLeft();
IntPoint offset = -destBufferRect.TopLeft();
Matrix mat = Matrix::Translation(offset.x, offset.y);
destDTBuffer->SetTransform(mat);
if (!EnsureBuffer()) {
@ -711,9 +709,9 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
mDTBuffer = destDTBuffer.forget();
mDTBufferOnWhite = destDTBufferOnWhite.forget();
mBufferRect = destBufferRect;
mBufferRotation = nsIntPoint(0,0);
mBufferRotation = IntPoint(0,0);
}
NS_ASSERTION(canHaveRotation || mBufferRotation == nsIntPoint(0,0),
NS_ASSERTION(canHaveRotation || mBufferRotation == IntPoint(0,0),
"Rotation disabled, but we have nonzero rotation?");
nsIntRegion invalidate;
@ -758,7 +756,7 @@ RotatedContentBuffer::BorrowDrawTargetForPainting(PaintState& aPaintState,
return nullptr;
}
nsIntRegionRectIterator iter(*drawPtr);
const nsIntRect *iterRect;
const IntRect *iterRect;
while ((iterRect = iter.Next())) {
mDTBuffer->FillRect(Rect(iterRect->x, iterRect->y, iterRect->width, iterRect->height),
ColorPattern(Color(0.0, 0.0, 0.0, 1.0)));
@ -768,7 +766,7 @@ RotatedContentBuffer::BorrowDrawTargetForPainting(PaintState& aPaintState,
} else if (aPaintState.mContentType == gfxContentType::COLOR_ALPHA && HaveBuffer()) {
// HaveBuffer() => we have an existing buffer that we must clear
nsIntRegionRectIterator iter(*drawPtr);
const nsIntRect *iterRect;
const IntRect *iterRect;
while ((iterRect = iter.Next())) {
result->ClearRect(Rect(iterRect->x, iterRect->y, iterRect->width, iterRect->height));
}

View File

@ -16,8 +16,6 @@
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_RUNTIMEABORT
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "nsRegion.h" // for nsIntRegion
#include "LayersTypes.h"
@ -50,8 +48,8 @@ class RotatedBuffer {
public:
typedef gfxContentType ContentType;
RotatedBuffer(const nsIntRect& aBufferRect,
const nsIntPoint& aBufferRotation)
RotatedBuffer(const gfx::IntRect& aBufferRect,
const gfx::IntPoint& aBufferRotation)
: mBufferRect(aBufferRect)
, mBufferRotation(aBufferRotation)
, mDidSelfCopy(false)
@ -81,8 +79,8 @@ public:
* RotatedBuffer covers. That is what DrawBufferWithRotation()
* will paint when it's called.
*/
const nsIntRect& BufferRect() const { return mBufferRect; }
const nsIntPoint& BufferRotation() const { return mBufferRotation; }
const gfx::IntRect& BufferRect() const { return mBufferRect; }
const gfx::IntPoint& BufferRotation() const { return mBufferRotation; }
virtual bool HaveBuffer() const = 0;
virtual bool HaveBufferOnWhite() const = 0;
@ -97,7 +95,7 @@ protected:
enum YSide {
TOP, BOTTOM
};
nsIntRect GetQuadrantRectangle(XSide aXSide, YSide aYSide) const;
gfx::IntRect GetQuadrantRectangle(XSide aXSide, YSide aYSide) const;
gfx::Rect GetSourceRectangle(XSide aXSide, YSide aYSide) const;
@ -114,7 +112,7 @@ protected:
const gfx::Matrix* aMaskTransform) const;
/** The area of the PaintedLayer that is covered by the buffer as a whole */
nsIntRect mBufferRect;
gfx::IntRect mBufferRect;
/**
* The x and y rotation of the buffer. Conceptually the buffer
* has its origin translated to mBufferRect.TopLeft() - mBufferRotation,
@ -125,7 +123,7 @@ protected:
* where items falling off the end of the buffer are returned to the
* buffer at the other end, not 2D rotation!
*/
nsIntPoint mBufferRotation;
gfx::IntPoint mBufferRotation;
// When this is true it means that all pixels have moved inside the buffer.
// It's not possible to sync with another buffer without a full copy.
bool mDidSelfCopy;
@ -135,8 +133,8 @@ class SourceRotatedBuffer : public RotatedBuffer
{
public:
SourceRotatedBuffer(gfx::SourceSurface* aSource, gfx::SourceSurface* aSourceOnWhite,
const nsIntRect& aBufferRect,
const nsIntPoint& aBufferRotation)
const gfx::IntRect& aBufferRect,
const gfx::IntPoint& aBufferRotation)
: RotatedBuffer(aBufferRect, aBufferRotation)
, mSource(aSource)
, mSourceOnWhite(aSourceOnWhite)
@ -310,7 +308,7 @@ public:
* will be used.
*/
virtual void
CreateBuffer(ContentType aType, const nsIntRect& aRect, uint32_t aFlags,
CreateBuffer(ContentType aType, const gfx::IntRect& aRect, uint32_t aFlags,
RefPtr<gfx::DrawTarget>* aBlackDT, RefPtr<gfx::DrawTarget>* aWhiteDT) = 0;
/**
@ -375,7 +373,7 @@ protected:
* draw target, if necessary.
*/
gfx::DrawTarget*
BorrowDrawTargetForQuadrantUpdate(const nsIntRect& aBounds,
BorrowDrawTargetForQuadrantUpdate(const gfx::IntRect& aBounds,
ContextSource aSource,
DrawIterator* aIter);

View File

@ -14,7 +14,6 @@
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "nsRegion.h" // for nsIntRegion
#include "ReadbackProcessor.h"
@ -78,7 +77,7 @@ BasicContainerLayer::ComputeEffectiveTransforms(const Matrix4x4& aTransformToSur
}
bool
BasicContainerLayer::ChildrenPartitionVisibleRegion(const nsIntRect& aInRect)
BasicContainerLayer::ChildrenPartitionVisibleRegion(const gfx::IntRect& aInRect)
{
Matrix transform;
if (!GetEffectiveTransform().CanDraw2D(&transform) ||
@ -86,7 +85,7 @@ BasicContainerLayer::ChildrenPartitionVisibleRegion(const nsIntRect& aInRect)
return false;
nsIntPoint offset(int32_t(transform._31), int32_t(transform._32));
nsIntRect rect = aInRect.Intersect(GetEffectiveVisibleRegion().GetBounds() + offset);
gfx::IntRect rect = aInRect.Intersect(GetEffectiveVisibleRegion().GetBounds() + offset);
nsIntRegion covered;
for (Layer* l = mFirstChild; l; l = l->GetNextSibling()) {

View File

@ -12,7 +12,7 @@
#include "nsDebug.h" // for NS_ASSERTION
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR
#include "nsISupportsUtils.h" // for NS_ADDREF, NS_RELEASE
struct nsIntRect;
#include "mozilla/gfx/Rect.h"
namespace mozilla {
namespace layers {
@ -77,7 +77,7 @@ public:
* This method can be conservative; it's OK to return false under any
* circumstances.
*/
bool ChildrenPartitionVisibleRegion(const nsIntRect& aInRect);
bool ChildrenPartitionVisibleRegion(const gfx::IntRect& aInRect);
void ForceIntermediateSurface() { mUseIntermediateSurface = true; }

View File

@ -18,7 +18,6 @@
#include "mozilla/layers/LayersMessages.h"
#include "mozilla/mozalloc.h" // for operator delete, etc
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsRect.h" // for nsIntRect
#include "LayersLogging.h"
namespace mozilla {
@ -424,12 +423,12 @@ ClientTiledPaintedLayer::RenderLayer()
// outside of our texture coords. Make the visible region a single rect,
// and pad it out by 1 pixel (restricted to tile boundaries) so that
// we always have valid content or transparent pixels to sample from.
nsIntRect bounds = neededRegion.GetBounds();
nsIntRect wholeTiles = bounds;
wholeTiles.InflateToMultiple(nsIntSize(
IntRect bounds = neededRegion.GetBounds();
IntRect wholeTiles = bounds;
wholeTiles.InflateToMultiple(IntSize(
gfxPlatform::GetPlatform()->GetTileWidth(),
gfxPlatform::GetPlatform()->GetTileHeight()));
nsIntRect padded = bounds;
IntRect padded = bounds;
padded.Inflate(1);
padded.IntersectRect(padded, wholeTiles);
neededRegion = padded;

View File

@ -17,7 +17,6 @@
#include "nsAString.h"
#include "nsRefPtr.h" // for nsRefPtr
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsPoint.h" // for nsIntPoint
#include "nsString.h" // for nsAutoCString
#include "gfxVR.h"

View File

@ -14,7 +14,6 @@
#include "nsDebug.h" // for NS_RUNTIMEABORT
#include "nsRect.h" // for nsIntRect
#include "nscore.h" // for nsACString
struct nsIntPoint;
namespace mozilla {
namespace layers {

View File

@ -14,20 +14,18 @@
#include "mozilla/layers/CompositorTypes.h" // for DiagnosticFlags::COLOR
#include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc
#include "mozilla/mozalloc.h" // for operator delete, etc
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
namespace mozilla {
namespace layers {
void
ColorLayerComposite::RenderLayer(const nsIntRect& aClipRect)
ColorLayerComposite::RenderLayer(const gfx::IntRect& aClipRect)
{
EffectChain effects(this);
GenEffectChain(effects);
nsIntRect boundRect = GetBounds();
gfx::IntRect boundRect = GetBounds();
LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(GetMaskLayer(),
effects);

View File

@ -11,9 +11,6 @@
#include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace layers {
@ -50,7 +47,7 @@ public:
virtual void Destroy() override { mDestroyed = true; }
virtual void RenderLayer(const nsIntRect& aClipRect) override;
virtual void RenderLayer(const gfx::IntRect& aClipRect) override;
virtual void CleanupResources() override {};
virtual void GenEffectChain(EffectChain& aEffect) override;

View File

@ -28,9 +28,6 @@
#include "nscore.h" // for nsACString
#include "Units.h" // for CSSToScreenScale
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace gfx {
class Matrix4x4;
@ -108,7 +105,7 @@ public:
virtual LayerRenderState GetRenderState() = 0;
virtual void SetPictureRect(const nsIntRect& aPictureRect)
virtual void SetPictureRect(const gfx::IntRect& aPictureRect)
{
MOZ_ASSERT(false, "Should have been overridden");
}

View File

@ -29,8 +29,6 @@
#include "nsDebug.h" // for NS_ASSERTION
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsISupportsUtils.h" // for NS_ADDREF, NS_RELEASE
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "nsRegion.h" // for nsIntRegion
#include "nsTArray.h" // for nsAutoTArray
#include "TextRenderer.h" // for TextRenderer
@ -85,8 +83,8 @@ static void DrawLayerInfo(const RenderTargetIntRect& aClipRect,
uint32_t maxWidth = std::min<uint32_t>(visibleRegion.GetBounds().width, 500);
nsIntPoint topLeft = visibleRegion.GetBounds().TopLeft();
aManager->GetTextRenderer()->RenderText(ss.str().c_str(), gfx::IntPoint(topLeft.x, topLeft.y),
IntPoint topLeft = visibleRegion.GetBounds().TopLeft();
aManager->GetTextRenderer()->RenderText(ss.str().c_str(), topLeft,
aLayer->GetEffectiveTransform(), 16,
maxWidth);
}
@ -94,9 +92,7 @@ static void DrawLayerInfo(const RenderTargetIntRect& aClipRect,
template<class ContainerT>
static gfx::IntRect ContainerVisibleRect(ContainerT* aContainer)
{
nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
gfx::IntRect surfaceRect = gfx::IntRect(visibleRect.x, visibleRect.y,
visibleRect.width, visibleRect.height);
gfx::IntRect surfaceRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
return surfaceRect;
}
@ -137,7 +133,7 @@ struct PreparedLayer
template<class ContainerT> void
ContainerRenderVR(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect,
const gfx::IntRect& aClipRect,
gfx::VRHMDInfo* aHMD)
{
RefPtr<CompositingRenderTarget> surface;
@ -146,7 +142,7 @@ ContainerRenderVR(ContainerT* aContainer,
RefPtr<CompositingRenderTarget> previousTarget = compositor->GetCurrentRenderTarget();
nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
gfx::IntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
float opacity = aContainer->GetEffectiveOpacity();
@ -176,7 +172,7 @@ ContainerRenderVR(ContainerT* aContainer,
/**
* Render this container's contents.
*/
nsIntRect surfaceClipRect(0, 0, surfaceRect.width, surfaceRect.height);
gfx::IntRect surfaceClipRect(0, 0, surfaceRect.width, surfaceRect.height);
RenderTargetIntRect rtClipRect(0, 0, surfaceRect.width, surfaceRect.height);
for (uint32_t i = 0; i < children.Length(); i++) {
LayerComposite* layerToRender = static_cast<LayerComposite*>(children.ElementAt(i)->ImplData());
@ -352,7 +348,7 @@ RenderLayers(ContainerT* aContainer,
// intersect areas in different coordinate spaces. So we do this a little more permissively
// and only fill in the background when we know there is checkerboard, which in theory
// should only occur transiently.
nsIntRect layerBounds = layer->GetLayerBounds();
gfx::IntRect layerBounds = layer->GetLayerBounds();
EffectChain effectChain(layer);
effectChain.mPrimaryEffect = new EffectSolidColor(ToColor(color));
aManager->GetCompositor()->DrawQuad(gfx::Rect(layerBounds.x, layerBounds.y, layerBounds.width, layerBounds.height),
@ -365,12 +361,12 @@ RenderLayers(ContainerT* aContainer,
// Composer2D will compose this layer so skip GPU composition
// this time & reset composition flag for next composition phase
layerToRender->SetLayerComposited(false);
nsIntRect clearRect = layerToRender->GetClearRect();
gfx::IntRect clearRect = layerToRender->GetClearRect();
if (!clearRect.IsEmpty()) {
// Clear layer's visible rect on FrameBuffer with transparent pixels
gfx::Rect fbRect(clearRect.x, clearRect.y, clearRect.width, clearRect.height);
compositor->ClearRect(fbRect);
layerToRender->SetClearRect(nsIntRect(0, 0, 0, 0));
layerToRender->SetClearRect(gfx::IntRect(0, 0, 0, 0));
}
} else {
layerToRender->RenderLayer(RenderTargetPixel::ToUntyped(clipRect));
@ -445,7 +441,7 @@ CreateTemporaryTargetAndCopyFromBackground(ContainerT* aContainer,
LayerManagerComposite* aManager)
{
Compositor* compositor = aManager->GetCompositor();
nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
gfx::IntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
RefPtr<CompositingRenderTarget> previousTarget = compositor->GetCurrentRenderTarget();
gfx::IntRect surfaceRect = gfx::IntRect(visibleRect.x, visibleRect.y,
visibleRect.width, visibleRect.height);
@ -465,7 +461,7 @@ CreateTemporaryTargetAndCopyFromBackground(ContainerT* aContainer,
template<class ContainerT> void
RenderIntermediate(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect,
const gfx::IntRect& aClipRect,
RefPtr<CompositingRenderTarget> surface)
{
Compositor* compositor = aManager->GetCompositor();
@ -485,7 +481,7 @@ RenderIntermediate(ContainerT* aContainer,
template<class ContainerT> void
ContainerRender(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect)
const gfx::IntRect& aClipRect)
{
MOZ_ASSERT(aContainer->mPrepared);
@ -515,7 +511,7 @@ ContainerRender(ContainerT* aContainer,
float opacity = aContainer->GetEffectiveOpacity();
nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
gfx::IntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
#ifdef MOZ_DUMP_PAINTING
if (gfxUtils::sDumpPainting) {
RefPtr<gfx::DataSourceSurface> surf = surface->Dump(aManager->GetCompositor());
@ -614,7 +610,7 @@ ContainerLayerComposite::GetFirstChildComposite()
}
void
ContainerLayerComposite::RenderLayer(const nsIntRect& aClipRect)
ContainerLayerComposite::RenderLayer(const gfx::IntRect& aClipRect)
{
ContainerRender(this, mCompositeManager, aClipRect);
}
@ -665,7 +661,7 @@ RefLayerComposite::GetFirstChildComposite()
}
void
RefLayerComposite::RenderLayer(const nsIntRect& aClipRect)
RefLayerComposite::RenderLayer(const gfx::IntRect& aClipRect)
{
ContainerRender(this, mCompositeManager, aClipRect);
}

View File

@ -10,9 +10,7 @@
#include "mozilla/Attributes.h" // for override
#include "mozilla/UniquePtr.h" // for UniquePtr
#include "mozilla/layers/LayerManagerComposite.h"
struct nsIntPoint;
struct nsIntRect;
#include "mozilla/gfx/Rect.h"
namespace mozilla {
namespace layers {
@ -39,7 +37,7 @@ class ContainerLayerComposite : public ContainerLayer,
template<class ContainerT>
friend void RenderIntermediate(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect,
const gfx::IntRect& aClipRect,
RefPtr<CompositingRenderTarget> surface);
template<class ContainerT>
friend RefPtr<CompositingRenderTarget>
@ -77,7 +75,7 @@ public:
LayerComposite* GetFirstChildComposite() override;
virtual void RenderLayer(const nsIntRect& aClipRect) override;
virtual void RenderLayer(const gfx::IntRect& aClipRect) override;
virtual void Prepare(const RenderTargetIntRect& aClipRect) override;
virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override
@ -126,26 +124,26 @@ class RefLayerComposite : public RefLayer,
template<class ContainerT>
friend void ContainerRender(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect);
const gfx::IntRect& aClipRect);
template<class ContainerT>
friend void RenderLayers(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect);
const gfx::IntRect& aClipRect);
template<class ContainerT>
friend void RenderIntermediate(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect,
const gfx::IntRect& aClipRect,
RefPtr<CompositingRenderTarget> surface);
template<class ContainerT>
friend RefPtr<CompositingRenderTarget>
CreateTemporaryTargetAndCopyFromBackground(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect);
const gfx::IntRect& aClipRect);
template<class ContainerT>
friend RefPtr<CompositingRenderTarget>
CreateTemporaryTarget(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect);
const gfx::IntRect& aClipRect);
public:
explicit RefLayerComposite(LayerManagerComposite *aManager);
@ -161,7 +159,7 @@ public:
LayerComposite* GetFirstChildComposite() override;
virtual void RenderLayer(const nsIntRect& aClipRect) override;
virtual void RenderLayer(const gfx::IntRect& aClipRect) override;
virtual void Prepare(const RenderTargetIntRect& aClipRect) override;
virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override

View File

@ -327,7 +327,7 @@ ContentHostSingleBuffered::UpdateThebes(const ThebesBufferData& aData,
// Select only the pixels that are still within the buffer.
nsIntRegion finalRegion;
finalRegion.And(nsIntRect(nsIntPoint(), bufferSize), destRegion);
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.

View File

@ -21,8 +21,6 @@
#include "nsRefPtr.h" // for nsRefPtr
#include "nsDebug.h" // for NS_ASSERTION
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "nsString.h" // for nsAutoCString
namespace mozilla {
@ -82,7 +80,7 @@ ImageLayerComposite::GetLayer()
}
void
ImageLayerComposite::RenderLayer(const nsIntRect& aClipRect)
ImageLayerComposite::RenderLayer(const IntRect& aClipRect)
{
if (!mImageHost || !mImageHost->IsAttached()) {
return;

View File

@ -9,6 +9,7 @@
#include "GLTextureImage.h" // for TextureImage
#include "ImageLayers.h" // for ImageLayer
#include "mozilla/Attributes.h" // for override
#include "mozilla/gfx/Rect.h"
#include "mozilla/RefPtr.h" // for RefPtr
#include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc
#include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
@ -16,9 +17,6 @@
#include "nscore.h" // for nsACString
#include "CompositableHost.h" // for CompositableHost
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace layers {
@ -54,7 +52,7 @@ public:
}
}
virtual void RenderLayer(const nsIntRect& aClipRect) override;
virtual void RenderLayer(const gfx::IntRect& aClipRect) override;
virtual void ComputeEffectiveTransforms(const mozilla::gfx::Matrix4x4& aTransformToSurface) override;

View File

@ -22,9 +22,6 @@
#include "nsRefPtr.h" // for nsRefPtr
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsMathUtils.h" // for NS_lround
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "nsSize.h" // for nsIntSize
#include "nsString.h" // for nsAutoCString
#include "TextRenderer.h"
#include "GeckoProfiler.h"
@ -114,7 +111,7 @@ PaintedLayerComposite::GetRenderState()
}
void
PaintedLayerComposite::RenderLayer(const nsIntRect& aClipRect)
PaintedLayerComposite::RenderLayer(const gfx::IntRect& aClipRect)
{
if (!mBuffer || !mBuffer->IsAttached()) {
return;

View File

@ -7,7 +7,7 @@
#define GFX_PaintedLayerComposite_H
#include "Layers.h" // for Layer (ptr only), etc
#include "gfxRect.h" // for gfxRect
#include "mozilla/gfx/Rect.h"
#include "mozilla/Attributes.h" // for override
#include "mozilla/RefPtr.h" // for RefPtr
#include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc
@ -16,9 +16,6 @@
#include "nsRegion.h" // for nsIntRegion
#include "nscore.h" // for nsACString
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace layers {
@ -57,7 +54,7 @@ public:
virtual TiledLayerComposer* GetTiledLayerComposer() override;
virtual void RenderLayer(const nsIntRect& aClipRect) override;
virtual void RenderLayer(const gfx::IntRect& aClipRect) override;
virtual void CleanupResources() override;

View File

@ -58,8 +58,6 @@
#define RECYCLE_LOG(...) do { } while (0)
#endif
struct nsIntPoint;
namespace mozilla {
namespace layers {

View File

@ -28,9 +28,9 @@
#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc
#include "nscore.h" // for nsACString
#include "mozilla/layers/AtomicRefCountedWithFinalize.h"
#include "mozilla/gfx/Rect.h"
class gfxReusableSurfaceWrapper;
struct nsIntRect;
namespace mozilla {
namespace gl {
@ -70,7 +70,7 @@ class BigImageIterator
public:
virtual void BeginBigImageIteration() = 0;
virtual void EndBigImageIteration() {};
virtual nsIntRect GetTileRect() = 0;
virtual gfx::IntRect GetTileRect() = 0;
virtual size_t GetTileCount() = 0;
virtual bool NextTile() = 0;
};

View File

@ -13,9 +13,9 @@
#include "mozilla/layers/TextureHostOGL.h" // for TextureHostOGL
#include "nsAString.h"
#include "nsDebug.h" // for NS_WARNING
#include "nsPoint.h" // for nsIntPoint
#include "nsPoint.h" // for IntPoint
#include "nsPrintfCString.h" // for nsPrintfCString
#include "nsRect.h" // for nsIntRect
#include "nsRect.h" // for IntRect
#include "nsSize.h" // for nsIntSize
#include "mozilla/layers/TiledContentClient.h"
@ -171,7 +171,7 @@ TiledLayerBufferComposite::Upload()
TileHost
TiledLayerBufferComposite::ValidateTile(TileHost aTile,
const nsIntPoint& aTileOrigin,
const IntPoint& aTileOrigin,
const nsIntRegion& aDirtyRect)
{
if (aTile.IsPlaceholderTile()) {
@ -465,7 +465,7 @@ TiledContentHost::RenderTile(const TileHost& aTile,
const gfx::Filter& aFilter,
const gfx::Rect& aClipRect,
const nsIntRegion& aScreenRegion,
const nsIntPoint& aTextureOffset,
const IntPoint& aTextureOffset,
const nsIntSize& aTextureBounds)
{
if (aTile.IsPlaceholderTile()) {
@ -477,7 +477,7 @@ TiledContentHost::RenderTile(const TileHost& aTile,
if (aBackgroundColor) {
aEffectChain.mPrimaryEffect = new EffectSolidColor(ToColor(*aBackgroundColor));
nsIntRegionRectIterator it(aScreenRegion);
for (const nsIntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) {
for (const IntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) {
Rect graphicsRect(rect->x, rect->y, rect->width, rect->height);
mCompositor->DrawQuad(graphicsRect, aClipRect, aEffectChain, 1.0, aTransform);
}
@ -507,7 +507,7 @@ TiledContentHost::RenderTile(const TileHost& aTile,
aEffectChain.mPrimaryEffect = effect;
nsIntRegionRectIterator it(aScreenRegion);
for (const nsIntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) {
for (const IntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) {
Rect graphicsRect(rect->x, rect->y, rect->width, rect->height);
Rect textureRect(rect->x - aTextureOffset.x, rect->y - aTextureOffset.y,
rect->width, rect->height);
@ -574,7 +574,7 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
uint32_t rowCount = 0;
uint32_t tileX = 0;
nsIntRect visibleRect = aVisibleRegion.GetBounds();
IntRect visibleRect = aVisibleRegion.GetBounds();
gfx::IntSize scaledTileSize = aLayerBuffer.GetScaledTileSize();
for (int32_t x = visibleRect.x; x < visibleRect.x + visibleRect.width;) {
rowCount++;
@ -592,17 +592,17 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
}
TileHost tileTexture = aLayerBuffer.
GetTile(nsIntPoint(aLayerBuffer.RoundDownToTileEdge(x, scaledTileSize.width),
GetTile(IntPoint(aLayerBuffer.RoundDownToTileEdge(x, scaledTileSize.width),
aLayerBuffer.RoundDownToTileEdge(y, scaledTileSize.height)));
if (tileTexture != aLayerBuffer.GetPlaceholderTile()) {
nsIntRegion tileDrawRegion;
tileDrawRegion.And(nsIntRect(x, y, w, h), aLayerBuffer.GetValidRegion());
tileDrawRegion.And(IntRect(x, y, w, h), aLayerBuffer.GetValidRegion());
tileDrawRegion.And(tileDrawRegion, aVisibleRegion);
tileDrawRegion.Sub(tileDrawRegion, maskRegion);
if (!tileDrawRegion.IsEmpty()) {
tileDrawRegion.ScaleRoundOut(resolution, resolution);
nsIntPoint tileOffset((x - tileStartX) * resolution,
IntPoint tileOffset((x - tileStartX) * resolution,
(y - tileStartY) * resolution);
gfx::IntSize tileSize = aLayerBuffer.GetTileSize();
RenderTile(tileTexture, aBackgroundColor, aEffectChain, aOpacity, aTransform,

View File

@ -32,8 +32,6 @@
#endif
class gfxReusableSurfaceWrapper;
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace gfx {
@ -164,7 +162,7 @@ public:
protected:
TileHost ValidateTile(TileHost aTile,
const nsIntPoint& aTileRect,
const gfx::IntPoint& aTileRect,
const nsIntRegion& dirtyRect);
// do nothing, the desctructor in the texture host takes care of releasing resources
@ -291,7 +289,7 @@ private:
const gfx::Filter& aFilter,
const gfx::Rect& aClipRect,
const nsIntRegion& aScreenRegion,
const nsIntPoint& aTextureOffset,
const gfx::IntPoint& aTextureOffset,
const gfx::IntSize& aTextureBounds);
void EnsureTileStore() {}

View File

@ -1076,7 +1076,7 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion,
UINT offset = 0;
mContext->IASetVertexBuffers(0, 1, &buffer, &size, &offset);
nsIntRect intRect = nsIntRect(nsIntPoint(0, 0), mSize);
nsIntRect intRect = IntRect(IntPoint(0, 0), mSize);
// Sometimes the invalid region is larger than we want to draw.
nsIntRegion invalidRegionSafe;

View File

@ -132,7 +132,7 @@ SwapChainD3D9::PrepareForRendering()
}
void
SwapChainD3D9::Present(const nsIntRect &aRect)
SwapChainD3D9::Present(const gfx::IntRect &aRect)
{
RECT r;
r.left = aRect.x;

View File

@ -12,8 +12,7 @@
#include "nsTArray.h"
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/RefPtr.h"
struct nsIntRect;
#include "mozilla/gfx/Rect.h"
namespace mozilla {
namespace layers {
@ -102,7 +101,7 @@ public:
* This function will present the selected rectangle of the swap chain to
* its associated window.
*/
void Present(const nsIntRect &aRect);
void Present(const gfx::IntRect &aRect);
void Present();
private:

View File

@ -15,9 +15,7 @@
#include "mozilla/layers/LayersTypes.h" // for LayersBackend
#include "mozilla/layers/TextureClient.h" // for TextureClient
#include "nsRegion.h" // for nsIntRegion
struct nsIntPoint;
struct nsIntRect;
#include "mozilla/gfx/Rect.h"
namespace mozilla {
namespace layers {
@ -79,7 +77,7 @@ public:
* Communicate the picture rect of a YUV image in aLayer to the compositor
*/
virtual void UpdatePictureRect(CompositableClient* aCompositable,
const nsIntRect& aRect) = 0;
const gfx::IntRect& aRect) = 0;
#ifdef MOZ_WIDGET_GONK
virtual void UseOverlaySource(CompositableClient* aCompositabl,

View File

@ -27,6 +27,7 @@
#include "mozilla/DebugOnly.h" // for DebugOnly
#include "mozilla/gfx/2D.h" // for DrawTarget
#include "mozilla/gfx/Point.h" // for IntSize
#include "mozilla/gfx/Rect.h" // for IntSize
#include "mozilla/ipc/Transport.h" // for Transport
#include "mozilla/layers/APZCTreeManager.h" // for APZCTreeManager
#include "mozilla/layers/APZThreadUtils.h" // for APZCTreeManager
@ -48,7 +49,6 @@
#include "nsDebug.h" // for NS_ASSERTION, etc
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsIWidget.h" // for nsIWidget
#include "nsRect.h" // for nsIntRect
#include "nsTArray.h" // for nsTArray
#include "nsThreadUtils.h" // for NS_IsMainThread
#include "nsXULAppAPI.h" // for XRE_GetIOMessageLoop
@ -606,7 +606,7 @@ CompositorParent::RecvResume()
bool
CompositorParent::RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
const nsIntRect& aRect)
const gfx::IntRect& aRect)
{
RefPtr<DrawTarget> target = GetDrawTargetForDescriptor(aInSnapshot, gfx::BackendType::CAIRO);
ForceComposeToTarget(target, &aRect);
@ -977,7 +977,7 @@ CompositorParent::SetShadowProperties(Layer* aLayer)
}
void
CompositorParent::CompositeToTarget(DrawTarget* aTarget, const nsIntRect* aRect)
CompositorParent::CompositeToTarget(DrawTarget* aTarget, const gfx::IntRect* aRect)
{
profiler_tracing("Paint", "Composite", TRACING_INTERVAL_START);
PROFILER_LABEL("CompositorParent", "Composite",
@ -1072,7 +1072,7 @@ CompositorParent::CompositeToTarget(DrawTarget* aTarget, const nsIntRect* aRect)
}
void
CompositorParent::ForceComposeToTarget(DrawTarget* aTarget, const nsIntRect* aRect)
CompositorParent::ForceComposeToTarget(DrawTarget* aTarget, const gfx::IntRect* aRect)
{
PROFILER_LABEL("CompositorParent", "ForceComposeToTarget",
js::ProfileEntry::Category::GRAPHICS);
@ -1338,7 +1338,7 @@ CompositorParent::AllocPLayerTransactionParent(const nsTArray<LayersBackend>& aB
// mWidget doesn't belong to the compositor thread, so it should be set to
// nullptr before returning from this method, to avoid accessing it elsewhere.
nsIntRect rect;
gfx::IntRect rect;
mWidget->GetClientBounds(rect);
InitializeLayerManager(aBackendHints);
mWidget = nullptr;
@ -1600,7 +1600,7 @@ public:
virtual bool RecvNotifyChildCreated(const uint64_t& child) override;
virtual bool RecvAdoptChild(const uint64_t& child) override { return false; }
virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
const nsIntRect& aRect) override
const gfx::IntRect& aRect) override
{ return true; }
virtual bool RecvFlushRendering() override { return true; }
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) override { return true; }

View File

@ -167,7 +167,7 @@ public:
virtual bool RecvNotifyChildCreated(const uint64_t& child) override;
virtual bool RecvAdoptChild(const uint64_t& child) override;
virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
const nsIntRect& aRect) override;
const gfx::IntRect& aRect) override;
virtual bool RecvFlushRendering() override;
virtual bool RecvGetTileSize(int32_t* aWidth, int32_t* aHeight) override;
@ -364,8 +364,8 @@ protected:
virtual bool DeallocPLayerTransactionParent(PLayerTransactionParent* aLayers) override;
virtual void ScheduleTask(CancelableTask*, int);
void CompositeCallback(TimeStamp aScheduleTime);
void CompositeToTarget(gfx::DrawTarget* aTarget, const nsIntRect* aRect = nullptr);
void ForceComposeToTarget(gfx::DrawTarget* aTarget, const nsIntRect* aRect = nullptr);
void CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect = nullptr);
void ForceComposeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect = nullptr);
void SetEGLSurfaceSize(int width, int height);

View File

@ -38,8 +38,6 @@
#include "mozilla/StaticPtr.h" // for StaticRefPtr
#include "mozilla/layers/TextureClient.h"
struct nsIntRect;
namespace mozilla {
namespace ipc {
class Shmem;
@ -149,7 +147,7 @@ ImageBridgeChild::UseOverlaySource(CompositableClient* aCompositable,
void
ImageBridgeChild::UpdatePictureRect(CompositableClient* aCompositable,
const nsIntRect& aRect)
const gfx::IntRect& aRect)
{
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aCompositable->GetIPDLActor());

View File

@ -17,10 +17,9 @@
#include "mozilla/layers/PImageBridgeChild.h"
#include "nsDebug.h" // for NS_RUNTIMEABORT
#include "nsRegion.h" // for nsIntRegion
#include "mozilla/gfx/Rect.h"
class MessageLoop;
struct nsIntPoint;
struct nsIntRect;
namespace base {
class Thread;
@ -241,7 +240,7 @@ public:
* Communicate the picture rect of a YUV image in aLayer to the compositor
*/
virtual void UpdatePictureRect(CompositableClient* aCompositable,
const nsIntRect& aRect) override;
const gfx::IntRect& aRect) override;
virtual void UpdateTextureRegion(CompositableClient* aCompositable,

View File

@ -19,9 +19,9 @@ include "ImageLayers.h";
using mozilla::GraphicsFilterType from "mozilla/GfxMessageUtils.h";
using struct gfxRGBA from "gfxColor.h";
using struct mozilla::gfx::Point3D from "mozilla/gfx/Point.h";
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
using class mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
using nscoord from "nsCoord.h";
using struct nsIntPoint from "nsPoint.h";
using struct nsRect from "nsRect.h";
using struct nsPoint from "nsPoint.h";
using class mozilla::TimeDuration from "mozilla/TimeStamp.h";
@ -47,7 +47,7 @@ namespace mozilla {
namespace layers {
struct TargetConfig {
nsIntRect naturalBounds;
IntRect naturalBounds;
ScreenRotation rotation;
ScreenOrientation orientation;
nsIntRegion clearRegion;
@ -72,8 +72,8 @@ struct OpAttachAsyncCompositable {
};
struct ThebesBufferData {
nsIntRect rect;
nsIntPoint rotation;
IntRect rect;
IntPoint rotation;
};
struct CubicBezierFunction {
@ -195,7 +195,7 @@ struct Animation {
// Change a layer's attributes
struct CommonLayerAttributes {
nsIntRect layerBounds;
IntRect layerBounds;
nsIntRegion visibleRegion;
EventRegions eventRegions;
TransformMatrix transform;
@ -241,8 +241,8 @@ struct ContainerLayerAttributes {
// cross process at some point by passing the HMDConfig
uint64_t hmdInfo;
};
struct ColorLayerAttributes { LayerColor color; nsIntRect bounds; };
struct CanvasLayerAttributes { GraphicsFilterType filter; nsIntRect bounds; };
struct ColorLayerAttributes { LayerColor color; IntRect bounds; };
struct CanvasLayerAttributes { GraphicsFilterType filter; IntRect bounds; };
struct RefLayerAttributes {
int64_t id;
// TODO: Once bug 1132895 is fixed we shouldn't need to propagate the override
@ -269,8 +269,8 @@ struct LayerAttributes {
// See nsIWidget Configurations
struct PluginWindowData {
uintptr_t windowId;
nsIntRect[] clip;
nsIntRect bounds;
IntRect[] clip;
IntRect bounds;
bool visible;
};
@ -348,7 +348,7 @@ struct OpPaintTextureRegion {
struct OpUpdatePictureRect {
PCompositable compositable;
nsIntRect picture;
IntRect picture;
};
/**

View File

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
using struct gfxPoint from "gfxPoint.h";
using struct nsIntRect from "nsRect.h";
using nsIntRegion from "nsRegion.h";
using struct mozilla::layers::MagicGrallocBufferHandle from "gfxipc/ShadowLayerUtils.h";
using struct mozilla::layers::GrallocBufferRef from "gfxipc/ShadowLayerUtils.h";
@ -11,6 +10,7 @@ using struct mozilla::layers::SurfaceDescriptorX11 from "gfxipc/ShadowLayerUtils
using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
using mozilla::WindowsHandle from "ipc/IPCMessageUtils.h";
using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";
using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h";
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
using gfxImageFormat from "gfxTypes.h";

View File

@ -60,7 +60,7 @@ child:
* application on the widgets. Used on Windows and Linux in managing
* plugin widgets.
*/
async UpdatePluginConfigurations(nsIntPoint aContentOffset,
async UpdatePluginConfigurations(IntPoint aContentOffset,
nsIntRegion aVisibleRegion,
PluginWindowData[] aPlugins);
@ -95,7 +95,7 @@ parent:
//
// NB: this message will result in animations, transforms, effects,
// and so forth being interpolated. That's what we want to happen.
sync MakeSnapshot(SurfaceDescriptor inSnapshot, nsIntRect dirtyRect);
sync MakeSnapshot(SurfaceDescriptor inSnapshot, IntRect dirtyRect);
// Make sure any pending composites are started immediately and
// block until they are completed.

View File

@ -28,14 +28,11 @@
#include "mozilla/layers/TextureClient.h" // for TextureClient
#include "mozilla/mozalloc.h" // for operator new, etc
#include "nsAutoPtr.h" // for nsRefPtr, getter_AddRefs, etc
#include "nsRect.h" // for nsIntRect
#include "nsSize.h" // for nsIntSize
#include "nsTArray.h" // for nsAutoTArray, nsTArray, etc
#include "nsXULAppAPI.h" // for XRE_GetProcessType, etc
#include "mozilla/ReentrantMonitor.h"
struct nsIntPoint;
namespace mozilla {
namespace ipc {
class Shmem;
@ -62,7 +59,7 @@ public:
, mRotationChanged(false)
{}
void Begin(const nsIntRect& aTargetBounds, ScreenRotation aRotation,
void Begin(const gfx::IntRect& aTargetBounds, ScreenRotation aRotation,
dom::ScreenOrientation aOrientation)
{
mOpen = true;
@ -139,7 +136,7 @@ public:
EditVector mCset;
EditVector mPaints;
ShadowableLayerSet mMutants;
nsIntRect mTargetBounds;
gfx::IntRect mTargetBounds;
ScreenRotation mTargetRotation;
dom::ScreenOrientation mTargetOrientation;
bool mSwapRequired;
@ -185,7 +182,7 @@ ShadowLayerForwarder::~ShadowLayerForwarder()
}
void
ShadowLayerForwarder::BeginTransaction(const nsIntRect& aTargetBounds,
ShadowLayerForwarder::BeginTransaction(const gfx::IntRect& aTargetBounds,
ScreenRotation aRotation,
dom::ScreenOrientation aOrientation)
{
@ -354,7 +351,7 @@ ShadowLayerForwarder::UpdateTextureRegion(CompositableClient* aCompositable,
void
ShadowLayerForwarder::UpdatePictureRect(CompositableClient* aCompositable,
const nsIntRect& aRect)
const gfx::IntRect& aRect)
{
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aCompositable->GetIPDLActor());

View File

@ -12,6 +12,7 @@
#include <stdint.h> // for uint64_t
#include "gfxTypes.h"
#include "mozilla/Attributes.h" // for override
#include "mozilla/gfx/Rect.h"
#include "mozilla/WidgetUtils.h" // for ScreenRotation
#include "mozilla/dom/ScreenOrientation.h" // for ScreenOrientation
#include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc
@ -22,9 +23,6 @@
#include "nsTArrayForwardDeclare.h" // for InfallibleTArray
#include "nsIWidget.h"
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace layers {
@ -170,7 +168,7 @@ public:
* Begin recording a transaction to be forwarded atomically to a
* LayerManagerComposite.
*/
void BeginTransaction(const nsIntRect& aTargetBounds,
void BeginTransaction(const gfx::IntRect& aTargetBounds,
ScreenRotation aRotation,
mozilla::dom::ScreenOrientation aOrientation);
@ -258,7 +256,7 @@ public:
* Communicate the picture rect of an image to the compositor
*/
void UpdatePictureRect(CompositableClient* aCompositable,
const nsIntRect& aRect) override;
const gfx::IntRect& aRect) override;
/**
* See CompositableForwarder::UseTexture

View File

@ -37,8 +37,8 @@ GLBlitTextureImageHelper::~GLBlitTextureImageHelper()
}
void
GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect& aSrcRect,
TextureImage *aDst, const nsIntRect& aDstRect)
GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const gfx::IntRect& aSrcRect,
TextureImage *aDst, const gfx::IntRect& aDstRect)
{
GLContext *gl = mCompositor->gl();
NS_ASSERTION(!aSrc->InUpdate(), "Source texture is in update!");
@ -61,8 +61,8 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect&
aDst->BeginBigImageIteration();
do {
// calculate portion of the tile that is going to be painted to
nsIntRect dstSubRect;
nsIntRect dstTextureRect = ThebesIntRect(aDst->GetTileRect());
gfx::IntRect dstSubRect;
gfx::IntRect dstTextureRect = ThebesIntRect(aDst->GetTileRect());
dstSubRect.IntersectRect(aDstRect, dstTextureRect);
// this tile is not part of the destination rectangle aDstRect
@ -70,7 +70,7 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect&
continue;
// (*) transform the rect of this tile into the rectangle defined by aSrcRect...
nsIntRect dstInSrcRect(dstSubRect);
gfx::IntRect dstInSrcRect(dstSubRect);
dstInSrcRect.MoveBy(-aDstRect.TopLeft());
// ...which might be of different size, hence scale accordingly
dstInSrcRect.ScaleRoundOut(1.0f / blitScaleX, 1.0f / blitScaleY);
@ -83,8 +83,8 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect&
// now iterate over all tiles in the source Image...
do {
// calculate portion of the source tile that is in the source rect
nsIntRect srcSubRect;
nsIntRect srcTextureRect = ThebesIntRect(aSrc->GetTileRect());
gfx::IntRect srcSubRect;
gfx::IntRect srcTextureRect = ThebesIntRect(aSrc->GetTileRect());
srcSubRect.IntersectRect(aSrcRect, srcTextureRect);
// this tile is not part of the source rect
@ -104,7 +104,7 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect&
// and the desired destination rectange
// in destination space.
// We need to transform this back into destination space, inverting the transform from (*)
nsIntRect srcSubInDstRect(srcSubRect);
gfx::IntRect srcSubInDstRect(srcSubRect);
srcSubInDstRect.MoveBy(-aSrcRect.TopLeft());
srcSubInDstRect.ScaleRoundOut(blitScaleX, blitScaleY);
srcSubInDstRect.MoveBy(aDstRect.TopLeft());

View File

@ -10,8 +10,7 @@
#include "mozilla/Attributes.h"
#include "GLContextTypes.h"
#include "GLConsts.h"
struct nsIntRect;
#include "mozilla/gfx/Rect.h"
namespace mozilla {
namespace gl {
@ -62,8 +61,8 @@ public:
* - active texture (will be 0)
* - texture 0 binding
*/
void BlitTextureImage(gl::TextureImage *aSrc, const nsIntRect& aSrcRect,
gl::TextureImage *aDst, const nsIntRect& aDstRect);
void BlitTextureImage(gl::TextureImage *aSrc, const gfx::IntRect& aSrcRect,
gl::TextureImage *aDst, const gfx::IntRect& aDstRect);
};
}

View File

@ -21,7 +21,6 @@
#include <string>
struct gfxRGBA;
struct nsIntRect;
namespace mozilla {
namespace layers {

View File

@ -22,7 +22,6 @@
#include "mozilla/layers/ISurfaceAllocator.h"
#include "mozilla/layers/YCbCrImageDataSerializer.h"
#include "mozilla/layers/GrallocTextureHost.h"
#include "nsPoint.h" // for nsIntPoint
#include "nsRegion.h" // for nsIntRegion
#include "AndroidSurfaceTexture.h"
#include "GfxTexturesReporter.h" // for GfxTexturesReporter
@ -258,7 +257,7 @@ TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface,
if (aDestRegion &&
!aSrcOffset &&
!aDestRegion->IsEqual(nsIntRect(0, 0, size.width, size.height))) {
!aDestRegion->IsEqual(gfx::IntRect(0, 0, size.width, size.height))) {
// UpdateFromDataSource will ignore our specified aDestRegion since the texture
// hasn't been allocated with glTexImage2D yet. Call Resize() to force the
// allocation (full size, but no upload), and then we'll only upload the pixels
@ -292,9 +291,9 @@ TextureImageTextureSourceOGL::EnsureBuffer(const nsIntSize& aSize,
}
void
TextureImageTextureSourceOGL::CopyTo(const nsIntRect& aSourceRect,
TextureImageTextureSourceOGL::CopyTo(const gfx::IntRect& aSourceRect,
DataTextureSource *aDest,
const nsIntRect& aDestRect)
const gfx::IntRect& aDestRect)
{
MOZ_ASSERT(aDest->AsSourceOGL(), "Incompatible destination type!");
TextureImageTextureSourceOGL *dest =
@ -341,7 +340,7 @@ TextureImageTextureSourceOGL::GetFormat() const
return gfx::SurfaceFormat::UNKNOWN;
}
nsIntRect TextureImageTextureSourceOGL::GetTileRect()
gfx::IntRect TextureImageTextureSourceOGL::GetTileRect()
{
return ThebesIntRect(mTexImage->GetTileRect());
}

View File

@ -39,8 +39,6 @@
class gfxReusableSurfaceWrapper;
class nsIntRegion;
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace gfx {
@ -204,9 +202,9 @@ public:
void EnsureBuffer(const gfx::IntSize& aSize,
gfxContentType aContentType);
void CopyTo(const nsIntRect& aSourceRect,
void CopyTo(const gfx::IntRect& aSourceRect,
DataTextureSource* aDest,
const nsIntRect& aDestRect);
const gfx::IntRect& aDestRect);
virtual TextureImageTextureSourceOGL* AsTextureImageTextureSource() override { return this; }
@ -250,7 +248,7 @@ public:
mIterating = false;
}
virtual nsIntRect GetTileRect() override;
virtual gfx::IntRect GetTileRect() override;
virtual size_t GetTileCount() override
{

View File

@ -10,8 +10,12 @@
#include "mozilla/gfx/BaseSize.h"
#include "mozilla/gfx/BasePoint.h"
#include "nsSize.h"
#include "mozilla/gfx/Point.h"
struct nsIntPoint;
// nsIntPoint represents a point in one of the types of pixels.
// Uses of nsIntPoint should eventually be converted to CSSIntPoint,
// LayoutDeviceIntPoint, etc. (see layout/base/Units.h).
typedef mozilla::gfx::IntPoint nsIntPoint;
// nsPoint represents a point in app units.
@ -35,19 +39,7 @@ struct nsPoint : public mozilla::gfx::BasePoint<nscoord, nsPoint> {
ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const;
};
// nsIntPoint represents a point in one of the types of pixels.
// Uses of nsIntPoint should eventually be converted to CSSIntPoint,
// LayoutDeviceIntPoint, etc. (see layout/base/Units.h).
struct nsIntPoint : public mozilla::gfx::BasePoint<int32_t, nsIntPoint> {
typedef mozilla::gfx::BasePoint<int32_t, nsIntPoint> Super;
nsIntPoint() : Super() {}
nsIntPoint(const nsIntPoint& aPoint) : Super(aPoint) {}
nsIntPoint(int32_t aX, int32_t aY) : Super(aX, aY) {}
inline nsPoint ToAppUnits(nscoord aAppUnitsPerPixel) const;
};
inline nsPoint ToAppUnits(const nsIntPoint& aPoint, nscoord aAppUnitsPerPixel);
inline nsIntPoint
nsPoint::ScaleToNearestPixels(float aXScale, float aYScale,
@ -78,10 +70,10 @@ nsPoint::ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const
// app units are integer multiples of pixels, so no rounding needed
inline nsPoint
nsIntPoint::ToAppUnits(nscoord aAppUnitsPerPixel) const
ToAppUnits(const nsIntPoint& aPoint, nscoord aAppUnitsPerPixel)
{
return nsPoint(NSIntPixelsToAppUnits(x, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(y, aAppUnitsPerPixel));
return nsPoint(NSIntPixelsToAppUnits(aPoint.x, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(aPoint.y, aAppUnitsPerPixel));
}
#endif /* NSPOINT_H */

View File

@ -15,6 +15,20 @@ static_assert((int(NS_SIDE_TOP) == 0) &&
(int(NS_SIDE_LEFT) == 3),
"The mozilla::css::Side sequence must match the nsMargin nscoord sequence");
nsRect
ToAppUnits(const nsIntRect& aRect, nscoord aAppUnitsPerPixel)
{
return nsRect(NSIntPixelsToAppUnits(aRect.x, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(aRect.y, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(aRect.width, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(aRect.height, aAppUnitsPerPixel));
}
const nsIntRect& GetMaxSizedIntRect() {
static const nsIntRect r(0, 0, INT32_MAX, INT32_MAX);
return r;
}
#ifdef DEBUG
// Diagnostics

View File

@ -13,18 +13,18 @@
#include "nsDebug.h" // for NS_WARNING
#include "gfxCore.h" // for NS_GFX
#include "mozilla/Likely.h" // for MOZ_UNLIKELY
#include "mozilla/gfx/BaseRect.h" // for BaseRect
#include "mozilla/gfx/NumericTools.h" // for RoundUpToMultiple, RoundDownToMultiple
#include "mozilla/gfx/Rect.h"
#include "nsCoord.h" // for nscoord, etc
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsPoint.h" // for nsIntPoint, nsPoint
#include "nsSize.h" // for nsIntSize, nsSize
#include "nscore.h" // for NS_BUILD_REFCNT_LOGGING
struct nsIntRect;
struct nsMargin;
struct nsIntMargin;
typedef mozilla::gfx::IntRect nsIntRect;
struct NS_GFX nsRect :
public mozilla::gfx::BaseRect<nscoord, nsRect, nsPoint, nsSize, nsMargin> {
typedef mozilla::gfx::BaseRect<nscoord, nsRect, nsPoint, nsSize, nsMargin> Super;
@ -179,56 +179,6 @@ struct NS_GFX nsRect :
}
};
struct NS_GFX nsIntRect :
public mozilla::gfx::BaseRect<int32_t, nsIntRect, nsIntPoint, nsIntSize, nsIntMargin> {
typedef mozilla::gfx::BaseRect<int32_t, nsIntRect, nsIntPoint, nsIntSize, nsIntMargin> Super;
// Constructors
nsIntRect() : Super()
{
}
nsIntRect(const nsIntRect& aRect) : Super(aRect)
{
}
nsIntRect(const nsIntPoint& aOrigin, const nsIntSize &aSize) : Super(aOrigin, aSize)
{
}
nsIntRect(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight) :
Super(aX, aY, aWidth, aHeight)
{
}
MOZ_WARN_UNUSED_RESULT inline nsRect
ToAppUnits(nscoord aAppUnitsPerPixel) const;
// Returns a special nsIntRect that's used in some places to signify
// "all available space".
static const nsIntRect& GetMaxSizedIntRect() {
static const nsIntRect r(0, 0, INT32_MAX, INT32_MAX);
return r;
}
void InflateToMultiple(const nsIntSize& aTileSize)
{
int32_t xMost = XMost();
int32_t yMost = YMost();
x = RoundDownToMultiple(x, aTileSize.width);
y = RoundDownToMultiple(y, aTileSize.height);
xMost = RoundUpToMultiple(xMost, aTileSize.width);
yMost = RoundUpToMultiple(yMost, aTileSize.height);
width = xMost - x;
height = yMost - y;
}
// This is here only to keep IPDL-generated code happy. DO NOT USE.
bool operator==(const nsIntRect& aRect) const
{
return IsEqualEdges(aRect);
}
};
/*
* App Unit/Pixel conversions
*/
@ -335,15 +285,11 @@ nsRect::ToInsidePixels(nscoord aAppUnitsPerPixel) const
return ScaleToInsidePixels(1.0f, 1.0f, aAppUnitsPerPixel);
}
const nsIntRect& GetMaxSizedIntRect();
// app units are integer multiples of pixels, so no rounding needed
inline nsRect
nsIntRect::ToAppUnits(nscoord aAppUnitsPerPixel) const
{
return nsRect(NSIntPixelsToAppUnits(x, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(y, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(width, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(height, aAppUnitsPerPixel));
}
nsRect
ToAppUnits(const nsIntRect& aRect, nscoord aAppUnitsPerPixel);
#ifdef DEBUG
// Diagnostics

View File

@ -699,7 +699,7 @@ public:
RectIterator rgnIter(*this);
const Rect* currentRect;
while ((currentRect = rgnIter.Next())) {
nsRect appRect = currentRect->ToAppUnits(aAppUnitsPerPixel);
nsRect appRect = ::ToAppUnits(*currentRect, aAppUnitsPerPixel);
result.Or(result, appRect);
}
return result;

View File

@ -76,6 +76,16 @@ inline IntPoint ToIntPoint(const nsIntPoint &aPoint)
return IntPoint(aPoint.x, aPoint.y);
}
inline IntMargin ToIntMargin(const nsIntMargin& aMargin)
{
return IntMargin(aMargin.top, aMargin.right, aMargin.bottom, aMargin.left);
}
inline nsIntPoint ThebesIntPoint(const IntPoint &aPoint)
{
return nsIntPoint(aPoint.x, aPoint.y);
}
inline Size ToSize(const gfxSize &aSize)
{
return Size(Float(aSize.width), Float(aSize.height));

View File

@ -12,6 +12,7 @@
#include "gfxTypes.h"
#include "nscore.h"
#include "nsSize.h"
#include "mozilla/gfx/Rect.h"
#ifdef MOZILLA_INTERNAL_API
#include "nsStringFwd.h"
@ -20,8 +21,6 @@
#endif
class gfxImageSurface;
struct nsIntPoint;
struct nsIntRect;
struct gfxRect;
struct gfxPoint;

View File

@ -8,9 +8,8 @@
#include "mozilla/SSE.h"
#include "gfxTypes.h"
#include "nsRect.h"
#include "mozilla/gfx/Rect.h"
struct nsIntRect;
class gfxImageSurface;
class gfxAlphaRecovery {
@ -53,10 +52,10 @@ public:
*
* The returned rect is always a superset of |aRect|.
*/
static nsIntRect AlignRectForSubimageRecovery(const nsIntRect& aRect,
static mozilla::gfx::IntRect AlignRectForSubimageRecovery(const mozilla::gfx::IntRect& aRect,
gfxImageSurface* aSurface);
#else
static nsIntRect AlignRectForSubimageRecovery(const nsIntRect& aRect,
static mozilla::gfx::IntRect AlignRectForSubimageRecovery(const mozilla::gfx::IntRect& aRect,
gfxImageSurface*)
{ return aRect; }
#endif

View File

@ -5,7 +5,6 @@
#include "gfxAlphaRecovery.h"
#include "gfxImageSurface.h"
#include "nsRect.h"
#include <emmintrin.h>
// This file should only be compiled on x86 and x64 systems. Additionally,
@ -137,8 +136,8 @@ ByteAlignment(int32_t aAlignToLog2, int32_t aX, int32_t aY=0, int32_t aStride=1)
return (aX + aStride * aY) & ((1 << aAlignToLog2) - 1);
}
/*static*/ nsIntRect
gfxAlphaRecovery::AlignRectForSubimageRecovery(const nsIntRect& aRect,
/*static*/ mozilla::gfx::IntRect
gfxAlphaRecovery::AlignRectForSubimageRecovery(const mozilla::gfx::IntRect& aRect,
gfxImageSurface* aSurface)
{
NS_ASSERTION(gfxImageFormat::ARGB32 == aSurface->Format(),
@ -229,8 +228,8 @@ gfxAlphaRecovery::AlignRectForSubimageRecovery(const nsIntRect& aRect,
return aRect;
FOUND_SOLUTION:
nsIntRect solution = nsIntRect(x - dx, y - dy, w + dr + dx, h + dy);
MOZ_ASSERT(nsIntRect(0, 0, sw, surfaceSize.height).Contains(solution),
mozilla::gfx::IntRect solution = mozilla::gfx::IntRect(x - dx, y - dy, w + dr + dx, h + dy);
MOZ_ASSERT(mozilla::gfx::IntRect(0, 0, sw, surfaceSize.height).Contains(solution),
"'Solution' extends outside surface bounds!");
return solution;
}

View File

@ -57,7 +57,7 @@ gfxD2DSurface::Present()
}
void
gfxD2DSurface::Scroll(const nsIntPoint &aDelta, const nsIntRect &aClip)
gfxD2DSurface::Scroll(const nsIntPoint &aDelta, const mozilla::gfx::IntRect &aClip)
{
cairo_rectangle_t rect;
rect.x = aClip.x;
@ -80,7 +80,7 @@ gfxD2DSurface::GetDC(bool aRetainContents)
}
void
gfxD2DSurface::ReleaseDC(const nsIntRect *aUpdatedRect)
gfxD2DSurface::ReleaseDC(const mozilla::gfx::IntRect *aUpdatedRect)
{
if (!aUpdatedRect) {
return cairo_d2d_release_dc(CairoSurface(), nullptr);

View File

@ -12,7 +12,6 @@
#include <windows.h>
struct ID3D10Texture2D;
struct nsIntRect;
class gfxD2DSurface : public gfxASurface {
public:
@ -32,14 +31,14 @@ public:
virtual ~gfxD2DSurface();
void Present();
void Scroll(const nsIntPoint &aDelta, const nsIntRect &aClip);
void Scroll(const nsIntPoint &aDelta, const mozilla::gfx::IntRect &aClip);
virtual const gfxIntSize GetSize() const;
virtual const mozilla::gfx::IntSize GetSize() const;
ID3D10Texture2D *GetTexture();
HDC GetDC(bool aRetainContents);
void ReleaseDC(const nsIntRect *aUpdatedRect);
void ReleaseDC(const mozilla::gfx::IntRect *aUpdatedRect);
};
#endif /* GFX_D2DSURFACE_H */

View File

@ -9,9 +9,9 @@
#include "gfxColor.h"
#include "gfxContext.h"
#include "gfxXlibSurface.h"
#include "mozilla/gfx/Rect.h"
class QRect;
struct nsIntRect;
/**
* This class lets us take code that draws into an Xlib surface drawable and lets us
@ -31,7 +31,8 @@ public:
*/
virtual nsresult DrawWithXlib(cairo_surface_t* surface,
nsIntPoint offset,
nsIntRect* clipRects, uint32_t numClipRects) = 0;
mozilla::gfx::IntRect* clipRects,
uint32_t numClipRects) = 0;
enum {
// If set, then Draw() is opaque, i.e., every pixel in the intersection

View File

@ -690,7 +690,7 @@ PathFromRegionInternal(gfxContext* aContext, const nsIntRegion& aRegion)
{
aContext->NewPath();
nsIntRegionRectIterator iter(aRegion);
const nsIntRect* r;
const IntRect* r;
while ((r = iter.Next()) != nullptr) {
aContext->Rectangle(gfxRect(r->x, r->y, r->width, r->height));
}
@ -709,7 +709,7 @@ PathFromRegionInternal(DrawTarget* aTarget, const nsIntRegion& aRegion)
RefPtr<PathBuilder> pb = aTarget->CreatePathBuilder();
nsIntRegionRectIterator iter(aRegion);
const nsIntRect* r;
const IntRect* r;
while ((r = iter.Next()) != nullptr) {
pb->MoveTo(Point(r->x, r->y));
pb->LineTo(Point(r->XMost(), r->y));
@ -725,7 +725,7 @@ static void
ClipToRegionInternal(DrawTarget* aTarget, const nsIntRegion& aRegion)
{
if (!aRegion.IsComplex()) {
nsIntRect rect = aRegion.GetBounds();
IntRect rect = aRegion.GetBounds();
aTarget->PushClipRect(Rect(rect.x, rect.y, rect.width, rect.height));
return;
}
@ -847,9 +847,9 @@ gfxUtils::TransformRectToRect(const gfxRect& aFrom, const IntPoint& aToTopLeft,
* to ints then convert those ints back to doubles to make sure that
* they equal the doubles that we got in. */
bool
gfxUtils::GfxRectToIntRect(const gfxRect& aIn, nsIntRect* aOut)
gfxUtils::GfxRectToIntRect(const gfxRect& aIn, IntRect* aOut)
{
*aOut = nsIntRect(int32_t(aIn.X()), int32_t(aIn.Y()),
*aOut = IntRect(int32_t(aIn.X()), int32_t(aIn.Y()),
int32_t(aIn.Width()), int32_t(aIn.Height()));
return gfxRect(aOut->x, aOut->y, aOut->width, aOut->height).IsEqualEdges(aIn);
}
@ -995,7 +995,7 @@ gfxUtils::ConvertYCbCrToRGB(const PlanarYCbCrData& aData,
}
/* static */ void gfxUtils::ClearThebesSurface(gfxASurface* aSurface,
nsIntRect* aRect,
IntRect* aRect,
const gfxRGBA& aColor)
{
if (aSurface->CairoStatus()) {
@ -1008,11 +1008,11 @@ gfxUtils::ConvertYCbCrToRGB(const PlanarYCbCrData& aData,
cairo_t* ctx = cairo_create(surf);
cairo_set_source_rgba(ctx, aColor.r, aColor.g, aColor.b, aColor.a);
cairo_set_operator(ctx, CAIRO_OPERATOR_SOURCE);
nsIntRect bounds;
IntRect bounds;
if (aRect) {
bounds = *aRect;
} else {
bounds = nsIntRect(nsIntPoint(0, 0), aSurface->GetSize());
bounds = IntRect(nsIntPoint(0, 0), aSurface->GetSize());
}
cairo_rectangle(ctx, bounds.x, bounds.y, bounds.width, bounds.height);
cairo_fill(ctx);

View File

@ -14,14 +14,13 @@
#include "mozilla/RefPtr.h"
#include "nsColor.h"
#include "nsPrintfCString.h"
#include "mozilla/gfx/Rect.h"
class gfxASurface;
class gfxDrawable;
class nsIntRegion;
class nsIPresShell;
struct nsIntRect;
namespace mozilla {
namespace layers {
struct PlanarYCbCrData;
@ -121,11 +120,11 @@ public:
const IntPoint& aToBottomRight);
/**
* If aIn can be represented exactly using an nsIntRect (i.e.
* If aIn can be represented exactly using an gfx::IntRect (i.e.
* integer-aligned edges and coordinates in the int32_t range) then we
* set aOut to that rectangle, otherwise return failure.
*/
static bool GfxRectToIntRect(const gfxRect& aIn, nsIntRect* aOut);
static bool GfxRectToIntRect(const gfxRect& aIn, mozilla::gfx::IntRect* aOut);
/**
* Return the smallest power of kScaleResolution (2) greater than or equal to
@ -163,7 +162,7 @@ public:
* Clears surface to aColor (which defaults to transparent black).
*/
static void ClearThebesSurface(gfxASurface* aSurface,
nsIntRect* aRect = nullptr,
mozilla::gfx::IntRect* aRect = nullptr,
const gfxRGBA& aColor = gfxRGBA(0.0, 0.0, 0.0, 0.0));
/**

View File

@ -69,9 +69,9 @@ _convert_coord_to_int (double coord, int32_t *v)
static bool
_get_rectangular_clip (cairo_t *cr,
const nsIntRect& bounds,
const IntRect& bounds,
bool *need_clip,
nsIntRect *rectangles, int max_rectangles,
IntRect *rectangles, int max_rectangles,
int *num_rectangles)
{
cairo_rectangle_list_t *cliplist;
@ -91,7 +91,7 @@ _get_rectangular_clip (cairo_t *cr,
for (i = 0; i < cliplist->num_rectangles; ++i) {
nsIntRect rect;
IntRect rect;
if (!_convert_coord_to_int (clips[i].x, &rect.x) ||
!_convert_coord_to_int (clips[i].y, &rect.y) ||
!_convert_coord_to_int (clips[i].width, &rect.width) ||
@ -176,7 +176,7 @@ gfxXlibNativeRenderer::DrawCairo(cairo_t* cr, nsIntSize size,
NS_ASSERTION(int32_t(device_offset_x) == device_offset_x &&
int32_t(device_offset_y) == device_offset_y,
"Expected integer device offsets");
nsIntPoint offset(NS_lroundf(matrix.x0 + device_offset_x),
IntPoint offset(NS_lroundf(matrix.x0 + device_offset_x),
NS_lroundf(matrix.y0 + device_offset_y));
int max_rectangles = 0;
@ -189,14 +189,14 @@ gfxXlibNativeRenderer::DrawCairo(cairo_t* cr, nsIntSize size,
/* The client won't draw outside the surface so consider this when
analysing clip rectangles. */
nsIntRect bounds(offset, size);
IntRect bounds(offset, size);
bounds.IntersectRect(bounds,
nsIntRect(0, 0,
IntRect(0, 0,
cairo_xlib_surface_get_width(target),
cairo_xlib_surface_get_height(target)));
bool needs_clip = true;
nsIntRect rectangles[MAX_STATIC_CLIP_RECTANGLES];
IntRect rectangles[MAX_STATIC_CLIP_RECTANGLES];
int rect_count = 0;
/* Check that the clip is rectangular and aligned on unit boundaries. */
@ -436,7 +436,7 @@ CreateTempXlibSurface (cairo_surface_t* cairoTarget,
bool
gfxXlibNativeRenderer::DrawOntoTempSurface(cairo_surface_t *tempXlibSurface,
nsIntPoint offset)
IntPoint offset)
{
cairo_surface_flush(tempXlibSurface);
/* no clipping is needed because the callback can't draw outside the native
@ -506,7 +506,7 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
return;
}
nsIntRect drawingRect(nsIntPoint(0, 0), size);
IntRect drawingRect(IntPoint(0, 0), size);
// Drawing need only be performed within the clip extents
// (and padding for the filter).
if (!matrixIsIntegerTranslation) {
@ -516,7 +516,7 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
}
clipExtents.RoundOut();
nsIntRect intExtents(int32_t(clipExtents.X()),
IntRect intExtents(int32_t(clipExtents.X()),
int32_t(clipExtents.Y()),
int32_t(clipExtents.Width()),
int32_t(clipExtents.Height()));

View File

@ -8,6 +8,8 @@
#include "nsPoint.h"
#include "nsRect.h"
#include "mozilla/gfx/Rect.h"
#include "mozilla/gfx/Point.h"
#include <X11/Xlib.h>
namespace mozilla {
@ -18,8 +20,6 @@ namespace gfx {
class gfxASurface;
class gfxContext;
struct nsIntRect;
struct nsIntPoint;
typedef struct _cairo cairo_t;
typedef struct _cairo_surface cairo_surface_t;
@ -45,8 +45,9 @@ public:
* no clipping is required.
*/
virtual nsresult DrawWithXlib(cairo_surface_t* surface,
nsIntPoint offset,
nsIntRect* clipRects, uint32_t numClipRects) = 0;
mozilla::gfx::IntPoint offset,
mozilla::gfx::IntRect* clipRects,
uint32_t numClipRects) = 0;
enum {
// If set, then Draw() is opaque, i.e., every pixel in the intersection
@ -93,11 +94,11 @@ private:
void DrawFallback(mozilla::gfx::DrawTarget* dt, gfxContext* ctx,
gfxASurface* aSurface, mozilla::gfx::IntSize& size,
nsIntRect& drawingRect, bool canDrawOverBackground,
mozilla::gfx::IntRect& drawingRect, bool canDrawOverBackground,
uint32_t flags, Screen* screen, Visual* visual);
bool DrawOntoTempSurface(cairo_surface_t *tempXlibSurface,
nsIntPoint offset);
mozilla::gfx::IntPoint offset);
};

View File

@ -16,7 +16,7 @@ using mozilla::hal::WakeLockControl from "mozilla/HalTypes.h";
using mozilla::hal::SwitchState from "mozilla/HalTypes.h";
using mozilla::hal::SwitchDevice from "mozilla/HalTypes.h";
using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h";
using struct nsIntRect from "nsRect.h";
using nsIntRect from "nsRect.h";
using PRTime from "prtime.h";
using mozilla::hal::FMRadioCountry from "mozilla/HalTypes.h";
using mozilla::hal::FMRadioOperation from "mozilla/HalTypes.h";

View File

@ -628,7 +628,7 @@ Decoder::PostFrameStop(Opacity aFrameOpacity /* = Opacity::TRANSPARENT */,
// here when the first frame is complete.
if (!mSendPartialInvalidations && !mIsAnimated) {
mInvalidRect.UnionRect(mInvalidRect,
nsIntRect(nsIntPoint(0, 0), GetSize()));
gfx::IntRect(gfx::IntPoint(0, 0), GetSize()));
}
}

View File

@ -8,10 +8,10 @@
#define mozilla_image_src_ImageOps_h
#include "nsCOMPtr.h"
#include "nsRect.h"
class gfxDrawable;
class imgIContainer;
struct nsIntRect;
namespace mozilla {
namespace image {

View File

@ -182,7 +182,7 @@ void MultipartImage::FinishTransition()
// Finally, send all the notifications for the new current part and send a
// FRAME_UPDATE notification so that observers know to redraw.
mTracker->SyncNotifyProgress(newCurrentPartTracker->GetProgress(),
nsIntRect::GetMaxSizedIntRect());
GetMaxSizedIntRect());
}
already_AddRefed<imgIContainer>

View File

@ -393,7 +393,7 @@ ProgressTracker::SyncNotify(IProgressObserver* aObserver)
if (NS_FAILED(mImage->GetWidth(&rect.width)) ||
NS_FAILED(mImage->GetHeight(&rect.height))) {
// Either the image has no intrinsic size, or it has an error.
rect = nsIntRect::GetMaxSizedIntRect();
rect = GetMaxSizedIntRect();
}
}

View File

@ -122,7 +122,7 @@ class ScaleRunner : public nsRunnable
public:
ScaleRunner(RasterImage* aImage,
uint32_t aImageFlags,
const nsIntSize& aSize,
const IntSize& aSize,
RawAccessFrameRef&& aSrcRef)
: mImage(aImage)
, mSrcRef(Move(aSrcRef))
@ -235,7 +235,7 @@ private:
WeakPtr<RasterImage> mImage;
RawAccessFrameRef mSrcRef;
RawAccessFrameRef mDstRef;
const nsIntSize mDstSize;
const IntSize mDstSize;
uint32_t mImageFlags;
ScaleState mState;
};
@ -504,7 +504,7 @@ RasterImage::LookupFrameInternal(uint32_t aFrameNum,
DrawableFrameRef
RasterImage::LookupFrame(uint32_t aFrameNum,
const nsIntSize& aSize,
const IntSize& aSize,
uint32_t aFlags)
{
MOZ_ASSERT(NS_IsMainThread());
@ -568,7 +568,7 @@ RasterImage::GetRequestedFrameIndex(uint32_t aWhichFrame) const
return aWhichFrame == FRAME_FIRST ? 0 : GetCurrentFrameIndex();
}
nsIntRect
IntRect
RasterImage::GetFirstFrameRect()
{
if (mAnim) {
@ -576,7 +576,7 @@ RasterImage::GetFirstFrameRect()
}
// Fall back to our size. This is implicitly zero-size if !mHasSize.
return nsIntRect(nsIntPoint(0,0), mSize);
return IntRect(IntPoint(0,0), mSize);
}
NS_IMETHODIMP_(bool)
@ -702,7 +702,7 @@ RasterImage::CopyFrame(uint32_t aWhichFrame, uint32_t aFlags)
return nullptr;
}
nsIntRect intFrameRect = frameRef->GetRect();
IntRect intFrameRect = frameRef->GetRect();
Rect rect(intFrameRect.x, intFrameRect.y,
intFrameRect.width, intFrameRect.height);
if (frameRef->IsSinglePixel()) {
@ -761,7 +761,7 @@ RasterImage::GetFrameInternal(uint32_t aWhichFrame, uint32_t aFlags)
// If this frame covers the entire image, we can just reuse its existing
// surface.
RefPtr<SourceSurface> frameSurf;
nsIntRect frameRect = frameRef->GetRect();
IntRect frameRect = frameRef->GetRect();
if (frameRect.x == 0 && frameRect.y == 0 &&
frameRect.width == mSize.width &&
frameRect.height == mSize.height) {
@ -905,7 +905,7 @@ class OnAddedFrameRunnable : public nsRunnable
public:
OnAddedFrameRunnable(RasterImage* aImage,
uint32_t aNewFrameCount,
const nsIntRect& aNewRefreshArea)
const IntRect& aNewRefreshArea)
: mImage(aImage)
, mNewFrameCount(aNewFrameCount)
, mNewRefreshArea(aNewRefreshArea)
@ -922,12 +922,12 @@ public:
private:
nsRefPtr<RasterImage> mImage;
uint32_t mNewFrameCount;
nsIntRect mNewRefreshArea;
IntRect mNewRefreshArea;
};
void
RasterImage::OnAddedFrame(uint32_t aNewFrameCount,
const nsIntRect& aNewRefreshArea)
const IntRect& aNewRefreshArea)
{
if (!NS_IsMainThread()) {
nsCOMPtr<nsIRunnable> runnable =
@ -1147,8 +1147,8 @@ RasterImage::SetLoopCount(int32_t aLoopCount)
}
}
NS_IMETHODIMP_(nsIntRect)
RasterImage::GetImageSpaceInvalidationRect(const nsIntRect& aRect)
NS_IMETHODIMP_(IntRect)
RasterImage::GetImageSpaceInvalidationRect(const IntRect& aRect)
{
return aRect;
}
@ -1333,7 +1333,7 @@ RasterImage::CanDiscard() {
// Sets up a decoder for this image.
already_AddRefed<Decoder>
RasterImage::CreateDecoder(const Maybe<nsIntSize>& aSize, uint32_t aFlags)
RasterImage::CreateDecoder(const Maybe<IntSize>& aSize, uint32_t aFlags)
{
// Make sure we actually get size before doing a full decode.
if (aSize) {
@ -1472,7 +1472,7 @@ RasterImage::StartDecoding()
}
NS_IMETHODIMP
RasterImage::RequestDecodeForSize(const nsIntSize& aSize, uint32_t aFlags)
RasterImage::RequestDecodeForSize(const IntSize& aSize, uint32_t aFlags)
{
MOZ_ASSERT(NS_IsMainThread());
@ -1487,7 +1487,7 @@ RasterImage::RequestDecodeForSize(const nsIntSize& aSize, uint32_t aFlags)
// Fall back to our intrinsic size if we don't support
// downscale-during-decode.
nsIntSize targetSize = mDownscaleDuringDecode ? aSize : mSize;
IntSize targetSize = mDownscaleDuringDecode ? aSize : mSize;
// Decide whether to sync decode images we can decode quickly. Here we are
// explicitly trading off flashing for responsiveness in the case that we're
@ -1507,7 +1507,7 @@ RasterImage::RequestDecodeForSize(const nsIntSize& aSize, uint32_t aFlags)
}
NS_IMETHODIMP
RasterImage::Decode(const Maybe<nsIntSize>& aSize, uint32_t aFlags)
RasterImage::Decode(const Maybe<IntSize>& aSize, uint32_t aFlags)
{
MOZ_ASSERT(!aSize || NS_IsMainThread());
@ -1570,7 +1570,7 @@ RasterImage::Decode(const Maybe<nsIntSize>& aSize, uint32_t aFlags)
}
void
RasterImage::RecoverFromLossOfFrames(const nsIntSize& aSize, uint32_t aFlags)
RasterImage::RecoverFromLossOfFrames(const IntSize& aSize, uint32_t aFlags)
{
if (!mHasSize) {
return;
@ -1595,7 +1595,7 @@ RasterImage::RecoverFromLossOfFrames(const nsIntSize& aSize, uint32_t aFlags)
bool
RasterImage::CanScale(GraphicsFilter aFilter,
const nsIntSize& aSize,
const IntSize& aSize,
uint32_t aFlags)
{
#ifndef MOZ_ENABLE_SKIA
@ -1655,7 +1655,7 @@ RasterImage::CanScale(GraphicsFilter aFilter,
}
bool
RasterImage::CanDownscaleDuringDecode(const nsIntSize& aSize, uint32_t aFlags)
RasterImage::CanDownscaleDuringDecode(const IntSize& aSize, uint32_t aFlags)
{
// Check basic requirements: downscale-during-decode is enabled for this
// image, we have all the source data and know our size, the flags allow us to
@ -1693,13 +1693,13 @@ RasterImage::NotifyNewScaledFrame()
{
// Send an invalidation so observers will repaint and can take advantage of
// the new scaled frame if possible.
NotifyProgress(NoProgress, nsIntRect(0, 0, mSize.width, mSize.height));
NotifyProgress(NoProgress, IntRect(0, 0, mSize.width, mSize.height));
}
void
RasterImage::RequestScale(imgFrame* aFrame,
uint32_t aFlags,
const nsIntSize& aSize)
const IntSize& aSize)
{
// We don't scale frames which aren't fully decoded.
if (!aFrame->IsImageComplete()) {
@ -1732,7 +1732,7 @@ RasterImage::RequestScale(imgFrame* aFrame,
DrawResult
RasterImage::DrawWithPreDownscaleIfNeeded(DrawableFrameRef&& aFrameRef,
gfxContext* aContext,
const nsIntSize& aSize,
const IntSize& aSize,
const ImageRegion& aRegion,
GraphicsFilter aFilter,
uint32_t aFlags)
@ -1798,14 +1798,14 @@ RasterImage::DrawWithPreDownscaleIfNeeded(DrawableFrameRef&& aFrameRef,
* in gfxGraphicsFilter aFilter,
* [const] in gfxMatrix aUserSpaceToImageSpace,
* [const] in gfxRect aFill,
* [const] in nsIntRect aSubimage,
* [const] in nsIntSize aViewportSize,
* [const] in IntRect aSubimage,
* [const] in IntSize aViewportSize,
* [const] in SVGImageContext aSVGContext,
* in uint32_t aWhichFrame,
* in uint32_t aFlags); */
NS_IMETHODIMP_(DrawResult)
RasterImage::Draw(gfxContext* aContext,
const nsIntSize& aSize,
const IntSize& aSize,
const ImageRegion& aRegion,
uint32_t aWhichFrame,
GraphicsFilter aFilter,
@ -2028,7 +2028,7 @@ RasterImage::GetFramesNotified(uint32_t* aFramesNotified)
void
RasterImage::NotifyProgress(Progress aProgress,
const nsIntRect& aInvalidRect /* = nsIntRect() */,
const IntRect& aInvalidRect /* = IntRect() */,
uint32_t aFlags /* = DECODE_FLAGS_DEFAULT */)
{
MOZ_ASSERT(NS_IsMainThread());
@ -2111,7 +2111,7 @@ RasterImage::Unwrap()
return self.forget();
}
nsIntSize
IntSize
RasterImage::OptimalImageSizeForDest(const gfxSize& aDest, uint32_t aWhichFrame,
GraphicsFilter aFilter, uint32_t aFlags)
{
@ -2120,10 +2120,10 @@ RasterImage::OptimalImageSizeForDest(const gfxSize& aDest, uint32_t aWhichFrame,
"Unexpected destination size");
if (mSize.IsEmpty() || aDest.IsEmpty()) {
return nsIntSize(0, 0);
return IntSize(0, 0);
}
nsIntSize destSize(ceil(aDest.width), ceil(aDest.height));
IntSize destSize(ceil(aDest.width), ceil(aDest.height));
if (aFilter == GraphicsFilter::FILTER_GOOD &&
CanDownscaleDuringDecode(destSize, aFlags)) {

View File

@ -85,7 +85,7 @@ SVGDocumentWrapper::UpdateViewportBounds(const nsIntSize& aViewportSize)
// If the bounds have changed, we need to do a layout flush.
if (currentBounds.Size() != aViewportSize) {
mViewer->SetBounds(nsIntRect(nsIntPoint(0, 0), aViewportSize));
mViewer->SetBounds(IntRect(IntPoint(0, 0), aViewportSize));
FlushLayout();
}

View File

@ -246,7 +246,7 @@ NS_IMPL_ISUPPORTS(SVGLoadEventListener, nsIDOMEventListener)
class SVGDrawingCallback : public gfxDrawingCallback {
public:
SVGDrawingCallback(SVGDocumentWrapper* aSVGDocumentWrapper,
const nsIntRect& aViewport,
const IntRect& aViewport,
const IntSize& aSize,
uint32_t aImageFlags)
: mSVGDocumentWrapper(aSVGDocumentWrapper)
@ -260,7 +260,7 @@ public:
const gfxMatrix& aTransform);
private:
nsRefPtr<SVGDocumentWrapper> mSVGDocumentWrapper;
const nsIntRect mViewport;
const IntRect mViewport;
const IntSize mSize;
uint32_t mImageFlags;
};
@ -539,12 +539,12 @@ VectorImage::SendInvalidationNotifications()
if (mProgressTracker) {
SurfaceCache::RemoveImage(ImageKey(this));
mProgressTracker->SyncNotifyProgress(FLAG_FRAME_COMPLETE,
nsIntRect::GetMaxSizedIntRect());
GetMaxSizedIntRect());
}
}
NS_IMETHODIMP_(nsIntRect)
VectorImage::GetImageSpaceInvalidationRect(const nsIntRect& aRect)
NS_IMETHODIMP_(IntRect)
VectorImage::GetImageSpaceInvalidationRect(const IntRect& aRect)
{
return aRect;
}
@ -854,7 +854,7 @@ VectorImage::CreateSurfaceAndShow(const SVGDrawingParameters& aParams)
nsRefPtr<gfxDrawingCallback> cb =
new SVGDrawingCallback(mSVGDocumentWrapper,
nsIntRect(nsIntPoint(0, 0), aParams.viewportSize),
IntRect(IntPoint(0, 0), aParams.viewportSize),
aParams.size,
aParams.flags);
@ -916,7 +916,7 @@ VectorImage::CreateSurfaceAndShow(const SVGDrawingParameters& aParams)
// Send out an invalidation so that surfaces that are still in use get
// re-locked. See the discussion of the UnlockSurfaces call above.
mProgressTracker->SyncNotifyProgress(FLAG_FRAME_COMPLETE,
nsIntRect::GetMaxSizedIntRect());
GetMaxSizedIntRect());
}
@ -1177,7 +1177,7 @@ VectorImage::OnSVGDocumentLoaded()
FLAG_FRAME_COMPLETE |
FLAG_DECODE_COMPLETE |
FLAG_ONLOAD_UNBLOCKED,
nsIntRect::GetMaxSizedIntRect());
GetMaxSizedIntRect());
}
EvaluateAnimation();

View File

@ -695,7 +695,7 @@ imgFrame::ImageUpdatedInternal(const nsIntRect& aUpdateRect)
// clamp to bounds, in case someone sends a bogus updateRect (I'm looking at
// you, gif decoder)
nsIntRect boundsRect(mOffset, nsIntSize(mSize.width, mSize.height));
nsIntRect boundsRect(gfx::ToIntPoint(mOffset), gfx::IntSize(mSize.width, mSize.height));
mDecoded.IntersectRect(mDecoded, boundsRect);
// If the image is now complete, wake up anyone who's waiting.
@ -728,7 +728,7 @@ imgFrame::Finish(Opacity aFrameOpacity /* = Opacity::SOME_TRANSPARENCY */,
nsIntRect
imgFrame::GetRect() const
{
return nsIntRect(mOffset, nsIntSize(mSize.width, mSize.height));
return gfx::IntRect(gfx::ToIntPoint(mOffset), gfx::IntSize(mSize.width, mSize.height));
}
int32_t

View File

@ -840,7 +840,7 @@ NotificationTypeToString(int32_t aType)
}
void
imgRequestProxy::Notify(int32_t aType, const nsIntRect* aRect)
imgRequestProxy::Notify(int32_t aType, const mozilla::gfx::IntRect* aRect)
{
MOZ_ASSERT(aType != imgINotificationObserver::LOAD_COMPLETE,
"Should call OnLoadComplete");

View File

@ -17,6 +17,7 @@
#include "nsAutoPtr.h"
#include "nsThreadUtils.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/gfx/Rect.h"
#include "imgRequest.h"
#include "IProgressObserver.h"
@ -31,7 +32,6 @@
class imgINotificationObserver;
class imgStatusNotifyRunnable;
struct nsIntRect;
class ProxyBehaviour;
namespace mozilla {
@ -98,7 +98,7 @@ public:
// imgINotificationObserver methods:
virtual void Notify(int32_t aType,
const nsIntRect* aRect = nullptr) override;
const mozilla::gfx::IntRect* aRect = nullptr) override;
virtual void OnLoadComplete(bool aLastPart) override;
// imgIOnloadBlocker methods:

View File

@ -2218,7 +2218,7 @@ ContainerState::FindOpaqueBackgroundColorInLayer(const PaintedLayerData* aData,
// Scan the candidate's display items.
nsIntRect deviceRect = aRect;
nsRect appUnitRect = deviceRect.ToAppUnits(mAppUnitsPerDevPixel);
nsRect appUnitRect = ToAppUnits(deviceRect, mAppUnitsPerDevPixel);
appUnitRect.ScaleInverseRoundOut(mParameters.mXScale, mParameters.mYScale);
for (auto& assignedItem : Reversed(aData->mAssignedDisplayItems)) {
@ -4818,7 +4818,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
// we won't paint
if (aChildren->IsOpaque() && !aChildren->NeedsTransparentSurface()) {
bounds.ScaleRoundIn(scaleParameters.mXScale, scaleParameters.mYScale);
if (bounds.Contains(pixBounds.ToAppUnits(appUnitsPerDevPixel))) {
if (bounds.Contains(ToAppUnits(pixBounds, appUnitsPerDevPixel))) {
// Clear CONTENT_COMPONENT_ALPHA and add CONTENT_OPAQUE instead.
flags &= ~Layer::CONTENT_COMPONENT_ALPHA;
flags |= Layer::CONTENT_OPAQUE;
@ -5066,7 +5066,7 @@ FrameLayerBuilder::PaintItems(nsTArray<ClippedDisplayItem>& aItems,
DrawTarget& aDrawTarget = *aRC->GetDrawTarget();
int32_t appUnitsPerDevPixel = aPresContext->AppUnitsPerDevPixel();
nsRect boundRect = aRect.ToAppUnits(appUnitsPerDevPixel);
nsRect boundRect = ToAppUnits(aRect, appUnitsPerDevPixel);
boundRect.MoveBy(NSIntPixelsToAppUnits(aOffset.x, appUnitsPerDevPixel),
NSIntPixelsToAppUnits(aOffset.y, appUnitsPerDevPixel));
boundRect.ScaleInverseRoundOut(aXScale, aYScale);

View File

@ -34,6 +34,7 @@
#include "nsColor.h"
#include "nsCompatibility.h"
#include "nsFrameManagerBase.h"
#include "nsRect.h"
#include "mozFlushType.h"
#include "nsWeakReference.h"
#include <stdio.h> // for FILE definition
@ -80,8 +81,6 @@ class nsDisplayListBuilder;
class nsPIDOMWindow;
struct nsPoint;
class nsINode;
struct nsIntPoint;
struct nsIntRect;
struct nsRect;
class nsRegion;
class nsRefreshDriver;

View File

@ -5292,7 +5292,7 @@ PresShell::RenderNode(nsIDOMNode* aNode,
// combine the area with the supplied region
nsIntRect rrectPixels = aRegion->GetBounds();
nsRect rrect = rrectPixels.ToAppUnits(nsPresContext::AppUnitsPerCSSPixel());
nsRect rrect = ToAppUnits(rrectPixels, nsPresContext::AppUnitsPerCSSPixel());
area.IntersectRect(area, rrect);
nsPresContext* pc = GetPresContext();

View File

@ -16,6 +16,7 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/PathHelpers.h"
#include "gfx2DGlue.h"
#include "nsCOMPtr.h"
#include "nsFrameList.h"
@ -4924,7 +4925,7 @@ nsIFrame::GetTransformMatrix(const nsIFrame* aStopAtAncestor,
widget->GetClientBounds(screenBounds);
nsIntRect toplevelScreenBounds;
toplevel->GetClientBounds(toplevelScreenBounds);
nsIntPoint translation = screenBounds.TopLeft() - toplevelScreenBounds.TopLeft();
nsIntPoint translation = gfx::ThebesIntPoint(screenBounds.TopLeft() - toplevelScreenBounds.TopLeft());
Matrix4x4 transformToTop;
transformToTop._41 = translation.x;

View File

@ -614,7 +614,7 @@ nsImageFrame::OnFrameUpdate(imgIRequest* aRequest, const nsIntRect* aRect)
? mImage->GetImageSpaceInvalidationRect(*aRect)
: *aRect;
if (layerInvalidRect.IsEqualInterior(nsIntRect::GetMaxSizedIntRect())) {
if (layerInvalidRect.IsEqualInterior(GetMaxSizedIntRect())) {
// Invalidate our entire area.
InvalidateSelf(nullptr, nullptr);
return NS_OK;

View File

@ -368,7 +368,7 @@ nsFilterInstance::BuildSourcePaint(SourceInfo *aSource,
gfx->Save();
gfx->Multiply(mPaintTransform *
deviceToFilterSpace *
gfxMatrix::Translation(-neededRect.TopLeft()));
gfxMatrix::Translation(ThebesIntPoint(-neededRect.TopLeft())));
GeneralPattern pattern;
if (aSource == &mFillPaint) {
nsSVGUtils::MakeFillPatternFor(mTargetFrame, gfx, &pattern);
@ -445,7 +445,7 @@ nsFilterInstance::BuildSourceImage(DrawTarget* aTargetDT)
}
nsRefPtr<gfxContext> ctx = new gfxContext(offscreenDT);
ctx->SetMatrix(
ctx->CurrentMatrix().Translate(-neededRect.TopLeft()).
ctx->CurrentMatrix().Translate(ThebesIntPoint(-neededRect.TopLeft())).
PreMultiply(deviceToFilterSpace));
mPaintCallback->Paint(*ctx, mTargetFrame, mPaintTransform, &dirty);

View File

@ -16,7 +16,6 @@ class SVGBBox;
struct nsPoint;
struct nsRect;
struct nsIntRect;
namespace mozilla {
class SVGAnimatedLengthList;

View File

@ -23,7 +23,6 @@ class nsStyleContext;
struct nsPoint;
struct nsRect;
struct nsIntRect;
typedef nsContainerFrame nsSVGContainerFrameBase;

Some files were not shown because too many files have changed in this diff Show More