--- a/gfx/2d/DrawTargetTiled.h
+++ b/gfx/2d/DrawTargetTiled.h
@@ -38,17 +38,17 @@ public:
virtual bool IsTiledDrawTarget() const override { return true; }
virtual DrawTargetType GetType() const override { return mTiles[0].mDrawTarget->GetType(); }
virtual BackendType GetBackendType() const override { return mTiles[0].mDrawTarget->GetBackendType(); }
virtual already_AddRefed<SourceSurface> Snapshot() override;
virtual void DetachAllSnapshots() override;
virtual IntSize GetSize() override {
- MOZ_ASSERT(mRect.width > 0 && mRect.height > 0);
+ MOZ_ASSERT(mRect.Width() > 0 && mRect.Height() > 0);
return IntSize(mRect.XMost(), mRect.YMost());
}
virtual void Flush() override;
virtual void DrawSurface(SourceSurface *aSurface,
const Rect &aDest,
const Rect &aSource,
const DrawSurfaceOptions &aSurfOptions,
@@ -181,17 +181,17 @@ public:
for (size_t i = 0; i < aTiles.size(); i++) {
mSnapshots.push_back(aTiles[i].mDrawTarget->Snapshot());
mOrigins.push_back(aTiles[i].mTileOrigin);
}
}
virtual SurfaceType GetType() const { return SurfaceType::TILED; }
virtual IntSize GetSize() const {
- MOZ_ASSERT(mRect.width > 0 && mRect.height > 0);
+ MOZ_ASSERT(mRect.Width() > 0 && mRect.Height() > 0);
return IntSize(mRect.XMost(), mRect.YMost());
}
virtual SurfaceFormat GetFormat() const { return mSnapshots[0]->GetFormat(); }
virtual already_AddRefed<DataSourceSurface> GetDataSurface()
{
RefPtr<DataSourceSurface> surf = Factory::CreateDataSourceSurface(GetSize(), GetFormat());
--- a/gfx/2d/HelpersD2D.h
+++ b/gfx/2d/HelpersD2D.h
@@ -573,17 +573,17 @@ CreatePartialBitmapForSurface(DataSource
// Calculate the rectangle of the source mapped to our surface.
rect = invTransform.TransformBounds(rect);
rect.RoundOut();
IntSize size = aSurface->GetSize();
Rect uploadRect(0, 0, Float(size.width), Float(size.height));
if (aSourceRect) {
- uploadRect = Rect(aSourceRect->x, aSourceRect->y, aSourceRect->width, aSourceRect->height);
+ uploadRect = Rect(aSourceRect->x, aSourceRect->y, aSourceRect->Width(), aSourceRect->Height());
}
// Limit the uploadRect as much as possible without supporting discontiguous uploads
//
// region we will paint from
// uploadRect
// .---------------. .---------------. resulting uploadRect
// | |rect | |
@@ -605,38 +605,38 @@ CreatePartialBitmapForSurface(DataSource
// surface, and upload that, for ExtendMode::CLAMP we can actually guarantee
// correct behaviour in this case.
uploadRect = uploadRect.Intersect(rect);
// We now proceed to check if we can limit at least one dimension of the
// upload rect safely without looking at extend mode.
} else if (rect.x >= 0 && rect.XMost() < size.width) {
uploadRect.x = rect.x;
- uploadRect.width = rect.width;
+ uploadRect.SetWidth(rect.Width());
} else if (rect.y >= 0 && rect.YMost() < size.height) {
uploadRect.y = rect.y;
- uploadRect.height = rect.height;
+ uploadRect.SetHeight(rect.Height());
}
if (uploadRect.IsEmpty()) {
// Nothing to be drawn.
return nullptr;
}
- if (uploadRect.width <= aRT->GetMaximumBitmapSize() &&
- uploadRect.height <= aRT->GetMaximumBitmapSize()) {
+ if (uploadRect.Width() <= aRT->GetMaximumBitmapSize() &&
+ uploadRect.Height() <= aRT->GetMaximumBitmapSize()) {
{
// Scope to auto-Unmap() |mapping|.
DataSourceSurface::ScopedMap mapping(aSurface, DataSourceSurface::READ);
if (MOZ2D_WARN_IF(!mapping.IsMapped())) {
return nullptr;
}
// A partial upload will suffice.
- aRT->CreateBitmap(D2D1::SizeU(uint32_t(uploadRect.width), uint32_t(uploadRect.height)),
+ aRT->CreateBitmap(D2D1::SizeU(uint32_t(uploadRect.Width()), uint32_t(uploadRect.Height())),
mapping.GetData() + int(uploadRect.x) * Bpp + int(uploadRect.y) * mapping.GetStride(),
mapping.GetStride(),
D2D1::BitmapProperties(D2DPixelFormat(aSurface->GetFormat())),
getter_AddRefs(bitmap));
}
aSourceTransform.PreTranslate(uploadRect.x, uploadRect.y);
--- a/gfx/2d/HelpersSkia.h
+++ b/gfx/2d/HelpersSkia.h
@@ -269,37 +269,37 @@ PointToSkPoint(const Point &aPoint)
{
return SkPoint::Make(SkFloatToScalar(aPoint.x), SkFloatToScalar(aPoint.y));
}
static inline SkRect
RectToSkRect(const Rect& aRect)
{
return SkRect::MakeXYWH(SkFloatToScalar(aRect.x), SkFloatToScalar(aRect.y),
- SkFloatToScalar(aRect.width), SkFloatToScalar(aRect.height));
+ SkFloatToScalar(aRect.Width()), SkFloatToScalar(aRect.Height()));
}
static inline SkRect
IntRectToSkRect(const IntRect& aRect)
{
return SkRect::MakeXYWH(SkIntToScalar(aRect.x), SkIntToScalar(aRect.y),
- SkIntToScalar(aRect.width), SkIntToScalar(aRect.height));
+ SkIntToScalar(aRect.Width()), SkIntToScalar(aRect.Height()));
}
static inline SkIRect
RectToSkIRect(const Rect& aRect)
{
return SkIRect::MakeXYWH(int32_t(aRect.x), int32_t(aRect.y),
- int32_t(aRect.width), int32_t(aRect.height));
+ int32_t(aRect.Width()), int32_t(aRect.Height()));
}
static inline SkIRect
IntRectToSkIRect(const IntRect& aRect)
{
- return SkIRect::MakeXYWH(aRect.x, aRect.y, aRect.width, aRect.height);
+ return SkIRect::MakeXYWH(aRect.x, aRect.y, aRect.Width(), aRect.Height());
}
static inline IntRect
SkIRectToIntRect(const SkIRect& aRect)
{
return IntRect(aRect.x(), aRect.y(), aRect.width(), aRect.height());
}
--- a/gfx/2d/RecordedEventImpl.h
+++ b/gfx/2d/RecordedEventImpl.h
@@ -1677,17 +1677,17 @@ RecordedFillRect::RecordedFillRect(S &aS
ReadElement(aStream, mRect);
ReadElement(aStream, mOptions);
ReadPatternData(aStream, mPattern);
}
inline void
RecordedFillRect::OutputSimpleEventInfo(std::stringstream &aStringStream) const
{
- aStringStream << "[" << mDT << "] FillRect (" << mRect.x << ", " << mRect.y << " - " << mRect.width << " x " << mRect.height << ") ";
+ aStringStream << "[" << mDT << "] FillRect (" << mRect.x << ", " << mRect.y << " - " << mRect.Width() << " x " << mRect.Height() << ") ";
OutputSimplePatternInfo(mPattern, aStringStream);
}
inline bool
RecordedStrokeRect::PlayEvent(Translator *aTranslator) const
{
aTranslator->LookupDrawTarget(mDT)->StrokeRect(mRect, *GenericPattern(mPattern, aTranslator), mStrokeOptions, mOptions);
return true;
@@ -1712,17 +1712,17 @@ RecordedStrokeRect::RecordedStrokeRect(S
ReadElement(aStream, mOptions);
ReadPatternData(aStream, mPattern);
ReadStrokeOptions(aStream, mStrokeOptions);
}
inline void
RecordedStrokeRect::OutputSimpleEventInfo(std::stringstream &aStringStream) const
{
- aStringStream << "[" << mDT << "] StrokeRect (" << mRect.x << ", " << mRect.y << " - " << mRect.width << " x " << mRect.height
+ aStringStream << "[" << mDT << "] StrokeRect (" << mRect.x << ", " << mRect.y << " - " << mRect.Width() << " x " << mRect.Height()
<< ") LineWidth: " << mStrokeOptions.mLineWidth << "px ";
OutputSimplePatternInfo(mPattern, aStringStream);
}
inline bool
RecordedStrokeLine::PlayEvent(Translator *aTranslator) const
{
aTranslator->LookupDrawTarget(mDT)->StrokeLine(mBegin, mEnd, *GenericPattern(mPattern, aTranslator), mStrokeOptions, mOptions);
@@ -1930,17 +1930,17 @@ RecordedClearRect::RecordedClearRect(S &
: RecordedDrawingEvent(CLEARRECT, aStream)
{
ReadElement(aStream, mRect);
}
inline void
RecordedClearRect::OutputSimpleEventInfo(std::stringstream &aStringStream) const
{
- aStringStream << "[" << mDT<< "] ClearRect (" << mRect.x << ", " << mRect.y << " - " << mRect.width << " x " << mRect.height << ") ";
+ aStringStream << "[" << mDT<< "] ClearRect (" << mRect.x << ", " << mRect.y << " - " << mRect.Width() << " x " << mRect.Height() << ") ";
}
inline bool
RecordedCopySurface::PlayEvent(Translator *aTranslator) const
{
aTranslator->LookupDrawTarget(mDT)->CopySurface(aTranslator->LookupSourceSurface(mSourceSurface),
mSourceRect, mDest);
return true;
@@ -2019,17 +2019,17 @@ RecordedPushClipRect::RecordedPushClipRe
: RecordedDrawingEvent(PUSHCLIPRECT, aStream)
{
ReadElement(aStream, mRect);
}
inline void
RecordedPushClipRect::OutputSimpleEventInfo(std::stringstream &aStringStream) const
{
- aStringStream << "[" << mDT << "] PushClipRect (" << mRect.x << ", " << mRect.y << " - " << mRect.width << " x " << mRect.height << ") ";
+ aStringStream << "[" << mDT << "] PushClipRect (" << mRect.x << ", " << mRect.y << " - " << mRect.Width() << " x " << mRect.Height() << ") ";
}
inline bool
RecordedPopClip::PlayEvent(Translator *aTranslator) const
{
aTranslator->LookupDrawTarget(mDT)->PopClip();
return true;
}
--- a/gfx/2d/Rect.h
+++ b/gfx/2d/Rect.h
@@ -113,58 +113,58 @@ struct IntRectTyped :
return IntRectTyped<units>(IntPointTyped<units>::Truncate(aX, aY),
IntSizeTyped<units>::Truncate(aW, aH));
}
static IntRectTyped<units> RoundIn(const RectTyped<units, float>& aRect) {
auto tmp(aRect);
tmp.RoundIn();
return IntRectTyped(int32_t(tmp.x), int32_t(tmp.y),
- int32_t(tmp.width), int32_t(tmp.height));
+ int32_t(tmp.Width()), int32_t(tmp.Height()));
}
static IntRectTyped<units> RoundOut(const RectTyped<units, float>& aRect) {
auto tmp(aRect);
tmp.RoundOut();
return IntRectTyped(int32_t(tmp.x), int32_t(tmp.y),
- int32_t(tmp.width), int32_t(tmp.height));
+ int32_t(tmp.Width()), int32_t(tmp.Height()));
}
static IntRectTyped<units> Round(const RectTyped<units, float>& aRect) {
auto tmp(aRect);
tmp.Round();
return IntRectTyped(int32_t(tmp.x), int32_t(tmp.y),
- int32_t(tmp.width), int32_t(tmp.height));
+ int32_t(tmp.Width()), int32_t(tmp.Height()));
}
static IntRectTyped<units> Truncate(const RectTyped<units, float>& aRect) {
- return IntRectTyped::Truncate(aRect.x, aRect.y, aRect.width, aRect.height);
+ return IntRectTyped::Truncate(aRect.x, aRect.y, aRect.Width(), aRect.Height());
}
// Rounding isn't meaningful on an integer rectangle.
void Round() {}
void RoundIn() {}
void RoundOut() {}
// XXX When all of the code is ported, the following functions to convert
// to and from unknown types should be removed.
static IntRectTyped<units> FromUnknownRect(const IntRectTyped<UnknownUnits>& rect) {
- return IntRectTyped<units>(rect.x, rect.y, rect.width, rect.height);
+ return IntRectTyped<units>(rect.x, rect.y, rect.Width(), rect.Height());
}
IntRectTyped<UnknownUnits> ToUnknownRect() const {
- return IntRectTyped<UnknownUnits>(this->x, this->y, this->width, this->height);
+ return IntRectTyped<UnknownUnits>(this->x, this->y, this->Width(), this->Height());
}
bool Overflows() const {
CheckedInt<int32_t> xMost = this->x;
- xMost += this->width;
+ xMost += this->Width();
CheckedInt<int32_t> yMost = this->y;
- yMost += this->height;
+ yMost += this->Height();
return !xMost.isValid() || !yMost.isValid();
}
// Same as Union(), but in the cases where aRect is non-empty, the union is
// done while guarding against overflow. If an overflow is detected, Nothing
// is returned.
MOZ_MUST_USE Maybe<Self> SafeUnion(const Self& aRect) const
{
@@ -213,18 +213,18 @@ struct IntRectTyped :
int32_t yMost = this->YMost();
int32_t xMost = this->XMost();
this->x = mozilla::RoundDownToMultiple(this->x, aTileSize.width);
this->y = mozilla::RoundDownToMultiple(this->y, aTileSize.height);
xMost = mozilla::RoundUpToMultiple(xMost, aTileSize.width);
yMost = mozilla::RoundUpToMultiple(yMost, aTileSize.height);
- this->width = xMost - this->x;
- this->height = yMost - this->y;
+ this->SetWidth(xMost - this->x);
+ this->SetHeight(yMost - this->y);
}
};
typedef IntRectTyped<UnknownUnits> IntRect;
template<class units, class F = Float>
struct RectTyped :
public BaseRect<F, RectTyped<units, F>, PointTyped<units, F>, SizeTyped<units, F>, MarginTyped<units, F> >,
@@ -236,44 +236,44 @@ struct RectTyped :
RectTyped() : Super() {}
RectTyped(const PointTyped<units, F>& aPos, const SizeTyped<units, F>& aSize) :
Super(aPos, aSize) {}
RectTyped(F _x, F _y, F _width, F _height) :
Super(_x, _y, _width, _height) {}
explicit RectTyped(const IntRectTyped<units>& rect) :
Super(F(rect.x), F(rect.y),
- F(rect.width), F(rect.height)) {}
+ F(rect.Width()), F(rect.Height())) {}
void NudgeToIntegers()
{
NudgeToInteger(&(this->x));
NudgeToInteger(&(this->y));
NudgeToInteger(&(this->width));
NudgeToInteger(&(this->height));
}
bool ToIntRect(IntRectTyped<units> *aOut) const
{
*aOut = IntRectTyped<units>(int32_t(this->X()), int32_t(this->Y()),
int32_t(this->Width()), int32_t(this->Height()));
return RectTyped<units, F>(F(aOut->x), F(aOut->y),
- F(aOut->width), F(aOut->height))
+ F(aOut->Width()), F(aOut->Height()))
.IsEqualEdges(*this);
}
// XXX When all of the code is ported, the following functions to convert to and from
// unknown types should be removed.
static RectTyped<units, F> FromUnknownRect(const RectTyped<UnknownUnits, F>& rect) {
- return RectTyped<units, F>(rect.x, rect.y, rect.width, rect.height);
+ return RectTyped<units, F>(rect.x, rect.y, rect.Width(), rect.Height());
}
RectTyped<UnknownUnits, F> ToUnknownRect() const {
- return RectTyped<UnknownUnits, F>(this->x, this->y, this->width, this->height);
+ return RectTyped<UnknownUnits, F>(this->x, this->y, this->Width(), this->Height());
}
// This is here only to keep IPDL-generated code happy. DO NOT USE.
bool operator==(const RectTyped<units, F>& aRect) const
{
return RectTyped<units, F>::IsEqualEdges(aRect);
}
};
@@ -282,18 +282,18 @@ typedef RectTyped<UnknownUnits, double>
template<class units>
IntRectTyped<units> RoundedToInt(const RectTyped<units>& aRect)
{
RectTyped<units> copy(aRect);
copy.Round();
return IntRectTyped<units>(int32_t(copy.x),
int32_t(copy.y),
- int32_t(copy.width),
- int32_t(copy.height));
+ int32_t(copy.Width()),
+ int32_t(copy.Height()));
}
template<class units>
IntRectTyped<units> RoundedIn(const RectTyped<units>& aRect)
{
return IntRectTyped<units>::RoundIn(aRect);
}
@@ -306,17 +306,17 @@ IntRectTyped<units> RoundedOut(const Rec
template<class units>
IntRectTyped<units> TruncatedToInt(const RectTyped<units>& aRect) {
return IntRectTyped<units>::Truncate(aRect);
}
template<class units>
RectTyped<units> IntRectToRect(const IntRectTyped<units>& aRect)
{
- return RectTyped<units>(aRect.x, aRect.y, aRect.width, aRect.height);
+ return RectTyped<units>(aRect.x, aRect.y, aRect.Width(), aRect.Height());
}
// Convenience function for intersecting two rectangles wrapped in Maybes.
template <typename T>
Maybe<T>
IntersectMaybeRects(const Maybe<T>& a, const Maybe<T>& b)
{
if (!a) {
--- a/gfx/2d/SVGTurbulenceRenderer-inl.h
+++ b/gfx/2d/SVGTurbulenceRenderer-inl.h
@@ -170,27 +170,27 @@ AdjustForLength(float aFreq, float aLeng
}
return hiFreq;
}
template<TurbulenceType Type, bool Stitch, typename f32x4_t, typename i32x4_t, typename u8x16_t>
void
SVGTurbulenceRenderer<Type,Stitch,f32x4_t,i32x4_t,u8x16_t>::AdjustBaseFrequencyForStitch(const Rect &aTileRect)
{
- mBaseFrequency = Size(AdjustForLength(mBaseFrequency.width, aTileRect.width),
- AdjustForLength(mBaseFrequency.height, aTileRect.height));
+ mBaseFrequency = Size(AdjustForLength(mBaseFrequency.width, aTileRect.Width()),
+ AdjustForLength(mBaseFrequency.height, aTileRect.Height()));
}
template<TurbulenceType Type, bool Stitch, typename f32x4_t, typename i32x4_t, typename u8x16_t>
typename SVGTurbulenceRenderer<Type,Stitch,f32x4_t,i32x4_t,u8x16_t>::StitchInfo
SVGTurbulenceRenderer<Type,Stitch,f32x4_t,i32x4_t,u8x16_t>::CreateStitchInfo(const Rect &aTileRect) const
{
StitchInfo stitch;
- stitch.width = int32_t(floorf(aTileRect.width * mBaseFrequency.width + 0.5f));
- stitch.height = int32_t(floorf(aTileRect.height * mBaseFrequency.height + 0.5f));
+ stitch.width = int32_t(floorf(aTileRect.Width() * mBaseFrequency.width + 0.5f));
+ stitch.height = int32_t(floorf(aTileRect.Height() * mBaseFrequency.height + 0.5f));
stitch.wrapX = int32_t(aTileRect.x * mBaseFrequency.width) + stitch.width;
stitch.wrapY = int32_t(aTileRect.y * mBaseFrequency.height) + stitch.height;
return stitch;
}
static MOZ_ALWAYS_INLINE Float
SCurve(Float t)
{
--- a/gfx/layers/FrameMetrics.h
+++ b/gfx/layers/FrameMetrics.h
@@ -165,26 +165,26 @@ public:
// and the scrollableRect hasn't been updated yet.
// We move the scrollableRect up because we don't know if we can move it
// down. i.e. we know that scrollableRect can go back as far as zero.
// but we don't know how much further ahead it can go.
CSSRect GetExpandedScrollableRect() const
{
CSSRect scrollableRect = mScrollableRect;
CSSSize compSize = CalculateCompositedSizeInCssPixels();
- if (scrollableRect.width < compSize.width) {
+ if (scrollableRect.Width() < compSize.width) {
scrollableRect.x = std::max(0.f,
- scrollableRect.x - (compSize.width - scrollableRect.width));
- scrollableRect.width = compSize.width;
+ scrollableRect.x - (compSize.width - scrollableRect.Width()));
+ scrollableRect.SetWidth(compSize.width);
}
- if (scrollableRect.height < compSize.height) {
+ if (scrollableRect.Height() < compSize.height) {
scrollableRect.y = std::max(0.f,
- scrollableRect.y - (compSize.height - scrollableRect.height));
- scrollableRect.height = compSize.height;
+ scrollableRect.y - (compSize.height - scrollableRect.Height()));
+ scrollableRect.SetHeight(compSize.height);
}
return scrollableRect;
}
CSSSize CalculateCompositedSizeInCssPixels() const
{
if (GetZoom() == CSSToParentLayerScale2D(0, 0)) {
@@ -208,18 +208,18 @@ public:
size.height = std::min(size.height, mRootCompositionSize.height);
return size;
}
CSSRect CalculateScrollRange() const
{
CSSSize scrollPortSize = CalculateCompositedSizeInCssPixels();
CSSRect scrollRange = mScrollableRect;
- scrollRange.width = std::max(scrollRange.width - scrollPortSize.width, 0.0f);
- scrollRange.height = std::max(scrollRange.height - scrollPortSize.height, 0.0f);
+ scrollRange.SetWidth(std::max(scrollRange.Width() - scrollPortSize.width, 0.0f));
+ scrollRange.SetHeight(std::max(scrollRange.Height() - scrollPortSize.height, 0.0f));
return scrollRange;
}
void ScrollBy(const CSSPoint& aPoint)
{
mScrollOffset += aPoint;
}
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -1082,32 +1082,32 @@ public:
* in device pixels.
* If aRect is null no clipping will be performed.
*/
void SetClipRect(const Maybe<ParentLayerIntRect>& aRect)
{
if (mClipRect) {
if (!aRect) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ClipRect was %d,%d,%d,%d is <none>", this,
- mClipRect->x, mClipRect->y, mClipRect->width, mClipRect->height));
+ mClipRect->x, mClipRect->y, mClipRect->Width(), mClipRect->Height()));
mClipRect.reset();
Mutated();
} else {
if (!aRect->IsEqualEdges(*mClipRect)) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ClipRect was %d,%d,%d,%d is %d,%d,%d,%d", this,
- mClipRect->x, mClipRect->y, mClipRect->width, mClipRect->height,
- aRect->x, aRect->y, aRect->width, aRect->height));
+ mClipRect->x, mClipRect->y, mClipRect->Width(), mClipRect->Height(),
+ aRect->x, aRect->y, aRect->Width(), aRect->Height()));
mClipRect = aRect;
Mutated();
}
}
} else {
if (aRect) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ClipRect was <none> is %d,%d,%d,%d", this,
- aRect->x, aRect->y, aRect->width, aRect->height));
+ aRect->x, aRect->y, aRect->Width(), aRect->Height()));
mClipRect = aRect;
Mutated();
}
}
}
/**
* CONSTRUCTION PHASE ONLY
@@ -2743,17 +2743,17 @@ public:
virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override
{
// Snap our local transform first, and snap the inherited transform as well.
// This makes our snapping equivalent to what would happen if our content
// was drawn into a PaintedLayer (gfxContext would snap using the local
// transform, then we'd snap again when compositing the PaintedLayer).
mEffectiveTransform =
- SnapTransform(GetLocalTransform(), gfxRect(0, 0, mBounds.width, mBounds.height),
+ SnapTransform(GetLocalTransform(), gfxRect(0, 0, mBounds.Width(), mBounds.Height()),
nullptr)*
SnapTransformTranslation(aTransformToSurface, nullptr);
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
}
protected:
CanvasLayer(LayerManager* aManager, void* aImplData);
virtual ~CanvasLayer();
--- a/gfx/layers/LayersLogging.h
+++ b/gfx/layers/LayersLogging.h
@@ -80,29 +80,29 @@ AppendToString(std::stringstream& aStrea
template<class T>
void
AppendToString(std::stringstream& aStream, const mozilla::gfx::RectTyped<T>& r,
const char* pfx="", const char* sfx="")
{
aStream << pfx;
aStream << nsPrintfCString(
"(x=%f, y=%f, w=%f, h=%f)",
- r.x, r.y, r.width, r.height).get();
+ r.x, r.y, r.Width(), r.Height()).get();
aStream << sfx;
}
template<class T>
void
AppendToString(std::stringstream& aStream, const mozilla::gfx::IntRectTyped<T>& r,
const char* pfx="", const char* sfx="")
{
aStream << pfx;
aStream << nsPrintfCString(
"(x=%d, y=%d, w=%d, h=%d)",
- r.x, r.y, r.width, r.height).get();
+ r.x, r.y, r.Width(), r.Height()).get();
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const wr::ColorF& c,
const char* pfx="", const char* sfx="");
void
--- a/gfx/layers/opengl/OGLShaderProgram.h
+++ b/gfx/layers/opengl/OGLShaderProgram.h
@@ -374,37 +374,37 @@ public:
}
void SetVisibleCenter(const gfx::Point& aVisibleCenter) {
float vals[2] = { aVisibleCenter.x, aVisibleCenter.y };
SetUniform(KnownUniform::VisibleCenter, 2, vals);
}
void SetLayerRects(const gfx::Rect* aRects) {
- float vals[16] = { aRects[0].x, aRects[0].y, aRects[0].width, aRects[0].height,
- aRects[1].x, aRects[1].y, aRects[1].width, aRects[1].height,
- aRects[2].x, aRects[2].y, aRects[2].width, aRects[2].height,
- aRects[3].x, aRects[3].y, aRects[3].width, aRects[3].height };
+ float vals[16] = { aRects[0].x, aRects[0].y, aRects[0].Width(), aRects[0].Height(),
+ aRects[1].x, aRects[1].y, aRects[1].Width(), aRects[1].Height(),
+ aRects[2].x, aRects[2].y, aRects[2].Width(), aRects[2].Height(),
+ aRects[3].x, aRects[3].y, aRects[3].Width(), aRects[3].Height() };
SetUniform(KnownUniform::LayerRects, 16, vals);
}
void SetProjectionMatrix(const gfx::Matrix4x4& aMatrix) {
SetMatrixUniform(KnownUniform::MatrixProj, aMatrix);
}
// sets this program's texture transform, if it uses one
void SetTextureTransform(const gfx::Matrix4x4& aMatrix) {
SetMatrixUniform(KnownUniform::TextureTransform, aMatrix);
}
void SetTextureRects(const gfx::Rect* aRects) {
- float vals[16] = { aRects[0].x, aRects[0].y, aRects[0].width, aRects[0].height,
- aRects[1].x, aRects[1].y, aRects[1].width, aRects[1].height,
- aRects[2].x, aRects[2].y, aRects[2].width, aRects[2].height,
- aRects[3].x, aRects[3].y, aRects[3].width, aRects[3].height };
+ float vals[16] = { aRects[0].x, aRects[0].y, aRects[0].Width(), aRects[0].Height(),
+ aRects[1].x, aRects[1].y, aRects[1].Width(), aRects[1].Height(),
+ aRects[2].x, aRects[2].y, aRects[2].Width(), aRects[2].Height(),
+ aRects[3].x, aRects[3].y, aRects[3].Width(), aRects[3].Height() };
SetUniform(KnownUniform::TextureRects, 16, vals);
}
void SetRenderOffset(const nsIntPoint& aOffset) {
float vals[4] = { float(aOffset.x), float(aOffset.y) };
SetUniform(KnownUniform::RenderTargetOffset, 2, vals);
}
--- a/gfx/src/nsRect.h
+++ b/gfx/src/nsRect.h
@@ -69,38 +69,38 @@ struct nsRect :
MOZ_MUST_USE nsRect SaturatingUnionEdges(const nsRect& aRect) const
{
#ifdef NS_COORD_IS_FLOAT
return UnionEdges(aRect);
#else
nsRect result;
result.x = std::min(aRect.x, x);
- int64_t w = std::max(int64_t(aRect.x) + aRect.width, int64_t(x) + width) - result.x;
+ int64_t w = std::max(int64_t(aRect.x) + aRect.Width(), int64_t(x) + width) - result.x;
if (MOZ_UNLIKELY(w > nscoord_MAX)) {
// Clamp huge negative x to nscoord_MIN / 2 and try again.
result.x = std::max(result.x, nscoord_MIN / 2);
- w = std::max(int64_t(aRect.x) + aRect.width, int64_t(x) + width) - result.x;
+ w = std::max(int64_t(aRect.x) + aRect.Width(), int64_t(x) + width) - result.x;
if (MOZ_UNLIKELY(w > nscoord_MAX)) {
w = nscoord_MAX;
}
}
- result.width = nscoord(w);
+ result.SetWidth(nscoord(w));
result.y = std::min(aRect.y, y);
- int64_t h = std::max(int64_t(aRect.y) + aRect.height, int64_t(y) + height) - result.y;
+ int64_t h = std::max(int64_t(aRect.y) + aRect.Height(), int64_t(y) + height) - result.y;
if (MOZ_UNLIKELY(h > nscoord_MAX)) {
// Clamp huge negative y to nscoord_MIN / 2 and try again.
result.y = std::max(result.y, nscoord_MIN / 2);
- h = std::max(int64_t(aRect.y) + aRect.height, int64_t(y) + height) - result.y;
+ h = std::max(int64_t(aRect.y) + aRect.Height(), int64_t(y) + height) - result.y;
if (MOZ_UNLIKELY(h > nscoord_MAX)) {
h = nscoord_MAX;
}
}
- result.height = nscoord(h);
+ result.SetHeight(nscoord(h));
return result;
#endif
}
#ifndef NS_COORD_IS_FLOAT
// Make all nsRect Union methods be saturating.
MOZ_MUST_USE nsRect UnionEdges(const nsRect& aRect) const
{
@@ -189,85 +189,85 @@ nsRect::ScaleToOtherAppUnitsRoundOut(int
return *this;
}
nsRect rect;
nscoord right = NSToCoordCeil(NSCoordScale(XMost(), aFromAPP, aToAPP));
nscoord bottom = NSToCoordCeil(NSCoordScale(YMost(), aFromAPP, aToAPP));
rect.x = NSToCoordFloor(NSCoordScale(x, aFromAPP, aToAPP));
rect.y = NSToCoordFloor(NSCoordScale(y, aFromAPP, aToAPP));
- rect.width = (right - rect.x);
- rect.height = (bottom - rect.y);
+ rect.SetWidth(right - rect.x);
+ rect.SetHeight(bottom - rect.y);
return rect;
}
inline nsRect
nsRect::ScaleToOtherAppUnitsRoundIn(int32_t aFromAPP, int32_t aToAPP) const
{
if (aFromAPP == aToAPP) {
return *this;
}
nsRect rect;
nscoord right = NSToCoordFloor(NSCoordScale(XMost(), aFromAPP, aToAPP));
nscoord bottom = NSToCoordFloor(NSCoordScale(YMost(), aFromAPP, aToAPP));
rect.x = NSToCoordCeil(NSCoordScale(x, aFromAPP, aToAPP));
rect.y = NSToCoordCeil(NSCoordScale(y, aFromAPP, aToAPP));
- rect.width = (right - rect.x);
- rect.height = (bottom - rect.y);
+ rect.SetWidth(right - rect.x);
+ rect.SetHeight(bottom - rect.y);
return rect;
}
// scale the rect but round to preserve centers
inline mozilla::gfx::IntRect
nsRect::ScaleToNearestPixels(float aXScale, float aYScale,
nscoord aAppUnitsPerPixel) const
{
mozilla::gfx::IntRect rect;
rect.x = NSToIntRoundUp(NSAppUnitsToDoublePixels(x, aAppUnitsPerPixel) * aXScale);
rect.y = NSToIntRoundUp(NSAppUnitsToDoublePixels(y, aAppUnitsPerPixel) * aYScale);
// Avoid negative widths and heights due to overflow
- rect.width = std::max(0, NSToIntRoundUp(NSAppUnitsToDoublePixels(XMost(),
- aAppUnitsPerPixel) * aXScale) - rect.x);
- rect.height = std::max(0, NSToIntRoundUp(NSAppUnitsToDoublePixels(YMost(),
- aAppUnitsPerPixel) * aYScale) - rect.y);
+ rect.SetWidth(std::max(0, NSToIntRoundUp(NSAppUnitsToDoublePixels(XMost(),
+ aAppUnitsPerPixel) * aXScale) - rect.x));
+ rect.SetHeight(std::max(0, NSToIntRoundUp(NSAppUnitsToDoublePixels(YMost(),
+ aAppUnitsPerPixel) * aYScale) - rect.y));
return rect;
}
// scale the rect but round to smallest containing rect
inline mozilla::gfx::IntRect
nsRect::ScaleToOutsidePixels(float aXScale, float aYScale,
nscoord aAppUnitsPerPixel) const
{
mozilla::gfx::IntRect rect;
rect.x = NSToIntFloor(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel)) * aXScale);
rect.y = NSToIntFloor(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel)) * aYScale);
// Avoid negative widths and heights due to overflow
- rect.width = std::max(0, NSToIntCeil(NSAppUnitsToFloatPixels(XMost(),
- float(aAppUnitsPerPixel)) * aXScale) - rect.x);
- rect.height = std::max(0, NSToIntCeil(NSAppUnitsToFloatPixels(YMost(),
- float(aAppUnitsPerPixel)) * aYScale) - rect.y);
+ rect.SetWidth(std::max(0, NSToIntCeil(NSAppUnitsToFloatPixels(XMost(),
+ float(aAppUnitsPerPixel)) * aXScale) - rect.x));
+ rect.SetHeight(std::max(0, NSToIntCeil(NSAppUnitsToFloatPixels(YMost(),
+ float(aAppUnitsPerPixel)) * aYScale) - rect.y));
return rect;
}
// scale the rect but round to largest contained rect
inline mozilla::gfx::IntRect
nsRect::ScaleToInsidePixels(float aXScale, float aYScale,
nscoord aAppUnitsPerPixel) const
{
mozilla::gfx::IntRect rect;
rect.x = NSToIntCeil(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel)) * aXScale);
rect.y = NSToIntCeil(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel)) * aYScale);
// Avoid negative widths and heights due to overflow
- rect.width = std::max(0, NSToIntFloor(NSAppUnitsToFloatPixels(XMost(),
- float(aAppUnitsPerPixel)) * aXScale) - rect.x);
- rect.height = std::max(0, NSToIntFloor(NSAppUnitsToFloatPixels(YMost(),
- float(aAppUnitsPerPixel)) * aYScale) - rect.y);
+ rect.SetWidth(std::max(0, NSToIntFloor(NSAppUnitsToFloatPixels(XMost(),
+ float(aAppUnitsPerPixel)) * aXScale) - rect.x));
+ rect.SetHeight(std::max(0, NSToIntFloor(NSAppUnitsToFloatPixels(YMost(),
+ float(aAppUnitsPerPixel)) * aYScale) - rect.y));
return rect;
}
inline mozilla::gfx::IntRect
nsRect::ToNearestPixels(nscoord aAppUnitsPerPixel) const
{
return ScaleToNearestPixels(1.0f, 1.0f, aAppUnitsPerPixel);
}
@@ -289,36 +289,37 @@ nsRect::RemoveResolution(const float aRe
{
MOZ_ASSERT(aResolution > 0.0f);
nsRect rect;
rect.x = NSToCoordRound(NSCoordToFloat(x) / aResolution);
rect.y = NSToCoordRound(NSCoordToFloat(y) / aResolution);
// A 1x1 rect indicates we are just hit testing a point, so pass down a 1x1
// rect as well instead of possibly rounding the width or height to zero.
if (width == 1 && height == 1) {
- rect.width = rect.height = 1;
+ rect.SetWidth(1);
+ rect.SetHeight(1);
} else {
- rect.width = NSToCoordCeil(NSCoordToFloat(width) / aResolution);
- rect.height = NSToCoordCeil(NSCoordToFloat(height) / aResolution);
+ rect.SetWidth(NSToCoordCeil(NSCoordToFloat(width) / aResolution));
+ rect.SetHeight(NSToCoordCeil(NSCoordToFloat(height) / aResolution));
}
return rect;
}
const mozilla::gfx::IntRect& GetMaxSizedIntRect();
// app units are integer multiples of pixels, so no rounding needed
template<class units>
nsRect
ToAppUnits(const mozilla::gfx::IntRectTyped<units>& aRect, nscoord aAppUnitsPerPixel)
{
return nsRect(NSIntPixelsToAppUnits(aRect.x, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(aRect.y, aAppUnitsPerPixel),
- NSIntPixelsToAppUnits(aRect.width, aAppUnitsPerPixel),
- NSIntPixelsToAppUnits(aRect.height, aAppUnitsPerPixel));
+ NSIntPixelsToAppUnits(aRect.Width(), aAppUnitsPerPixel),
+ NSIntPixelsToAppUnits(aRect.Height(), aAppUnitsPerPixel));
}
#ifdef DEBUG
// Diagnostics
extern FILE* operator<<(FILE* out, const nsRect& rect);
#endif // DEBUG
#endif /* NSRECT_H */
--- a/gfx/src/nsRegion.h
+++ b/gfx/src/nsRegion.h
@@ -53,18 +53,18 @@ public:
typedef nsRect RectType;
typedef nsPoint PointType;
typedef nsMargin MarginType;
nsRegion () { pixman_region32_init(&mImpl); }
MOZ_IMPLICIT nsRegion (const nsRect& aRect) { pixman_region32_init_rect(&mImpl,
aRect.x,
aRect.y,
- aRect.width,
- aRect.height); }
+ aRect.Width(),
+ aRect.Height()); }
explicit nsRegion (mozilla::gfx::ArrayView<pixman_box32_t> aRects)
{
pixman_region32_init_rects(&mImpl, aRects.Data(), aRects.Length());
}
nsRegion (const nsRegion& aRegion) { pixman_region32_init(&mImpl); pixman_region32_copy(&mImpl,aRegion.Impl()); }
nsRegion (nsRegion&& aRegion) { mImpl = aRegion.mImpl; pixman_region32_init(&aRegion.mImpl); }
nsRegion& operator = (nsRegion&& aRegion) {
pixman_region32_fini(&mImpl);
@@ -116,17 +116,17 @@ public:
return *this;
}
nsRegion& And(const nsRect& aRect, const nsRegion& aRegion)
{
return And(aRegion, aRect);
}
nsRegion& And(const nsRegion& aRegion, const nsRect& aRect)
{
- pixman_region32_intersect_rect(&mImpl, aRegion.Impl(), aRect.x, aRect.y, aRect.width, aRect.height);
+ pixman_region32_intersect_rect(&mImpl, aRegion.Impl(), aRect.x, aRect.y, aRect.Width(), aRect.Height());
return *this;
}
nsRegion& And(const nsRect& aRect1, const nsRect& aRect2)
{
nsRect TmpRect;
TmpRect.IntersectRect(aRect1, aRect2);
return Copy(TmpRect);
@@ -142,17 +142,17 @@ public:
}
nsRegion& Or(const nsRegion& aRgn1, const nsRegion& aRgn2)
{
pixman_region32_union(&mImpl, aRgn1.Impl(), aRgn2.Impl());
return *this;
}
nsRegion& Or(const nsRegion& aRegion, const nsRect& aRect)
{
- pixman_region32_union_rect(&mImpl, aRegion.Impl(), aRect.x, aRect.y, aRect.width, aRect.height);
+ pixman_region32_union_rect(&mImpl, aRegion.Impl(), aRect.x, aRect.y, aRect.Width(), aRect.Height());
return *this;
}
nsRegion& Or(const nsRect& aRect, const nsRegion& aRegion)
{
return Or(aRegion, aRect);
}
nsRegion& Or(const nsRect& aRect1, const nsRect& aRect2)
{
@@ -789,21 +789,21 @@ protected:
// between different types of BaseIntRegions.
explicit BaseIntRegion(const nsRegion& aImpl) : mImpl(aImpl) {}
const nsRegion& Impl() const { return mImpl; }
private:
nsRegion mImpl;
static nsRect ToRect(const Rect& aRect)
{
- return nsRect (aRect.x, aRect.y, aRect.width, aRect.height);
+ return nsRect (aRect.x, aRect.y, aRect.Width(), aRect.Height());
}
static Rect FromRect(const nsRect& aRect)
{
- return Rect (aRect.x, aRect.y, aRect.width, aRect.height);
+ return Rect (aRect.x, aRect.y, aRect.Width(), aRect.Height());
}
Derived& This()
{
return *static_cast<Derived*>(this);
}
const Derived& This() const
{
--- a/gfx/thebes/RoundedRect.h
+++ b/gfx/thebes/RoundedRect.h
@@ -20,18 +20,18 @@ namespace mozilla {
struct RoundedRect {
typedef mozilla::gfx::RectCornerRadii RectCornerRadii;
RoundedRect(gfxRect &aRect, RectCornerRadii &aCorners) : rect(aRect), corners(aCorners) { }
void Deflate(gfxFloat aTopWidth, gfxFloat aBottomWidth, gfxFloat aLeftWidth, gfxFloat aRightWidth) {
// deflate the internal rect
rect.x += aLeftWidth;
rect.y += aTopWidth;
- rect.width = std::max(0., rect.width - aLeftWidth - aRightWidth);
- rect.height = std::max(0., rect.height - aTopWidth - aBottomWidth);
+ rect.SetWidth(std::max(0., rect.Width() - aLeftWidth - aRightWidth));
+ rect.SetHeight(std::max(0., rect.Height() - aTopWidth - aBottomWidth));
corners.radii[mozilla::eCornerTopLeft].width =
std::max(0., corners.radii[mozilla::eCornerTopLeft].width - aLeftWidth);
corners.radii[mozilla::eCornerTopLeft].height =
std::max(0., corners.radii[mozilla::eCornerTopLeft].height - aTopWidth);
corners.radii[mozilla::eCornerTopRight].width =
std::max(0., corners.radii[mozilla::eCornerTopRight].width - aRightWidth);
--- a/gfx/thebes/gfx2DGlue.h
+++ b/gfx/thebes/gfx2DGlue.h
@@ -16,22 +16,22 @@
#include "mozilla/gfx/2D.h"
namespace mozilla {
namespace gfx {
inline Rect ToRect(const gfxRect &aRect)
{
return Rect(Float(aRect.x), Float(aRect.y),
- Float(aRect.width), Float(aRect.height));
+ Float(aRect.Width()), Float(aRect.Height()));
}
inline RectDouble ToRectDouble(const gfxRect &aRect)
{
- return RectDouble(aRect.x, aRect.y, aRect.width, aRect.height);
+ return RectDouble(aRect.x, aRect.y, aRect.Width(), aRect.Height());
}
inline Matrix ToMatrix(const gfxMatrix &aMatrix)
{
return Matrix(Float(aMatrix._11), Float(aMatrix._12), Float(aMatrix._21),
Float(aMatrix._22), Float(aMatrix._31), Float(aMatrix._32));
}
@@ -58,27 +58,27 @@ inline gfxPoint ThebesPoint(const Point
inline gfxSize ThebesSize(const Size &aSize)
{
return gfxSize(aSize.width, aSize.height);
}
inline gfxRect ThebesRect(const Rect &aRect)
{
- return gfxRect(aRect.x, aRect.y, aRect.width, aRect.height);
+ return gfxRect(aRect.x, aRect.y, aRect.Width(), aRect.Height());
}
inline gfxRect ThebesRect(const IntRect &aRect)
{
- return gfxRect(aRect.x, aRect.y, aRect.width, aRect.height);
+ return gfxRect(aRect.x, aRect.y, aRect.Width(), aRect.Height());
}
inline gfxRect ThebesRect(const RectDouble &aRect)
{
- return gfxRect(aRect.x, aRect.y, aRect.width, aRect.height);
+ return gfxRect(aRect.x, aRect.y, aRect.Width(), aRect.Height());
}
inline gfxImageFormat SurfaceFormatToImageFormat(SurfaceFormat aFormat)
{
switch (aFormat) {
case SurfaceFormat::B8G8R8A8:
return SurfaceFormat::A8R8G8B8_UINT32;
case SurfaceFormat::B8G8R8X8:
--- a/gfx/webrender_bindings/WebRenderTypes.h
+++ b/gfx/webrender_bindings/WebRenderTypes.h
@@ -231,28 +231,28 @@ static inline wr::LayoutVector2D ToLayou
}
template<class T>
static inline wr::LayoutRect ToLayoutRect(const gfx::RectTyped<T>& rect)
{
wr::LayoutRect r;
r.origin.x = rect.x;
r.origin.y = rect.y;
- r.size.width = rect.width;
- r.size.height = rect.height;
+ r.size.width = rect.Width();
+ r.size.height = rect.Height();
return r;
}
static inline wr::LayoutRect ToLayoutRect(const gfxRect rect)
{
wr::LayoutRect r;
r.origin.x = rect.x;
r.origin.y = rect.y;
- r.size.width = rect.width;
- r.size.height = rect.height;
+ r.size.width = rect.Width();
+ r.size.height = rect.Height();
return r;
}
template<class T>
static inline wr::LayoutRect ToLayoutRect(const gfx::IntRectTyped<T>& rect)
{
return ToLayoutRect(IntRectToRect(rect));
}