diff --git a/gfx/2d/Blur.cpp b/gfx/2d/Blur.cpp index 50467859c550..573b8922218d 100644 --- a/gfx/2d/Blur.cpp +++ b/gfx/2d/Blur.cpp @@ -502,13 +502,13 @@ AlphaBoxBlur::Init(const Rect& aRect, mSkipRect = IntRect(0, 0, 0, 0); } - CheckedInt stride = RoundUpToMultipleOf4(mRect.width); + CheckedInt stride = RoundUpToMultipleOf4(mRect.Width()); if (stride.isValid()) { mStride = stride.value(); // We need to leave room for an additional 3 bytes for a potential overrun // in our blurring code. - size_t size = BufferSizeFromStrideAndHeight(mStride, mRect.height, 3); + size_t size = BufferSizeFromStrideAndHeight(mStride, mRect.Height(), 3); if (size != 0) { mSurfaceAllocationSize = size; } @@ -527,7 +527,7 @@ AlphaBoxBlur::AlphaBoxBlur(const Rect& aRect, { IntRect intRect; if (aRect.ToIntRect(&intRect)) { - size_t minDataSize = BufferSizeFromStrideAndHeight(intRect.width, intRect.height); + size_t minDataSize = BufferSizeFromStrideAndHeight(intRect.Width(), intRect.Height()); if (minDataSize != 0) { mSurfaceAllocationSize = minDataSize; } @@ -542,7 +542,7 @@ AlphaBoxBlur::~AlphaBoxBlur() IntSize AlphaBoxBlur::GetSize() { - IntSize size(mRect.width, mRect.height); + IntSize size(mRect.Width(), mRect.Height()); return size; } diff --git a/gfx/2d/DrawTargetD2D1.cpp b/gfx/2d/DrawTargetD2D1.cpp index a74fdbef14fc..88dc187d80ca 100644 --- a/gfx/2d/DrawTargetD2D1.cpp +++ b/gfx/2d/DrawTargetD2D1.cpp @@ -192,8 +192,8 @@ DrawTargetD2D1::DrawSurface(SourceSurface *aSurface, samplingBounds = D2D1::RectF(0, 0, Float(aSurface->GetSize().width), Float(aSurface->GetSize().height)); } - Float xScale = aDest.width / aSource.width; - Float yScale = aDest.height / aSource.height; + Float xScale = aDest.Width() / aSource.Width(); + Float yScale = aDest.Height() / aSource.Height(); RefPtr brush; @@ -425,8 +425,8 @@ DrawTargetD2D1::MaskSurface(const Pattern &aSource, // we have to fixup our sizes here. size.width = bitmap->GetSize().width; size.height = bitmap->GetSize().height; - dest.width = size.width; - dest.height = size.height; + dest.SetWidth(size.width); + dest.SetHeight(size.height); } // FillOpacityMask only works if the antialias mode is MODE_ALIASED @@ -488,10 +488,10 @@ DrawTargetD2D1::CopySurface(SourceSurface *aSurface, } Rect srcRect(Float(sourceRect.x), Float(sourceRect.y), - Float(aSourceRect.width), Float(aSourceRect.height)); + Float(aSourceRect.Width()), Float(aSourceRect.Height())); Rect dstRect(Float(aDestination.x), Float(aDestination.y), - Float(aSourceRect.width), Float(aSourceRect.height)); + Float(aSourceRect.Width()), Float(aSourceRect.Height())); if (SUCCEEDED(hr) && bitmap) { mDC->SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND_COPY); @@ -1881,7 +1881,7 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) mat.PreTranslate(pat->mSamplingRect.x, pat->mSamplingRect.y); } else { // We will do a partial upload of the sampling restricted area from GetImageForSurface. - samplingBounds = D2D1::RectF(0, 0, pat->mSamplingRect.width, pat->mSamplingRect.height); + samplingBounds = D2D1::RectF(0, 0, pat->mSamplingRect.Width(), pat->mSamplingRect.Height()); } D2D1_EXTEND_MODE xRepeat = D2DExtend(pat->mExtendMode, Axis::X_AXIS); diff --git a/gfx/2d/DrawTargetSkia.cpp b/gfx/2d/DrawTargetSkia.cpp index eb90a2625c3c..9dfa743fa171 100644 --- a/gfx/2d/DrawTargetSkia.cpp +++ b/gfx/2d/DrawTargetSkia.cpp @@ -193,8 +193,8 @@ VerifyRGBXCorners(uint8_t* aData, const IntSize &aSize, const int32_t aStride, S return true; } - const int height = bounds.height; - const int width = bounds.width; + const int height = bounds.Height(); + const int width = bounds.Width(); const int pixelSize = 4; MOZ_ASSERT(aSize.width * pixelSize <= aStride); @@ -848,16 +848,16 @@ ShrinkClippedStrokedRect(const Rect &aStrokedRect, const IntRect &aDeviceClip, Rect userSpaceStrokeClip = UserSpaceStrokeClip(aDeviceClip, aTransform, aStrokeOptions); RectDouble strokedRectDouble( - aStrokedRect.x, aStrokedRect.y, aStrokedRect.width, aStrokedRect.height); + aStrokedRect.x, aStrokedRect.y, aStrokedRect.Width(), aStrokedRect.Height()); RectDouble intersection = strokedRectDouble.Intersect(RectDouble(userSpaceStrokeClip.x, userSpaceStrokeClip.y, - userSpaceStrokeClip.width, - userSpaceStrokeClip.height)); + userSpaceStrokeClip.Width(), + userSpaceStrokeClip.Height())); Double dashPeriodLength = DashPeriodLength(aStrokeOptions); if (intersection.IsEmpty() || dashPeriodLength == 0.0f) { return Rect( - intersection.x, intersection.y, intersection.width, intersection.height); + intersection.x, intersection.y, intersection.Width(), intersection.Height()); } // Reduce the rectangle side lengths in multiples of the dash period length @@ -871,8 +871,8 @@ ShrinkClippedStrokedRect(const Rect &aStrokedRect, const IntRect &aDeviceClip, strokedRectDouble.Deflate(insetBy); return Rect(strokedRectDouble.x, strokedRectDouble.y, - strokedRectDouble.width, - strokedRectDouble.height); + strokedRectDouble.Width(), + strokedRectDouble.Height()); } void @@ -1569,7 +1569,7 @@ DrawTarget::Draw3DTransformedSurface(SourceSurface* aSurface, const Matrix4x4& a } std::unique_ptr dstCanvas( SkCanvas::MakeRasterDirect( - SkImageInfo::Make(xformBounds.width, xformBounds.height, + SkImageInfo::Make(xformBounds.Width(), xformBounds.Height(), GfxFormatToSkiaColorType(dstSurf->GetFormat()), kPremul_SkAlphaType), dstSurf->GetData(), dstSurf->Stride())); @@ -1819,7 +1819,7 @@ DrawTargetSkia::CopySurface(SourceSurface *aSurface, mCanvas->save(); mCanvas->setMatrix(SkMatrix::MakeTrans(SkIntToScalar(aDestination.x), SkIntToScalar(aDestination.y))); - mCanvas->clipRect(SkRect::MakeIWH(aSourceRect.width, aSourceRect.height), SkClipOp::kReplace_deprecated); + mCanvas->clipRect(SkRect::MakeIWH(aSourceRect.Width(), aSourceRect.Height()), SkClipOp::kReplace_deprecated); SkPaint paint; if (!image->isOpaque()) { diff --git a/gfx/2d/FilterNodeD2D1.cpp b/gfx/2d/FilterNodeD2D1.cpp index 9f4ded23ca56..dd105f7126e1 100644 --- a/gfx/2d/FilterNodeD2D1.cpp +++ b/gfx/2d/FilterNodeD2D1.cpp @@ -812,7 +812,7 @@ FilterNodeD2D1::SetAttribute(uint32_t aIndex, const IntRect &aValue) MOZ_ASSERT(aIndex == ATT_TURBULENCE_RECT); mEffect->SetValue(D2D1_TURBULENCE_PROP_OFFSET, D2D1::Vector2F(Float(aValue.x), Float(aValue.y))); - mEffect->SetValue(D2D1_TURBULENCE_PROP_SIZE, D2D1::Vector2F(Float(aValue.width), Float(aValue.height))); + mEffect->SetValue(D2D1_TURBULENCE_PROP_SIZE, D2D1::Vector2F(Float(aValue.Width()), Float(aValue.Height()))); return; } diff --git a/gfx/2d/FilterNodeSoftware.cpp b/gfx/2d/FilterNodeSoftware.cpp index 3abdb7a02e0d..e946824cd836 100644 --- a/gfx/2d/FilterNodeSoftware.cpp +++ b/gfx/2d/FilterNodeSoftware.cpp @@ -218,17 +218,17 @@ FillRectWithPixel(DataSourceSurface *aSurface, const IntRect &aFillRect, IntPoin // Fill the first row by hand. if (bpp == 4) { uint32_t sourcePixel = *(uint32_t*)sourcePixelData; - for (int32_t x = 0; x < aFillRect.width; x++) { + for (int32_t x = 0; x < aFillRect.Width(); x++) { *((uint32_t*)data + x) = sourcePixel; } } else if (BytesPerPixel(aSurface->GetFormat()) == 1) { uint8_t sourcePixel = *sourcePixelData; - memset(data, sourcePixel, aFillRect.width); + memset(data, sourcePixel, aFillRect.Width()); } // Copy the first row into the other rows. - for (int32_t y = 1; y < aFillRect.height; y++) { - PodCopy(data + y * surfMap.GetStride(), data, aFillRect.width * bpp); + for (int32_t y = 1; y < aFillRect.Height(); y++) { + PodCopy(data + y * surfMap.GetStride(), data, aFillRect.Width() * bpp); } } @@ -252,13 +252,13 @@ FillRectWithVerticallyRepeatingHorizontalStrip(DataSourceSurface *aSurface, uint8_t* sampleData = DataAtOffset(aSurface, surfMap.GetMappedSurface(), aSampleRect.TopLeft()); uint8_t* data = DataAtOffset(aSurface, surfMap.GetMappedSurface(), aFillRect.TopLeft()); if (BytesPerPixel(aSurface->GetFormat()) == 4) { - for (int32_t y = 0; y < aFillRect.height; y++) { - PodCopy((uint32_t*)data, (uint32_t*)sampleData, aFillRect.width); + for (int32_t y = 0; y < aFillRect.Height(); y++) { + PodCopy((uint32_t*)data, (uint32_t*)sampleData, aFillRect.Width()); data += surfMap.GetStride(); } } else if (BytesPerPixel(aSurface->GetFormat()) == 1) { - for (int32_t y = 0; y < aFillRect.height; y++) { - PodCopy(data, sampleData, aFillRect.width); + for (int32_t y = 0; y < aFillRect.Height(); y++) { + PodCopy(data, sampleData, aFillRect.Width()); data += surfMap.GetStride(); } } @@ -284,18 +284,18 @@ FillRectWithHorizontallyRepeatingVerticalStrip(DataSourceSurface *aSurface, uint8_t* sampleData = DataAtOffset(aSurface, surfMap.GetMappedSurface(), aSampleRect.TopLeft()); uint8_t* data = DataAtOffset(aSurface, surfMap.GetMappedSurface(), aFillRect.TopLeft()); if (BytesPerPixel(aSurface->GetFormat()) == 4) { - for (int32_t y = 0; y < aFillRect.height; y++) { + for (int32_t y = 0; y < aFillRect.Height(); y++) { int32_t sampleColor = *((uint32_t*)sampleData); - for (int32_t x = 0; x < aFillRect.width; x++) { + for (int32_t x = 0; x < aFillRect.Width(); x++) { *((uint32_t*)data + x) = sampleColor; } data += surfMap.GetStride(); sampleData += surfMap.GetStride(); } } else if (BytesPerPixel(aSurface->GetFormat()) == 1) { - for (int32_t y = 0; y < aFillRect.height; y++) { + for (int32_t y = 0; y < aFillRect.Height(); y++) { uint8_t sampleColor = *sampleData; - memset(data, sampleColor, aFillRect.width); + memset(data, sampleColor, aFillRect.Width()); data += surfMap.GetStride(); sampleData += surfMap.GetStride(); } @@ -316,24 +316,24 @@ DuplicateEdges(DataSourceSurface* aSurface, const IntRect &aFromRect) switch (ix) { case 0: fill.x = 0; - fill.width = aFromRect.x; + fill.SetWidth(aFromRect.x); sampleRect.x = fill.XMost(); - sampleRect.width = 1; + sampleRect.SetWidth(1); break; case 1: fill.x = aFromRect.x; - fill.width = aFromRect.width; + fill.SetWidth(aFromRect.Width()); sampleRect.x = fill.x; - sampleRect.width = fill.width; + sampleRect.SetWidth(fill.Width()); break; case 2: fill.x = aFromRect.XMost(); - fill.width = size.width - fill.x; + fill.SetWidth(size.width - fill.x); sampleRect.x = fill.x - 1; - sampleRect.width = 1; + sampleRect.SetWidth(1); break; } - if (fill.width <= 0) { + if (fill.Width() <= 0) { continue; } bool xIsMiddle = (ix == 1); @@ -341,24 +341,24 @@ DuplicateEdges(DataSourceSurface* aSurface, const IntRect &aFromRect) switch (iy) { case 0: fill.y = 0; - fill.height = aFromRect.y; + fill.SetHeight(aFromRect.y); sampleRect.y = fill.YMost(); - sampleRect.height = 1; + sampleRect.SetHeight(1); break; case 1: fill.y = aFromRect.y; - fill.height = aFromRect.height; + fill.SetHeight(aFromRect.Height()); sampleRect.y = fill.y; - sampleRect.height = fill.height; + sampleRect.SetHeight(fill.Height()); break; case 2: fill.y = aFromRect.YMost(); - fill.height = size.height - fill.y; + fill.SetHeight(size.height - fill.y); sampleRect.y = fill.y - 1; - sampleRect.height = 1; + sampleRect.SetHeight(1); break; } - if (fill.height <= 0) { + if (fill.Height() <= 0) { continue; } bool yIsMiddle = (iy == 1); @@ -381,8 +381,8 @@ DuplicateEdges(DataSourceSurface* aSurface, const IntRect &aFromRect) static IntPoint TileIndex(const IntRect &aFirstTileRect, const IntPoint &aPoint) { - return IntPoint(int32_t(floor(double(aPoint.x - aFirstTileRect.x) / aFirstTileRect.width)), - int32_t(floor(double(aPoint.y - aFirstTileRect.y) / aFirstTileRect.height))); + return IntPoint(int32_t(floor(double(aPoint.x - aFirstTileRect.x) / aFirstTileRect.Width())), + int32_t(floor(double(aPoint.y - aFirstTileRect.y) / aFirstTileRect.Height()))); } static void @@ -395,8 +395,8 @@ TileSurface(DataSourceSurface* aSource, DataSourceSurface* aTarget, const IntPoi for (int32_t ix = startIndex.x; ix <= endIndex.x; ix++) { for (int32_t iy = startIndex.y; iy <= endIndex.y; iy++) { - IntPoint destPoint(sourceRect.x + ix * sourceRect.width, - sourceRect.y + iy * sourceRect.height); + IntPoint destPoint(sourceRect.x + ix * sourceRect.Width(), + sourceRect.y + iy * sourceRect.Height()); IntRect destRect(destPoint, sourceRect.Size()); destRect = destRect.Intersect(targetRect); IntRect srcRect = destRect - destPoint; @@ -694,7 +694,7 @@ FilterNodeSoftware::GetInputDataSourceSurface(uint32_t aInputEnumIndex, #ifdef DEBUG_DUMP_SURFACES printf("

GetInputDataSourceSurface with aRect: %d, %d, %d, %d

\n", - aRect.x, aRect.y, aRect.width, aRect.height); + aRect.x, aRect.y, aRect.Width(), aRect.Height()); #endif int32_t inputIndex = InputIndex(aInputEnumIndex); if (inputIndex < 0 || (uint32_t)inputIndex >= NumberOfSetInputs()) { @@ -1147,7 +1147,7 @@ FilterNodeTransformSoftware::Render(const IntRect& aRect) return nullptr; } - Rect r(0, 0, srcRect.width, srcRect.height); + Rect r(0, 0, srcRect.Width(), srcRect.Height()); dt->SetTransform(transform); dt->DrawSurface(input, r, r, DrawSurfaceOptions(mSamplingFilter)); @@ -1218,7 +1218,7 @@ ApplyMorphology(const IntRect& aSourceRect, DataSourceSurface* aInput, { IntRect srcRect = aSourceRect - aDestRect.TopLeft(); IntRect destRect = aDestRect - aDestRect.TopLeft(); - IntRect tmpRect(destRect.x, srcRect.y, destRect.width, srcRect.height); + IntRect tmpRect(destRect.x, srcRect.y, destRect.Width(), srcRect.Height()); #ifdef DEBUG IntMargin margin = srcRect - destRect; MOZ_ASSERT(margin.top >= ry && margin.right >= rx && @@ -1499,20 +1499,20 @@ FilterNodeFloodSoftware::Render(const IntRect& aRect) if (format == SurfaceFormat::B8G8R8A8) { uint32_t color = ColorToBGRA(mColor); - for (int32_t y = 0; y < aRect.height; y++) { - for (int32_t x = 0; x < aRect.width; x++) { + for (int32_t y = 0; y < aRect.Height(); y++) { + for (int32_t x = 0; x < aRect.Width(); x++) { *((uint32_t*)targetData + x) = color; } - PodZero(&targetData[aRect.width * 4], stride - aRect.width * 4); + PodZero(&targetData[aRect.Width() * 4], stride - aRect.Width() * 4); targetData += stride; } } else if (format == SurfaceFormat::A8) { uint8_t alpha = NS_lround(mColor.a * 255.0f); - for (int32_t y = 0; y < aRect.height; y++) { - for (int32_t x = 0; x < aRect.width; x++) { + for (int32_t y = 0; y < aRect.Height(); y++) { + for (int32_t x = 0; x < aRect.Width(); x++) { targetData[x] = alpha; } - PodZero(&targetData[aRect.width], stride - aRect.width); + PodZero(&targetData[aRect.Width()], stride - aRect.Width()); targetData += stride; } } else { @@ -1555,7 +1555,7 @@ FilterNodeTileSoftware::SetAttribute(uint32_t aIndex, { MOZ_ASSERT(aIndex == ATT_TILE_SOURCE_RECT); mSourceRect = IntRect(int32_t(aSourceRect.x), int32_t(aSourceRect.y), - int32_t(aSourceRect.width), int32_t(aSourceRect.height)); + int32_t(aSourceRect.Width()), int32_t(aSourceRect.Height())); Invalidate(); } @@ -1570,10 +1570,10 @@ struct CompareIntRects if (a.y != b.y) { return a.y < b.y; } - if (a.width != b.width) { - return a.width < b.width; + if (a.Width() != b.Width()) { + return a.Width() < b.Width(); } - return a.height < b.height; + return a.Height() < b.Height(); } }; @@ -1599,8 +1599,8 @@ FilterNodeTileSoftware::Render(const IntRect& aRect) IntPoint endIndex = TileIndex(mSourceRect, aRect.BottomRight()); for (int32_t ix = startIndex.x; ix <= endIndex.x; ix++) { for (int32_t iy = startIndex.y; iy <= endIndex.y; iy++) { - IntPoint sourceToDestOffset(ix * mSourceRect.width, - iy * mSourceRect.height); + IntPoint sourceToDestOffset(ix * mSourceRect.Width(), + iy * mSourceRect.Height()); IntRect destRect = aRect.Intersect(mSourceRect + sourceToDestOffset); IntRect srcRect = destRect - sourceToDestOffset; if (srcRect.IsEmpty()) { @@ -2504,10 +2504,10 @@ FilterNodeConvolveMatrixSoftware::DoRender(const IntRect& aRect, } int32_t bias = NS_lround(mBias * 255 * factorFromShifts); - for (int32_t y = 0; y < aRect.height; y++) { - for (int32_t x = 0; x < aRect.width; x++) { + for (int32_t y = 0; y < aRect.Height(); y++) { + for (int32_t x = 0; x < aRect.Width(); x++) { ConvolvePixel(sourceData, targetData, - aRect.width, aRect.height, sourceStride, targetStride, + aRect.Width(), aRect.Height(), sourceStride, targetStride, x, y, intKernel, bias, shiftL, shiftR, mPreserveAlpha, mKernelSize.width, mKernelSize.height, mTarget.x, mTarget.y, aKernelUnitLengthX, aKernelUnitLengthY); @@ -2650,8 +2650,8 @@ FilterNodeDisplacementMapSoftware::Render(const IntRect& aRect) float scaleOver255 = mScale / 255.0f; float scaleAdjustment = -0.5f * mScale; - for (int32_t y = 0; y < aRect.height; y++) { - for (int32_t x = 0; x < aRect.width; x++) { + for (int32_t y = 0; y < aRect.Height(); y++) { + for (int32_t x = 0; x < aRect.Width(); x++) { uint32_t mapIndex = y * mapStride + 4 * x; uint32_t targIndex = y * targetStride + 4 * x; int32_t sourceX = x + @@ -2663,7 +2663,7 @@ FilterNodeDisplacementMapSoftware::Render(const IntRect& aRect) } // Keep valgrind happy. - PodZero(&targetData[y * targetStride + 4 * aRect.width], targetStride - 4 * aRect.width); + PodZero(&targetData[y * targetStride + 4 * aRect.Width()], targetStride - 4 * aRect.Width()); } return target.forget(); @@ -2974,7 +2974,7 @@ FilterNodeBlurXYSoftware::Render(const IntRect& aRect) } RefPtr target; - Rect r(0, 0, srcRect.width, srcRect.height); + Rect r(0, 0, srcRect.Width(), srcRect.Height()); if (input->GetFormat() == SurfaceFormat::A8) { target = Factory::CreateDataSourceSurface(srcRect.Size(), SurfaceFormat::A8); diff --git a/gfx/gl/DecomposeIntoNoRepeatTriangles.cpp b/gfx/gl/DecomposeIntoNoRepeatTriangles.cpp index 829c20187029..b52c64c6617c 100644 --- a/gfx/gl/DecomposeIntoNoRepeatTriangles.cpp +++ b/gfx/gl/DecomposeIntoNoRepeatTriangles.cpp @@ -110,8 +110,8 @@ DecomposeIntoNoRepeatTriangles(const gfx::IntRect& aTexCoordRect, NS_ASSERTION(!xwrap || xlen > 0.0f, "xlen isn't > 0, what's going on?"); NS_ASSERTION(!ywrap || ylen > 0.0f, "ylen isn't > 0, what's going on?"); - NS_ASSERTION(aTexCoordRect.width <= aTexSize.width && - aTexCoordRect.height <= aTexSize.height, "tex coord rect would cause tiling!"); + NS_ASSERTION(aTexCoordRect.Width() <= aTexSize.width && + aTexCoordRect.Height() <= aTexSize.height, "tex coord rect would cause tiling!"); if (!xwrap && !ywrap) { aRects.addRect(0.0f, 0.0f, diff --git a/gfx/gl/GLTextureImage.cpp b/gfx/gl/GLTextureImage.cpp index c91d558af441..422e4500c4fa 100644 --- a/gfx/gl/GLTextureImage.cpp +++ b/gfx/gl/GLTextureImage.cpp @@ -359,9 +359,9 @@ gfx::IntRect TiledTextureImage::GetSrcTileRect() { gfx::IntRect rect = GetTileRect(); const bool needsYFlip = mFlags & OriginBottomLeft; - unsigned int srcY = needsYFlip ? mSize.height - rect.height - rect.y + unsigned int srcY = needsYFlip ? mSize.height - rect.Height() - rect.y : rect.y; - return gfx::IntRect(rect.x, srcY, rect.width, rect.height); + return gfx::IntRect(rect.x, srcY, rect.Width(), rect.Height()); } void diff --git a/gfx/gl/GLUploadHelpers.cpp b/gfx/gl/GLUploadHelpers.cpp index 75165eedf787..ef255d823c50 100644 --- a/gfx/gl/GLUploadHelpers.cpp +++ b/gfx/gl/GLUploadHelpers.cpp @@ -506,8 +506,8 @@ UploadImageDataToTexture(GLContext* gl, 0, rect.x, rect.y, - rect.width, - rect.height, + rect.Width(), + rect.Height(), aStride, pixelSize, format, diff --git a/gfx/layers/Compositor.cpp b/gfx/layers/Compositor.cpp index 19955e8a6507..3c364f530528 100644 --- a/gfx/layers/Compositor.cpp +++ b/gfx/layers/Compositor.cpp @@ -186,16 +186,16 @@ UpdateTextureCoordinates(gfx::TexturedTriangle& aTriangle, const gfx::Rect& aTextureCoords) { // Calculate the relative offset of the intersection within the layer. - float dx = (aIntersection.x - aRect.x) / aRect.width; - float dy = (aIntersection.y - aRect.y) / aRect.height; + float dx = (aIntersection.x - aRect.x) / aRect.Width(); + float dy = (aIntersection.y - aRect.y) / aRect.Height(); // Update the texture offset. - float x = aTextureCoords.x + dx * aTextureCoords.width; - float y = aTextureCoords.y + dy * aTextureCoords.height; + float x = aTextureCoords.x + dx * aTextureCoords.Width(); + float y = aTextureCoords.y + dy * aTextureCoords.Height(); // Scale the texture width and height. - float w = aTextureCoords.width * aIntersection.width / aRect.width; - float h = aTextureCoords.height * aIntersection.height / aRect.height; + float w = aTextureCoords.Width() * aIntersection.Width() / aRect.Width(); + float h = aTextureCoords.Height() * aIntersection.Height() / aRect.Height(); static const auto Clamp = [](float& f) { @@ -205,8 +205,8 @@ UpdateTextureCoordinates(gfx::TexturedTriangle& aTriangle, auto UpdatePoint = [&](const gfx::Point& p, gfx::Point& t) { - t.x = x + (p.x - aIntersection.x) / aIntersection.width * w; - t.y = y + (p.y - aIntersection.y) / aIntersection.height * h; + t.x = x + (p.x - aIntersection.x) / aIntersection.Width() * w; + t.y = y + (p.y - aIntersection.y) / aIntersection.Height() * h; Clamp(t.x); Clamp(t.y); @@ -295,8 +295,8 @@ GenerateTexturedTriangles(const gfx::Polygon& aPolygon, continue; } - MOZ_ASSERT(rect.width > 0.0f && rect.height > 0.0f); - MOZ_ASSERT(intersection.width > 0.0f && intersection.height > 0.0f); + MOZ_ASSERT(rect.Width() > 0.0f && rect.Height() > 0.0f); + MOZ_ASSERT(intersection.Width() > 0.0f && intersection.Height() > 0.0f); // Since the texture was created for non-split geometry, we need to // update the texture coordinates to account for the split. @@ -372,22 +372,22 @@ Compositor::SlowDrawRect(const gfx::Rect& aRect, const gfx::Color& aColor, effects.mPrimaryEffect = new EffectSolidColor(aColor); // left this->DrawQuad(gfx::Rect(aRect.x, aRect.y, - aStrokeWidth, aRect.height), + aStrokeWidth, aRect.Height()), aClipRect, effects, opacity, aTransform); // top this->DrawQuad(gfx::Rect(aRect.x + aStrokeWidth, aRect.y, - aRect.width - 2 * aStrokeWidth, aStrokeWidth), + aRect.Width() - 2 * aStrokeWidth, aStrokeWidth), aClipRect, effects, opacity, aTransform); // right - this->DrawQuad(gfx::Rect(aRect.x + aRect.width - aStrokeWidth, aRect.y, - aStrokeWidth, aRect.height), + this->DrawQuad(gfx::Rect(aRect.x + aRect.Width() - aStrokeWidth, aRect.y, + aStrokeWidth, aRect.Height()), aClipRect, effects, opacity, aTransform); // bottom - this->DrawQuad(gfx::Rect(aRect.x + aStrokeWidth, aRect.y + aRect.height - aStrokeWidth, - aRect.width - 2 * aStrokeWidth, aStrokeWidth), + this->DrawQuad(gfx::Rect(aRect.x + aStrokeWidth, aRect.y + aRect.Height() - aStrokeWidth, + aRect.Width() - 2 * aStrokeWidth, aStrokeWidth), aClipRect, effects, opacity, aTransform); } @@ -453,23 +453,23 @@ DecomposeIntoNoRepeatRects(const gfx::Rect& aRect, // If the texture should be flipped, it will have negative height. Detect that // here and compensate for it. We will flip each rect as we emit it. bool flipped = false; - if (texCoordRect.height < 0) { + if (texCoordRect.Height() < 0) { flipped = true; - texCoordRect.y += texCoordRect.height; - texCoordRect.height = -texCoordRect.height; + texCoordRect.y += texCoordRect.Height(); + texCoordRect.SetHeight(-texCoordRect.Height()); } // Wrap the texture coordinates so they are within [0,1] and cap width/height // at 1. We rely on this below. texCoordRect = gfx::Rect(gfx::Point(WrapTexCoord(texCoordRect.x), WrapTexCoord(texCoordRect.y)), - gfx::Size(std::min(texCoordRect.width, 1.0f), - std::min(texCoordRect.height, 1.0f))); + gfx::Size(std::min(texCoordRect.Width(), 1.0f), + std::min(texCoordRect.Height(), 1.0f))); NS_ASSERTION(texCoordRect.x >= 0.0f && texCoordRect.x <= 1.0f && texCoordRect.y >= 0.0f && texCoordRect.y <= 1.0f && - texCoordRect.width >= 0.0f && texCoordRect.width <= 1.0f && - texCoordRect.height >= 0.0f && texCoordRect.height <= 1.0f && + texCoordRect.Width() >= 0.0f && texCoordRect.Width() <= 1.0f && + texCoordRect.Height() >= 0.0f && texCoordRect.Height() <= 1.0f && texCoordRect.XMost() >= 0.0f && texCoordRect.XMost() <= 2.0f && texCoordRect.YMost() >= 0.0f && texCoordRect.YMost() <= 2.0f, "We just wrapped the texture coordinates, didn't we?"); @@ -513,8 +513,8 @@ DecomposeIntoNoRepeatRects(const gfx::Rect& aRect, // tl.x .. 1.0 and then from 0.0 .. br.x (which we just wrapped above). // The same applies for the Y axis. The midpoints we calculate here are // only valid if we actually wrap around. - GLfloat xmid = aRect.x + (1.0f - tl.x) / texCoordRect.width * aRect.width; - GLfloat ymid = aRect.y + (1.0f - tl.y) / texCoordRect.height * aRect.height; + GLfloat xmid = aRect.x + (1.0f - tl.x) / texCoordRect.Width() * aRect.Width(); + GLfloat ymid = aRect.y + (1.0f - tl.y) / texCoordRect.Height() * aRect.Height(); // Due to floating-point inaccuracy, we have to use XMost()-x and YMost()-y // to calculate width and height, respectively, to ensure that size will diff --git a/gfx/layers/D3D9SurfaceImage.cpp b/gfx/layers/D3D9SurfaceImage.cpp index e6ac11b51742..0d3c333d3145 100644 --- a/gfx/layers/D3D9SurfaceImage.cpp +++ b/gfx/layers/D3D9SurfaceImage.cpp @@ -173,7 +173,7 @@ D3D9SurfaceImage::AllocateAndCopy(D3D9RecycleAllocator* aAllocator, return E_FAIL; } - RECT src = { aRegion.x, aRegion.y, aRegion.x+aRegion.width, aRegion.y+aRegion.height }; + RECT src = { aRegion.x, aRegion.y, aRegion.x+aRegion.Width(), aRegion.y+aRegion.Height() }; hr = device->StretchRect(surface, &src, textureSurface, nullptr, D3DTEXF_NONE); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); diff --git a/gfx/layers/ImageLayers.cpp b/gfx/layers/ImageLayers.cpp index c40ee67513a6..0498ca649a91 100644 --- a/gfx/layers/ImageLayers.cpp +++ b/gfx/layers/ImageLayers.cpp @@ -44,11 +44,11 @@ void ImageLayer::ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSu SnapTransformTranslation(aTransformToSurface, nullptr); if (mScaleMode != ScaleMode::SCALE_NONE && - sourceRect.width != 0.0 && sourceRect.height != 0.0) { + sourceRect.Width() != 0.0 && sourceRect.Height() != 0.0) { NS_ASSERTION(mScaleMode == ScaleMode::STRETCH, "No other scalemodes than stretch and none supported yet."); - local.PreScale(mScaleToSize.width / sourceRect.width, - mScaleToSize.height / sourceRect.height, 1.0); + local.PreScale(mScaleToSize.width / sourceRect.Width(), + mScaleToSize.height / sourceRect.Height(), 1.0); mEffectiveTransformForBuffer = SnapTransform(local, sourceRect, nullptr) * diff --git a/gfx/layers/LayerScope.cpp b/gfx/layers/LayerScope.cpp index 73f47764d952..18f03ad562d4 100644 --- a/gfx/layers/LayerScope.cpp +++ b/gfx/layers/LayerScope.cpp @@ -376,8 +376,8 @@ static void DumpRect(T* aPacketRect, const Rect& aRect) { aPacketRect->set_x(aRect.x); aPacketRect->set_y(aRect.y); - aPacketRect->set_w(aRect.width); - aPacketRect->set_h(aRect.height); + aPacketRect->set_w(aRect.Width()); + aPacketRect->set_h(aRect.Height()); } static void DumpFilter(TexturePacket* aTexturePacket, diff --git a/gfx/layers/LayerTreeInvalidation.cpp b/gfx/layers/LayerTreeInvalidation.cpp index 24ace6bd3114..7cb6421b4235 100644 --- a/gfx/layers/LayerTreeInvalidation.cpp +++ b/gfx/layers/LayerTreeInvalidation.cpp @@ -83,7 +83,7 @@ TransformRect(const IntRect& aRect, const Matrix4x4& aTransform) return IntRect(); } - Rect rect(aRect.x, aRect.y, aRect.width, aRect.height); + Rect rect(aRect.x, aRect.y, aRect.Width(), aRect.Height()); rect = aTransform.TransformAndClipBounds(rect, Rect::MaxIntRect()); rect.RoundOut(); diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 545a5a1ce98f..980fabe5dbc4 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -525,7 +525,7 @@ Layer::CalculateScissorRect(const RenderTargetIntRect& aCurrentScissorRect) // See DefaultComputeEffectiveTransforms below NS_ASSERTION(is2D && matrix.PreservesAxisAlignedRectangles(), "Non preserves axis aligned transform with clipped child should have forced intermediate surface"); - gfx::Rect r(scissor.x, scissor.y, scissor.width, scissor.height); + gfx::Rect r(scissor.x, scissor.y, scissor.Width(), scissor.Height()); gfxRect trScissor = gfx::ThebesRect(matrix.TransformBounds(r)); trScissor.Round(); IntRect tmp; @@ -1883,8 +1883,8 @@ DumpRect(layerscope::LayersPacket::Layer::Rect* aLayerRect, { aLayerRect->set_x(aRect.x); aLayerRect->set_y(aRect.y); - aLayerRect->set_w(aRect.width); - aLayerRect->set_h(aRect.height); + aLayerRect->set_w(aRect.Width()); + aLayerRect->set_h(aRect.Height()); } // The static helper function sets the nsIntRegion into the packet @@ -2461,7 +2461,7 @@ SetAntialiasingFlags(Layer* aLayer, DrawTarget* aTarget) const IntRect& bounds = aLayer->GetVisibleRegion().ToUnknownRegion().GetBounds(); gfx::Rect transformedBounds = aTarget->GetTransform().TransformBounds(gfx::Rect(Float(bounds.x), Float(bounds.y), - Float(bounds.width), Float(bounds.height))); + Float(bounds.Width()), Float(bounds.Height()))); transformedBounds.RoundOut(); IntRect intTransformedBounds; transformedBounds.ToIntRect(&intTransformedBounds); @@ -2473,7 +2473,7 @@ SetAntialiasingFlags(Layer* aLayer, DrawTarget* aTarget) IntRect ToOutsideIntRect(const gfxRect &aRect) { - return IntRect::RoundOut(aRect.x, aRect.y, aRect.width, aRect.height); + return IntRect::RoundOut(aRect.x, aRect.y, aRect.Width(), aRect.Height()); } TextLayer::TextLayer(LayerManager* aManager, void* aImplData) diff --git a/gfx/layers/LayersHelpers.cpp b/gfx/layers/LayersHelpers.cpp index dd4178254ccd..9275299fffd4 100644 --- a/gfx/layers/LayersHelpers.cpp +++ b/gfx/layers/LayersHelpers.cpp @@ -28,15 +28,15 @@ ComputeBackdropCopyRect(const gfx::Rect& aRect, // Apply the layer transform. RectDouble dest = aTransform.TransformAndClipBounds( - RectDouble(aRect.x, aRect.y, aRect.width, aRect.height), - RectDouble(renderBounds.x, renderBounds.y, renderBounds.width, renderBounds.height)); + RectDouble(aRect.x, aRect.y, aRect.Width(), aRect.Height()), + RectDouble(renderBounds.x, renderBounds.y, renderBounds.Width(), renderBounds.Height())); dest -= rtOffset; // Ensure we don't round out to -1, which trips up Direct3D. dest.IntersectRect(dest, RectDouble(0, 0, rtSize.width, rtSize.height)); if (aOutLayerQuad) { - *aOutLayerQuad = Rect(dest.x, dest.y, dest.width, dest.height); + *aOutLayerQuad = Rect(dest.x, dest.y, dest.Width(), dest.Height()); } // Round out to integer. @@ -50,7 +50,7 @@ ComputeBackdropCopyRect(const gfx::Rect& aRect, Matrix4x4 transform; transform.PostScale(rtSize.width, rtSize.height, 1.0); transform.PostTranslate(-result.x, -result.y, 0.0); - transform.PostScale(1 / float(result.width), 1 / float(result.height), 1.0); + transform.PostScale(1 / float(result.Width()), 1 / float(result.Height()), 1.0); *aOutTransform = transform; return result; } diff --git a/gfx/layers/LayersLogging.cpp b/gfx/layers/LayersLogging.cpp index fc44cc51e5e9..22069ed61c06 100644 --- a/gfx/layers/LayersLogging.cpp +++ b/gfx/layers/LayersLogging.cpp @@ -65,7 +65,7 @@ AppendToString(std::stringstream& aStream, const nsRect& r, 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; } diff --git a/gfx/layers/RotatedBuffer.cpp b/gfx/layers/RotatedBuffer.cpp index ef726ce0393d..0b69b6ec5c4d 100644 --- a/gfx/layers/RotatedBuffer.cpp +++ b/gfx/layers/RotatedBuffer.cpp @@ -41,8 +41,8 @@ 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 IntPoint quadrantTranslation = -mBufferRotation; - quadrantTranslation.x += aXSide == LEFT ? mBufferRect.width : 0; - quadrantTranslation.y += aYSide == TOP ? mBufferRect.height : 0; + quadrantTranslation.x += aXSide == LEFT ? mBufferRect.Width() : 0; + quadrantTranslation.y += aYSide == TOP ? mBufferRect.Height() : 0; return mBufferRect + quadrantTranslation; } @@ -52,17 +52,17 @@ RotatedBuffer::GetSourceRectangle(XSide aXSide, YSide aYSide) const Rect result; if (aXSide == LEFT) { result.x = 0; - result.width = mBufferRotation.x; + result.SetWidth(mBufferRotation.x); } else { result.x = mBufferRotation.x; - result.width = mBufferRect.width - mBufferRotation.x; + result.SetWidth(mBufferRect.Width() - mBufferRotation.x); } if (aYSide == TOP) { result.y = 0; - result.height = mBufferRotation.y; + result.SetHeight(mBufferRotation.y); } else { result.y = mBufferRotation.y; - result.height = mBufferRect.height - mBufferRotation.y; + result.SetHeight(mBufferRect.Height() - mBufferRotation.y); } return result; } @@ -415,7 +415,7 @@ ComputeBufferRect(const IntRect& aRequestedRect) // dimensions). 64 used to be the magic number needed to work around // a rendering glitch on b2g (see bug 788411). Now that we don't support // this device anymore we should be fine with 8 pixels as the minimum. - rect.width = std::max(aRequestedRect.width, 8); + rect.SetWidth(std::max(aRequestedRect.Width(), 8)); return rect; } @@ -587,8 +587,8 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer, // changes to destBufferRect. IntPoint newRotation = mBufferRotation + (destBufferRect.TopLeft() - mBufferRect.TopLeft()); - WrapRotationAxis(&newRotation.x, mBufferRect.width); - WrapRotationAxis(&newRotation.y, mBufferRect.height); + WrapRotationAxis(&newRotation.x, mBufferRect.Width()); + WrapRotationAxis(&newRotation.y, mBufferRect.Height()); NS_ASSERTION(gfx::IntRect(gfx::IntPoint(0,0), mBufferRect.Size()).Contains(newRotation), "newRotation out of bounds"); int32_t xBoundary = destBufferRect.XMost() - newRotation.x; @@ -662,8 +662,8 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer, &destDTBuffer, &destDTBufferOnWhite); if (!destDTBuffer || (!destDTBufferOnWhite && (bufferFlags & BUFFER_COMPONENT_ALPHA))) { - if (Factory::ReasonableSurfaceSize(IntSize(destBufferRect.width, destBufferRect.height))) { - gfxCriticalNote << "Failed 1 buffer db=" << hexa(destDTBuffer.get()) << " dw=" << hexa(destDTBufferOnWhite.get()) << " for " << destBufferRect.x << ", " << destBufferRect.y << ", " << destBufferRect.width << ", " << destBufferRect.height; + if (Factory::ReasonableSurfaceSize(IntSize(destBufferRect.Width(), destBufferRect.Height()))) { + gfxCriticalNote << "Failed 1 buffer db=" << hexa(destDTBuffer.get()) << " dw=" << hexa(destDTBufferOnWhite.get()) << " for " << destBufferRect.x << ", " << destBufferRect.y << ", " << destBufferRect.Width() << ", " << destBufferRect.Height(); } return result; } @@ -686,8 +686,8 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer, &destDTBuffer, &destDTBufferOnWhite); if (!destDTBuffer || (!destDTBufferOnWhite && (bufferFlags & BUFFER_COMPONENT_ALPHA))) { - if (Factory::ReasonableSurfaceSize(IntSize(destBufferRect.width, destBufferRect.height))) { - gfxCriticalNote << "Failed 2 buffer db=" << hexa(destDTBuffer.get()) << " dw=" << hexa(destDTBufferOnWhite.get()) << " for " << destBufferRect.x << ", " << destBufferRect.y << ", " << destBufferRect.width << ", " << destBufferRect.height; + if (Factory::ReasonableSurfaceSize(IntSize(destBufferRect.Width(), destBufferRect.Height()))) { + gfxCriticalNote << "Failed 2 buffer db=" << hexa(destDTBuffer.get()) << " dw=" << hexa(destDTBufferOnWhite.get()) << " for " << destBufferRect.x << ", " << destBufferRect.y << ", " << destBufferRect.Width() << ", " << destBufferRect.Height(); } return result; } @@ -788,9 +788,9 @@ RotatedContentBuffer::PrepareDrawTargetForPainting(CapturedPaintState* aState) } for (auto iter = aState->mRegionToDraw.RectIter(); !iter.Done(); iter.Next()) { const IntRect& rect = iter.Get(); - target->FillRect(Rect(rect.x, rect.y, rect.width, rect.height), + target->FillRect(Rect(rect.x, rect.y, rect.Width(), rect.Height()), ColorPattern(Color(0.0, 0.0, 0.0, 1.0))); - whiteTarget->FillRect(Rect(rect.x, rect.y, rect.width, rect.height), + whiteTarget->FillRect(Rect(rect.x, rect.y, rect.Width(), rect.Height()), ColorPattern(Color(1.0, 1.0, 1.0, 1.0))); } } else if (aState->mContentType == gfxContentType::COLOR_ALPHA && @@ -798,7 +798,7 @@ RotatedContentBuffer::PrepareDrawTargetForPainting(CapturedPaintState* aState) // HaveBuffer() => we have an existing buffer that we must clear for (auto iter = aState->mRegionToDraw.RectIter(); !iter.Done(); iter.Next()) { const IntRect& rect = iter.Get(); - target->ClearRect(Rect(rect.x, rect.y, rect.width, rect.height)); + target->ClearRect(Rect(rect.x, rect.y, rect.Width(), rect.Height())); } } diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 85116841ffaf..0851bfcf22ca 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -1403,9 +1403,9 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) { CSSToParentLayerScale realMinZoom = mZoomConstraints.mMinZoom; CSSToParentLayerScale realMaxZoom = mZoomConstraints.mMaxZoom; realMinZoom.scale = std::max(realMinZoom.scale, - mFrameMetrics.GetCompositionBounds().width / mFrameMetrics.GetScrollableRect().width); + mFrameMetrics.GetCompositionBounds().Width() / mFrameMetrics.GetScrollableRect().Width()); realMinZoom.scale = std::max(realMinZoom.scale, - mFrameMetrics.GetCompositionBounds().height / mFrameMetrics.GetScrollableRect().height); + mFrameMetrics.GetCompositionBounds().Height() / mFrameMetrics.GetScrollableRect().Height()); if (realMaxZoom < realMinZoom) { realMaxZoom = realMinZoom; } @@ -3064,12 +3064,12 @@ RedistributeDisplayPortExcess(CSSSize& aDisplayPortSize, { // As aDisplayPortSize.height * aDisplayPortSize.width does not change, // we are just scaling by the ratio and its inverse. - if (aDisplayPortSize.height > aScrollableRect.height) { - aDisplayPortSize.width *= (aDisplayPortSize.height / aScrollableRect.height); - aDisplayPortSize.height = aScrollableRect.height; - } else if (aDisplayPortSize.width > aScrollableRect.width) { - aDisplayPortSize.height *= (aDisplayPortSize.width / aScrollableRect.width); - aDisplayPortSize.width = aScrollableRect.width; + if (aDisplayPortSize.height > aScrollableRect.Height()) { + aDisplayPortSize.width *= (aDisplayPortSize.height / aScrollableRect.Height()); + aDisplayPortSize.height = aScrollableRect.Height(); + } else if (aDisplayPortSize.width > aScrollableRect.Width()) { + aDisplayPortSize.height *= (aDisplayPortSize.width / aScrollableRect.Width()); + aDisplayPortSize.width = aScrollableRect.Width(); } } @@ -3119,14 +3119,14 @@ const ScreenMargin AsyncPanZoomController::CalculatePendingDisplayPort( APZC_LOG_FM(aFrameMetrics, "Calculated displayport as (%f %f %f %f) from velocity %s paint time %f metrics", - displayPort.x, displayPort.y, displayPort.width, displayPort.height, + displayPort.x, displayPort.y, displayPort.Width(), displayPort.Height(), ToString(aVelocity).c_str(), paintFactor); CSSMargin cssMargins; cssMargins.left = -displayPort.x; cssMargins.top = -displayPort.y; - cssMargins.right = displayPort.width - compositionSize.width - cssMargins.left; - cssMargins.bottom = displayPort.height - compositionSize.height - cssMargins.top; + cssMargins.right = displayPort.Width() - compositionSize.width - cssMargins.left; + cssMargins.bottom = displayPort.Height() - compositionSize.height - cssMargins.top; return cssMargins * aFrameMetrics.DisplayportPixelsPerCSSPixel(); } @@ -3266,10 +3266,10 @@ AsyncPanZoomController::RequestContentRepaint(const FrameMetrics& aFrameMetrics, aFrameMetrics.GetScrollOffset().y) < EPSILON && aFrameMetrics.GetPresShellResolution() == mLastPaintRequestMetrics.GetPresShellResolution() && aFrameMetrics.GetZoom() == mLastPaintRequestMetrics.GetZoom() && - fabsf(aFrameMetrics.GetViewport().width - - mLastPaintRequestMetrics.GetViewport().width) < EPSILON && - fabsf(aFrameMetrics.GetViewport().height - - mLastPaintRequestMetrics.GetViewport().height) < EPSILON && + fabsf(aFrameMetrics.GetViewport().Width() - + mLastPaintRequestMetrics.GetViewport().Width()) < EPSILON && + fabsf(aFrameMetrics.GetViewport().Height() - + mLastPaintRequestMetrics.GetViewport().Height()) < EPSILON && aFrameMetrics.GetScrollGeneration() == mLastPaintRequestMetrics.GetScrollGeneration() && aFrameMetrics.GetScrollUpdateType() == @@ -3710,12 +3710,12 @@ void AsyncPanZoomController::NotifyLayersUpdated(const ScrollMetadata& aScrollMe bool needContentRepaint = false; bool viewportUpdated = false; - if (FuzzyEqualsAdditive(aLayerMetrics.GetCompositionBounds().width, mFrameMetrics.GetCompositionBounds().width) && - FuzzyEqualsAdditive(aLayerMetrics.GetCompositionBounds().height, mFrameMetrics.GetCompositionBounds().height)) { + if (FuzzyEqualsAdditive(aLayerMetrics.GetCompositionBounds().Width(), mFrameMetrics.GetCompositionBounds().Width()) && + FuzzyEqualsAdditive(aLayerMetrics.GetCompositionBounds().Height(), mFrameMetrics.GetCompositionBounds().Height())) { // Remote content has sync'd up to the composition geometry // change, so we can accept the viewport it's calculated. - if (mFrameMetrics.GetViewport().width != aLayerMetrics.GetViewport().width || - mFrameMetrics.GetViewport().height != aLayerMetrics.GetViewport().height) { + if (mFrameMetrics.GetViewport().Width() != aLayerMetrics.GetViewport().Width() || + mFrameMetrics.GetViewport().Height() != aLayerMetrics.GetViewport().Height()) { needContentRepaint = true; viewportUpdated = true; } @@ -3776,7 +3776,7 @@ void AsyncPanZoomController::NotifyLayersUpdated(const ScrollMetadata& aScrollMe // in some things into our local mFrameMetrics because these things are // determined by Gecko and our copy in mFrameMetrics may be stale. - if (FuzzyEqualsAdditive(mFrameMetrics.GetCompositionBounds().width, aLayerMetrics.GetCompositionBounds().width) && + if (FuzzyEqualsAdditive(mFrameMetrics.GetCompositionBounds().Width(), aLayerMetrics.GetCompositionBounds().Width()) && mFrameMetrics.GetDevPixelsPerCSSPixel() == aLayerMetrics.GetDevPixelsPerCSSPixel() && !viewportUpdated) { // Any change to the pres shell resolution was requested by APZ and is @@ -3937,15 +3937,15 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect, const uint32_t aFlags) { // composition bounds. If this happens, we can't fill the target composited // area with this frame. CSSToParentLayerScale localMinZoom(std::max(mZoomConstraints.mMinZoom.scale, - std::max(compositionBounds.width / cssPageRect.width, - compositionBounds.height / cssPageRect.height))); + std::max(compositionBounds.Width() / cssPageRect.Width(), + compositionBounds.Height() / cssPageRect.Height()))); CSSToParentLayerScale localMaxZoom = mZoomConstraints.mMaxZoom; if (!aRect.IsEmpty()) { // Intersect the zoom-to-rect to the CSS rect to make sure it fits. aRect = aRect.Intersect(cssPageRect); - targetZoom = CSSToParentLayerScale(std::min(compositionBounds.width / aRect.width, - compositionBounds.height / aRect.height)); + targetZoom = CSSToParentLayerScale(std::min(compositionBounds.Width() / aRect.Width(), + compositionBounds.Height() / aRect.Height())); } // 1. If the rect is empty, the content-side logic for handling a double-tap @@ -3966,16 +3966,16 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect, const uint32_t aFlags) { CSSSize compositedSize = mFrameMetrics.CalculateCompositedSizeInCssPixels(); float y = scrollOffset.y; float newHeight = - cssPageRect.width * (compositedSize.height / compositedSize.width); + cssPageRect.Width() * (compositedSize.height / compositedSize.width); float dh = compositedSize.height - newHeight; aRect = CSSRect(0.0f, y + dh/2, - cssPageRect.width, + cssPageRect.Width(), newHeight); aRect = aRect.Intersect(cssPageRect); - targetZoom = CSSToParentLayerScale(std::min(compositionBounds.width / aRect.width, - compositionBounds.height / aRect.height)); + targetZoom = CSSToParentLayerScale(std::min(compositionBounds.Width() / aRect.Width(), + compositionBounds.Height() / aRect.Height())); } targetZoom.scale = clamped(targetZoom.scale, localMinZoom.scale, localMaxZoom.scale); @@ -4000,8 +4000,8 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect, const uint32_t aFlags) { CSSSize sizeAfterZoom = endZoomToMetrics.CalculateCompositedSizeInCssPixels(); // Vertically center the zoomed element in the screen. - if (!zoomOut && (sizeAfterZoom.height > aRect.height)) { - aRect.y -= (sizeAfterZoom.height - aRect.height) * 0.5f; + if (!zoomOut && (sizeAfterZoom.height > aRect.Height())) { + aRect.y -= (sizeAfterZoom.height - aRect.Height()) * 0.5f; if (aRect.y < 0.0f) { aRect.y = 0.0f; } @@ -4009,12 +4009,12 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect, const uint32_t aFlags) { // If either of these conditions are met, the page will be // overscrolled after zoomed - if (aRect.y + sizeAfterZoom.height > cssPageRect.height) { - aRect.y = cssPageRect.height - sizeAfterZoom.height; + if (aRect.y + sizeAfterZoom.height > cssPageRect.Height()) { + aRect.y = cssPageRect.Height() - sizeAfterZoom.height; aRect.y = aRect.y > 0 ? aRect.y : 0; } - if (aRect.x + sizeAfterZoom.width > cssPageRect.width) { - aRect.x = cssPageRect.width - sizeAfterZoom.width; + if (aRect.x + sizeAfterZoom.width > cssPageRect.Width()) { + aRect.x = cssPageRect.Width() - sizeAfterZoom.width; aRect.x = aRect.x > 0 ? aRect.x : 0; } diff --git a/gfx/layers/apz/src/Axis.cpp b/gfx/layers/apz/src/Axis.cpp index a371f1b3ace7..36a6596cfb95 100644 --- a/gfx/layers/apz/src/Axis.cpp +++ b/gfx/layers/apz/src/Axis.cpp @@ -505,7 +505,7 @@ ParentLayerCoord AxisX::GetPointOffset(const ParentLayerPoint& aPoint) const ParentLayerCoord AxisX::GetRectLength(const ParentLayerRect& aRect) const { - return aRect.width; + return aRect.Width(); } ParentLayerCoord AxisX::GetRectOffset(const ParentLayerRect& aRect) const @@ -541,7 +541,7 @@ ParentLayerCoord AxisY::GetPointOffset(const ParentLayerPoint& aPoint) const ParentLayerCoord AxisY::GetRectLength(const ParentLayerRect& aRect) const { - return aRect.height; + return aRect.Height(); } ParentLayerCoord AxisY::GetRectOffset(const ParentLayerRect& aRect) const diff --git a/gfx/layers/apz/src/CheckerboardEvent.cpp b/gfx/layers/apz/src/CheckerboardEvent.cpp index 526595ba9230..70e7b93898de 100644 --- a/gfx/layers/apz/src/CheckerboardEvent.cpp +++ b/gfx/layers/apz/src/CheckerboardEvent.cpp @@ -114,8 +114,8 @@ CheckerboardEvent::LogInfo(RendertraceProperty aProperty, << sColors[aProperty] << " " << aRect.x << " " << aRect.y << " " - << aRect.width << " " - << aRect.height << " " + << aRect.Width() << " " + << aRect.Height() << " " << "// " << sDescriptions[aProperty] << aExtraInfo << std::endl; } diff --git a/gfx/layers/apz/util/APZCCallbackHelper.cpp b/gfx/layers/apz/util/APZCCallbackHelper.cpp index b76bbed925d0..e359b7e9bb1e 100644 --- a/gfx/layers/apz/util/APZCCallbackHelper.cpp +++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp @@ -210,8 +210,8 @@ SetDisplayPortMargins(nsIPresShell* aPresShell, CSSRect baseCSS = aMetrics.CalculateCompositedRectInCssPixels(); nsRect base(0, 0, - baseCSS.width * nsPresContext::AppUnitsPerCSSPixel(), - baseCSS.height * nsPresContext::AppUnitsPerCSSPixel()); + baseCSS.Width() * nsPresContext::AppUnitsPerCSSPixel(), + baseCSS.Height() * nsPresContext::AppUnitsPerCSSPixel()); nsLayoutUtils::SetDisplayPortBaseIfNotSet(aContent, base); } diff --git a/gfx/layers/apz/util/DoubleTapToZoom.cpp b/gfx/layers/apz/util/DoubleTapToZoom.cpp index cb181844be60..f475340a7593 100644 --- a/gfx/layers/apz/util/DoubleTapToZoom.cpp +++ b/gfx/layers/apz/util/DoubleTapToZoom.cpp @@ -77,12 +77,12 @@ IsRectZoomedIn(const CSSRect& aRect, const CSSRect& aCompositedArea) // composition bounds (i.e. the overlapArea variable below) is approximately // the max area of the rect we can show. CSSRect overlap = aCompositedArea.Intersect(aRect); - float overlapArea = overlap.width * overlap.height; - float availHeight = std::min(aRect.width * aCompositedArea.height / aCompositedArea.width, - aRect.height); - float showing = overlapArea / (aRect.width * availHeight); - float ratioW = aRect.width / aCompositedArea.width; - float ratioH = aRect.height / aCompositedArea.height; + float overlapArea = overlap.Width() * overlap.Height(); + float availHeight = std::min(aRect.Width() * aCompositedArea.Height() / aCompositedArea.Width(), + aRect.Height()); + float showing = overlapArea / (aRect.Width() * availHeight); + float ratioW = aRect.Width() / aCompositedArea.Width(); + float ratioH = aRect.Height() / aCompositedArea.Height(); return showing > 0.9 && (ratioW > 0.9 || ratioH > 0.9); } @@ -129,27 +129,27 @@ CalculateRectToZoomTo(const nsCOMPtr& aRootContentDocument, // the height of the |rect| so that it has the same aspect ratio as // the root frame. The clipped |rect| is centered on the y value of // the touch point. This allows tall narrow elements to be zoomed. - if (!rect.IsEmpty() && compositedArea.width > 0.0f) { - const float widthRatio = rect.width / compositedArea.width; - float targetHeight = compositedArea.height * widthRatio; - if (widthRatio < 0.9 && targetHeight < rect.height) { + if (!rect.IsEmpty() && compositedArea.Width() > 0.0f) { + const float widthRatio = rect.Width() / compositedArea.Width(); + float targetHeight = compositedArea.Height() * widthRatio; + if (widthRatio < 0.9 && targetHeight < rect.Height()) { const CSSPoint scrollPoint = CSSPoint::FromAppUnits(rootScrollFrame->GetScrollPosition()); float newY = aPoint.y + scrollPoint.y - (targetHeight * 0.5f); - if ((newY + targetHeight) > (rect.y + rect.height)) { - rect.y += rect.height - targetHeight; + if ((newY + targetHeight) > (rect.y + rect.Height())) { + rect.y += rect.Height() - targetHeight; } else if (newY > rect.y) { rect.y = newY; } - rect.height = targetHeight; + rect.SetHeight(targetHeight); } } rect = CSSRect(std::max(metrics.GetScrollableRect().x, rect.x - margin), rect.y, - rect.width + 2 * margin, - rect.height); + rect.Width() + 2 * margin, + rect.Height()); // Constrict the rect to the screen's right edge - rect.width = std::min(rect.width, metrics.GetScrollableRect().XMost() - rect.x); + rect.SetWidth(std::min(rect.Width(), metrics.GetScrollableRect().XMost() - rect.x)); // If the rect is already taking up most of the visible area and is // stretching the width of the page, then we want to zoom out instead. @@ -167,8 +167,8 @@ CalculateRectToZoomTo(const nsCOMPtr& aRootContentDocument, // to zoom in (bug 761721). The 1.2 multiplier is just a little fuzz to // compensate for 'rect' including horizontal margins but not vertical ones. CSSCoord cssTapY = metrics.GetScrollOffset().y + aPoint.y; - if ((rect.height > rounded.height) && (cssTapY > rounded.y + (rounded.height * 1.2))) { - rounded.y = cssTapY - (rounded.height / 2); + if ((rect.Height() > rounded.Height()) && (cssTapY > rounded.y + (rounded.Height() * 1.2))) { + rounded.y = cssTapY - (rounded.Height() / 2); } return rounded; diff --git a/gfx/layers/basic/BasicCanvasLayer.cpp b/gfx/layers/basic/BasicCanvasLayer.cpp index 6140af8bf529..d21298f7f0e4 100644 --- a/gfx/layers/basic/BasicCanvasLayer.cpp +++ b/gfx/layers/basic/BasicCanvasLayer.cpp @@ -58,12 +58,12 @@ BasicCanvasLayer::Paint(DrawTarget* aDT, if (canvasRenderer->NeedsYFlip()) { oldTM = aDT->GetTransform(); aDT->SetTransform(Matrix(oldTM). - PreTranslate(0.0f, mBounds.height). + PreTranslate(0.0f, mBounds.Height()). PreScale(1.0f, -1.0f)); } FillRectWithMask(aDT, aDeviceOffset, - Rect(0, 0, mBounds.width, mBounds.height), + Rect(0, 0, mBounds.Width(), mBounds.Height()), surface, mSamplingFilter, DrawOptions(GetEffectiveOpacity(), GetEffectiveOperator(this)), aMaskLayer); diff --git a/gfx/layers/basic/BasicColorLayer.cpp b/gfx/layers/basic/BasicColorLayer.cpp index 182bc785b2c5..6032a6aa451f 100644 --- a/gfx/layers/basic/BasicColorLayer.cpp +++ b/gfx/layers/basic/BasicColorLayer.cpp @@ -53,7 +53,7 @@ public: return; } - Rect snapped(mBounds.x, mBounds.y, mBounds.width, mBounds.height); + Rect snapped(mBounds.x, mBounds.y, mBounds.Width(), mBounds.Height()); MaybeSnapToDevicePixels(snapped, *aDT, true); // Clip drawing in case we're using (unbounded) operator source. diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp index 68003d99aa4a..fad5929758bc 100644 --- a/gfx/layers/basic/BasicCompositor.cpp +++ b/gfx/layers/basic/BasicCompositor.cpp @@ -258,9 +258,9 @@ BasicCompositor::GetTextureFactoryIdentifier() already_AddRefed BasicCompositor::CreateRenderTarget(const IntRect& aRect, SurfaceInitMode aInit) { - MOZ_ASSERT(aRect.width != 0 && aRect.height != 0, "Trying to create a render target of invalid size"); + MOZ_ASSERT(aRect.Width() != 0 && aRect.Height() != 0, "Trying to create a render target of invalid size"); - if (aRect.width * aRect.height == 0) { + if (aRect.Width() * aRect.Height() == 0) { return nullptr; } @@ -288,9 +288,9 @@ already_AddRefed BasicCompositor::CreateRenderTargetForWindow(const LayoutDeviceIntRect& aRect, const LayoutDeviceIntRect& aClearRect, BufferMode aBufferMode) { MOZ_ASSERT(mDrawTarget); - MOZ_ASSERT(aRect.width != 0 && aRect.height != 0, "Trying to create a render target of invalid size"); + MOZ_ASSERT(aRect.Width() != 0 && aRect.Height() != 0, "Trying to create a render target of invalid size"); - if (aRect.width * aRect.height == 0) { + if (aRect.Width() * aRect.Height() == 0) { return nullptr; } @@ -461,8 +461,8 @@ DrawSurfaceWithTextureCoords(gfx::DrawTarget* aDest, // Convert aTextureCoords into aSource's coordinate space gfxRect sourceRect(aTextureCoords.x * aSource->GetSize().width, aTextureCoords.y * aSource->GetSize().height, - aTextureCoords.width * aSource->GetSize().width, - aTextureCoords.height * aSource->GetSize().height); + aTextureCoords.Width() * aSource->GetSize().width, + aTextureCoords.Height() * aSource->GetSize().height); // Floating point error can accumulate above and we know our visible region // is integer-aligned, so round it out. @@ -558,10 +558,10 @@ AttemptVideoScale(TextureSourceBasic* aSource, const SourceSurface* aSourceMask, ssse3_scale_data((uint32_t*)mapSrc.GetData(), srcSource->GetSize().width, srcSource->GetSize().height, mapSrc.GetStride()/4, - ((uint32_t*)dstData) + fillRect.x + (dstStride / 4) * fillRect.y, dstRect.width, dstRect.height, + ((uint32_t*)dstData) + fillRect.x + (dstStride / 4) * fillRect.y, dstRect.Width(), dstRect.Height(), dstStride / 4, offset.x, offset.y, - fillRect.width, fillRect.height); + fillRect.Width(), fillRect.Height()); aDest->ReleaseBits(dstData); return true; @@ -842,7 +842,7 @@ BasicCompositor::DrawGeometry(const Geometry& aGeometry, if (sourceMask) { RefPtr transformDT = - dest->CreateSimilarDrawTarget(IntSize::Truncate(transformBounds.width, transformBounds.height), + dest->CreateSimilarDrawTarget(IntSize::Truncate(transformBounds.Width(), transformBounds.Height()), SurfaceFormat::B8G8R8A8); new3DTransform.PostTranslate(-transformBounds.x, -transformBounds.y, 0); if (transformDT && @@ -901,7 +901,7 @@ BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion, } LayoutDeviceIntRect intRect(LayoutDeviceIntPoint(), mWidget->GetClientSize()); - IntRect rect = IntRect(0, 0, intRect.width, intRect.height); + IntRect rect = IntRect(0, 0, intRect.Width(), intRect.Height()); LayoutDeviceIntRegion invalidRegionSafe; // Sometimes the invalid region is larger than we want to draw. @@ -1053,7 +1053,7 @@ BasicCompositor::TryToEndRemoteDrawing(bool aForceToEnd) for (auto iter = mInvalidRegion.RectIter(); !iter.Done(); iter.Next()) { const LayoutDeviceIntRect& r = iter.Get(); dest->CopySurface(source, - IntRect(r.x, r.y, r.width, r.height) - mRenderTarget->GetOrigin(), + IntRect(r.x, r.y, r.Width(), r.Height()) - mRenderTarget->GetOrigin(), IntPoint(r.x, r.y) - offset); } } diff --git a/gfx/layers/basic/BasicLayerManager.cpp b/gfx/layers/basic/BasicLayerManager.cpp index d5982d412da0..ef34d8a62d1d 100644 --- a/gfx/layers/basic/BasicLayerManager.cpp +++ b/gfx/layers/basic/BasicLayerManager.cpp @@ -62,7 +62,7 @@ using namespace mozilla::gfx; static bool ClipToContain(gfxContext* aContext, const IntRect& aRect) { - gfxRect userRect(aRect.x, aRect.y, aRect.width, aRect.height); + gfxRect userRect(aRect.x, aRect.y, aRect.Width(), aRect.Height()); gfxRect deviceRect = aContext->UserToDevice(userRect); deviceRect.RoundOut(); @@ -270,7 +270,7 @@ public: !mTransform.HasNonAxisAlignedTransform()) { gfx::Rect opaqueRect = dt->GetTransform().TransformBounds( - gfx::Rect(bounds.x, bounds.y, bounds.width, bounds.height)); + gfx::Rect(bounds.x, bounds.y, bounds.Width(), bounds.Height())); opaqueRect.RoundIn(); IntRect intOpaqueRect; if (opaqueRect.ToIntRect(&intOpaqueRect)) { @@ -374,7 +374,7 @@ static void TransformIntRect(IntRect& aRect, const Matrix& aMatrix, IntRect (*aRoundMethod)(const gfxRect&)) { - Rect gr = Rect(aRect.x, aRect.y, aRect.width, aRect.height); + Rect gr = Rect(aRect.x, aRect.y, aRect.Width(), aRect.Height()); gr = aMatrix.TransformBounds(gr); aRect = (*aRoundMethod)(ThebesRect(gr)); } @@ -624,7 +624,7 @@ BasicLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback, if (!mRegionToClear.IsEmpty()) { for (auto iter = mRegionToClear.RectIter(); !iter.Done(); iter.Next()) { const IntRect& r = iter.Get(); - mTarget->GetDrawTarget()->ClearRect(Rect(r.x, r.y, r.width, r.height)); + mTarget->GetDrawTarget()->ClearRect(Rect(r.x, r.y, r.Width(), r.Height())); } } if (mWidget) { @@ -801,7 +801,7 @@ InstallLayerClipPreserves3D(gfxContext* aTarget, Layer* aLayer) aTarget->NewPath(); aTarget->SnappedRectangle(gfxRect(clipRect->x, clipRect->y, - clipRect->width, clipRect->height)); + clipRect->Width(), clipRect->Height())); aTarget->Clip(); aTarget->SetMatrix(oldTransform); @@ -906,7 +906,7 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget, IntRect bounds = visibleRegion.GetBounds(); // DrawTarget without the 3D transform applied: RefPtr untransformedDT = - gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(IntSize(bounds.width, bounds.height), + gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(IntSize(bounds.Width(), bounds.Height()), SurfaceFormat::B8G8R8A8); if (!untransformedDT || !untransformedDT->IsValid()) { return; @@ -939,7 +939,7 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget, RefPtr untransformedSurf = untransformedDT->Snapshot(); RefPtr xformDT = - untransformedDT->CreateSimilarDrawTarget(IntSize::Truncate(xformBounds.width, xformBounds.height), + untransformedDT->CreateSimilarDrawTarget(IntSize::Truncate(xformBounds.Width(), xformBounds.Height()), SurfaceFormat::B8G8R8A8); RefPtr xformSurf; if(xformDT && untransformedSurf && diff --git a/gfx/layers/basic/BasicTextLayer.cpp b/gfx/layers/basic/BasicTextLayer.cpp index d502ffe01177..45baeeda9bbe 100644 --- a/gfx/layers/basic/BasicTextLayer.cpp +++ b/gfx/layers/basic/BasicTextLayer.cpp @@ -54,7 +54,7 @@ public: return; } - Rect snapped(mBounds.x, mBounds.y, mBounds.width, mBounds.height); + Rect snapped(mBounds.x, mBounds.y, mBounds.Width(), mBounds.Height()); MaybeSnapToDevicePixels(snapped, *aDT, true); // We don't currently support subpixel-AA in TextLayers since we diff --git a/gfx/layers/client/ClientLayerManager.cpp b/gfx/layers/client/ClientLayerManager.cpp index 5f940fd92e0d..9d84d893e4de 100644 --- a/gfx/layers/client/ClientLayerManager.cpp +++ b/gfx/layers/client/ClientLayerManager.cpp @@ -632,8 +632,8 @@ ClientLayerManager::MakeSnapshotIfRequired() RefPtr surf = GetSurfaceForDescriptor(outSnapshot); DrawTarget* dt = mShadowTarget->GetDrawTarget(); - Rect dstRect(bounds.x, bounds.y, bounds.width, bounds.height); - Rect srcRect(0, 0, bounds.width, bounds.height); + Rect dstRect(bounds.x, bounds.y, bounds.Width(), bounds.Height()); + Rect srcRect(0, 0, bounds.Width(), bounds.Height()); gfx::Matrix rotate = ComputeTransformForUnRotation(outerBounds.ToUnknownRect(), diff --git a/gfx/layers/client/ContentClient.cpp b/gfx/layers/client/ContentClient.cpp index 59190cc5f0e9..895e696ffbff 100644 --- a/gfx/layers/client/ContentClient.cpp +++ b/gfx/layers/client/ContentClient.cpp @@ -137,7 +137,7 @@ ContentClientBasic::CreateBuffer(ContentType aType, gfxDevCrash(LogReason::AlphaWithBasicClient) << "Asking basic content client for component alpha"; } - IntSize size(aRect.width, aRect.height); + IntSize size(aRect.Width(), aRect.Height()); #ifdef XP_WIN if (mBackend == BackendType::CAIRO && (aType == gfxContentType::COLOR || aType == gfxContentType::COLOR_ALPHA)) { @@ -327,7 +327,7 @@ ContentClientRemoteBuffer::BuildTextureClients(SurfaceFormat aFormat, DestroyBuffers(); mSurfaceFormat = aFormat; - mSize = IntSize(aRect.width, aRect.height); + mSize = IntSize(aRect.Width(), aRect.Height()); mTextureFlags = TextureFlagsForRotatedContentBufferFlags(aFlags); if (aFlags & BUFFER_COMPONENT_ALPHA) { @@ -625,8 +625,8 @@ ContentClientDoubleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw) this, mFrontUpdatedRegion.GetBounds().x, mFrontUpdatedRegion.GetBounds().y, - mFrontUpdatedRegion.GetBounds().width, - mFrontUpdatedRegion.GetBounds().height)); + mFrontUpdatedRegion.GetBounds().Width(), + mFrontUpdatedRegion.GetBounds().Height())); mFrontAndBackBufferDiffer = false; diff --git a/gfx/layers/client/TiledContentClient.cpp b/gfx/layers/client/TiledContentClient.cpp index dc00b89b71dc..cbc465197266 100644 --- a/gfx/layers/client/TiledContentClient.cpp +++ b/gfx/layers/client/TiledContentClient.cpp @@ -206,8 +206,8 @@ SharedFrameMetricsHelper::UpdateFromCompositorFrameMetrics( fabsf(contentMetrics.GetScrollOffset().y - compositorMetrics.GetScrollOffset().y) <= 2 && fabsf(contentMetrics.GetDisplayPort().x - compositorMetrics.GetDisplayPort().x) <= 2 && fabsf(contentMetrics.GetDisplayPort().y - compositorMetrics.GetDisplayPort().y) <= 2 && - fabsf(contentMetrics.GetDisplayPort().width - compositorMetrics.GetDisplayPort().width) <= 2 && - fabsf(contentMetrics.GetDisplayPort().height - compositorMetrics.GetDisplayPort().height) <= 2) { + fabsf(contentMetrics.GetDisplayPort().Width() - compositorMetrics.GetDisplayPort().Width()) <= 2 && + fabsf(contentMetrics.GetDisplayPort().Height() - compositorMetrics.GetDisplayPort().Height()) <= 2) { return false; } @@ -522,7 +522,7 @@ TileClient::ValidateBackBufferFromFront(const nsIntRegion& aDirtyRegion, // is unlikely that we'd save much by copying each individual rect of the // region, but we can reevaluate this if it becomes an issue. const IntRect rectToCopy = regionToCopy.GetBounds(); - gfx::IntRect gfxRectToCopy(rectToCopy.x, rectToCopy.y, rectToCopy.width, rectToCopy.height); + gfx::IntRect gfxRectToCopy(rectToCopy.x, rectToCopy.y, rectToCopy.Width(), rectToCopy.Height()); CopyFrontToBack(mFrontBuffer, mBackBuffer, gfxRectToCopy); if (mBackBufferOnWhite) { @@ -923,9 +923,9 @@ void ClientMultiTiledLayerBuffer::Update(const nsIntRegion& newValidRegion, const TilesPlacement newTiles(floor_div(newBounds.x, scaledTileSize.width), floor_div(newBounds.y, scaledTileSize.height), floor_div(GetTileStart(newBounds.x, scaledTileSize.width) - + newBounds.width, scaledTileSize.width) + 1, + + newBounds.Width(), scaledTileSize.width) + 1, floor_div(GetTileStart(newBounds.y, scaledTileSize.height) - + newBounds.height, scaledTileSize.height) + 1); + + newBounds.Height(), scaledTileSize.height) + 1); const size_t oldTileCount = mRetainedTiles.Length(); const size_t newTileCount = newTiles.mSize.width * newTiles.mSize.height; @@ -1106,8 +1106,8 @@ ClientMultiTiledLayerBuffer::ValidateTile(TileClient& aTile, const IntRect& dirtyRect = iter.Get(); gfx::Rect drawRect(dirtyRect.x - aTileOrigin.x, dirtyRect.y - aTileOrigin.y, - dirtyRect.width, - dirtyRect.height); + dirtyRect.Width(), + dirtyRect.Height()); drawRect.Scale(mResolution); // Mark the newly updated area as invalid in the front buffer diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index 1668b73ebb07..151a596e1c1d 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -65,7 +65,7 @@ IsSameDimension(dom::ScreenOrientationInternal o1, dom::ScreenOrientationInterna static bool ContentMightReflowOnOrientationChange(const IntRect& rect) { - return rect.width != rect.height; + return rect.Width() != rect.Height(); } AsyncCompositionManager::AsyncCompositionManager(CompositorBridgeParent* aParent, diff --git a/gfx/layers/composite/ContainerLayerComposite.cpp b/gfx/layers/composite/ContainerLayerComposite.cpp index de95b6a18a4c..6bce178ab378 100755 --- a/gfx/layers/composite/ContainerLayerComposite.cpp +++ b/gfx/layers/composite/ContainerLayerComposite.cpp @@ -41,9 +41,9 @@ // #define CULLING_LOG(...) printf_stderr("CULLING: " __VA_ARGS__) #define DUMP(...) do { if (gfxEnv::DumpDebug()) { printf_stderr(__VA_ARGS__); } } while(0) -#define XYWH(k) (k).x, (k).y, (k).width, (k).height +#define XYWH(k) (k).x, (k).y, (k).Width(), (k).Height() #define XY(k) (k).x, (k).y -#define WH(k) (k).width, (k).height +#define WH(k) (k).Width(), (k).Height() namespace mozilla { namespace layers { @@ -67,7 +67,7 @@ DrawLayerInfo(const RenderTargetIntRect& aClipRect, LayerIntRegion visibleRegion = aLayer->GetVisibleRegion(); - uint32_t maxWidth = std::min(visibleRegion.GetBounds().width, 500); + uint32_t maxWidth = std::min(visibleRegion.GetBounds().Width(), 500); IntPoint topLeft = visibleRegion.ToUnknownRegion().GetBounds().TopLeft(); aManager->GetTextRenderer()->RenderText( @@ -86,8 +86,8 @@ PrintUniformityInfo(Layer* aLayer) } // Don't want to print a log for smaller layers - if (aLayer->GetLocalVisibleRegion().GetBounds().width < 300 || - aLayer->GetLocalVisibleRegion().GetBounds().height < 300) { + if (aLayer->GetLocalVisibleRegion().GetBounds().Width() < 300 || + aLayer->GetLocalVisibleRegion().GetBounds().Height() < 300) { return; } @@ -433,7 +433,7 @@ RenderLayers(ContainerT* aContainer, LayerManagerComposite* aManager, 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); + gfx::Rect fbRect(clearRect.x, clearRect.y, clearRect.Width(), clearRect.Height()); compositor->ClearRect(fbRect); layerToRender->SetClearRect(gfx::IntRect(0, 0, 0, 0)); } @@ -533,7 +533,7 @@ CreateTemporaryTargetAndCopyFromBackground(ContainerT* aContainer, gfx::IntRect visibleRect = aContainer->GetLocalVisibleRegion().ToUnknownRegion().GetBounds(); RefPtr previousTarget = compositor->GetCurrentRenderTarget(); gfx::IntRect surfaceRect = gfx::IntRect(visibleRect.x, visibleRect.y, - visibleRect.width, visibleRect.height); + visibleRect.Width(), visibleRect.Height()); gfx::IntPoint sourcePoint = gfx::IntPoint(visibleRect.x, visibleRect.y); diff --git a/gfx/layers/composite/ContentHost.cpp b/gfx/layers/composite/ContentHost.cpp index 6d885a33539d..7270f5ec956c 100644 --- a/gfx/layers/composite/ContentHost.cpp +++ b/gfx/layers/composite/ContentHost.cpp @@ -175,12 +175,12 @@ ContentHostTexture::Composite(Compositor* aCompositor, tileRegionRect.MoveBy(-currentTileRect.TopLeft()); } gfx::Rect rect(tileScreenRect.x, tileScreenRect.y, - tileScreenRect.width, tileScreenRect.height); + tileScreenRect.Width(), tileScreenRect.Height()); - effect->mTextureCoords = Rect(Float(tileRegionRect.x) / texRect.width, - Float(tileRegionRect.y) / texRect.height, - Float(tileRegionRect.width) / texRect.width, - Float(tileRegionRect.height) / texRect.height); + effect->mTextureCoords = Rect(Float(tileRegionRect.x) / texRect.Width(), + Float(tileRegionRect.y) / texRect.Height(), + Float(tileRegionRect.Width()) / texRect.Width(), + Float(tileRegionRect.Height()) / texRect.Height()); aCompositor->DrawGeometry(rect, aClipRect, aEffectChain, aOpacity, aTransform, aGeometry); @@ -359,8 +359,8 @@ ContentHostSingleBuffered::UpdateThebes(const ThebesBufferData& aData, destRegion.MoveBy(-aData.rect().TopLeft()); if (!aData.rect().Contains(aUpdated.GetBounds()) || - aData.rotation().x > aData.rect().width || - aData.rotation().y > aData.rect().height) { + aData.rotation().x > aData.rect().Width() || + aData.rotation().y > aData.rect().Height()) { NS_ERROR("Invalid update data"); return false; } @@ -381,11 +381,11 @@ ContentHostSingleBuffered::UpdateThebes(const ThebesBufferData& aData, // 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. - AddWrappedRegion(destRegion, finalRegion, bufferSize, nsIntPoint(aData.rect().width, 0)); - AddWrappedRegion(destRegion, finalRegion, bufferSize, nsIntPoint(aData.rect().width, aData.rect().height)); - AddWrappedRegion(destRegion, finalRegion, bufferSize, nsIntPoint(0, aData.rect().height)); + AddWrappedRegion(destRegion, finalRegion, bufferSize, nsIntPoint(aData.rect().Width(), 0)); + AddWrappedRegion(destRegion, finalRegion, bufferSize, nsIntPoint(aData.rect().Width(), aData.rect().Height())); + AddWrappedRegion(destRegion, finalRegion, bufferSize, nsIntPoint(0, aData.rect().Height())); - MOZ_ASSERT(IntRect(0, 0, aData.rect().width, aData.rect().height).Contains(finalRegion.GetBounds())); + MOZ_ASSERT(IntRect(0, 0, aData.rect().Width(), aData.rect().Height()).Contains(finalRegion.GetBounds())); mTextureHost->Updated(&finalRegion); if (mTextureHostOnWhite) { diff --git a/gfx/layers/composite/ImageHost.cpp b/gfx/layers/composite/ImageHost.cpp index 2f62f76a0b76..af9ae13c4cfe 100644 --- a/gfx/layers/composite/ImageHost.cpp +++ b/gfx/layers/composite/ImageHost.cpp @@ -240,7 +240,7 @@ ImageHost::Composite(Compositor* aCompositor, } aEffectChain.mPrimaryEffect = effect; - gfx::Rect pictureRect(0, 0, img->mPictureRect.width, img->mPictureRect.height); + gfx::Rect pictureRect(0, 0, img->mPictureRect.Width(), img->mPictureRect.Height()); BigImageIterator* it = mCurrentTextureSource->AsBigImageIterator(); if (it) { @@ -263,15 +263,15 @@ ImageHost::Composite(Compositor* aCompositor, it->BeginBigImageIteration(); do { IntRect tileRect = it->GetTileRect(); - gfx::Rect rect(tileRect.x, tileRect.y, tileRect.width, tileRect.height); + gfx::Rect rect(tileRect.x, tileRect.y, tileRect.Width(), tileRect.Height()); rect = rect.Intersect(pictureRect); - effect->mTextureCoords = Rect(Float(rect.x - tileRect.x) / tileRect.width, - Float(rect.y - tileRect.y) / tileRect.height, - Float(rect.width) / tileRect.width, - Float(rect.height) / tileRect.height); + effect->mTextureCoords = Rect(Float(rect.x - tileRect.x) / tileRect.Width(), + Float(rect.y - tileRect.y) / tileRect.Height(), + Float(rect.Width()) / tileRect.Width(), + Float(rect.Height()) / tileRect.Height()); if (img->mTextureHost->GetFlags() & TextureFlags::ORIGIN_BOTTOM_LEFT) { effect->mTextureCoords.y = effect->mTextureCoords.YMost(); - effect->mTextureCoords.height = -effect->mTextureCoords.height; + effect->mTextureCoords.SetHeight(-effect->mTextureCoords.Height()); } aCompositor->DrawGeometry(rect, aClipRect, aEffectChain, aOpacity, aTransform, aGeometry); @@ -286,12 +286,12 @@ ImageHost::Composite(Compositor* aCompositor, IntSize textureSize = mCurrentTextureSource->GetSize(); effect->mTextureCoords = Rect(Float(img->mPictureRect.x) / textureSize.width, Float(img->mPictureRect.y) / textureSize.height, - Float(img->mPictureRect.width) / textureSize.width, - Float(img->mPictureRect.height) / textureSize.height); + Float(img->mPictureRect.Width()) / textureSize.width, + Float(img->mPictureRect.Height()) / textureSize.height); if (img->mTextureHost->GetFlags() & TextureFlags::ORIGIN_BOTTOM_LEFT) { effect->mTextureCoords.y = effect->mTextureCoords.YMost(); - effect->mTextureCoords.height = -effect->mTextureCoords.height; + effect->mTextureCoords.SetHeight(-effect->mTextureCoords.Height()); } aCompositor->DrawGeometry(pictureRect, aClipRect, aEffectChain, @@ -459,7 +459,7 @@ ImageHost::GetImageSize() const { const TimedImage* img = ChooseImage(); if (img) { - return IntSize(img->mPictureRect.width, img->mPictureRect.height); + return IntSize(img->mPictureRect.Width(), img->mPictureRect.Height()); } return IntSize(); } @@ -472,8 +472,8 @@ ImageHost::IsOpaque() return false; } - if (img->mPictureRect.width == 0 || - img->mPictureRect.height == 0 || + if (img->mPictureRect.Width() == 0 || + img->mPictureRect.Height() == 0 || !img->mTextureHost) { return false; } diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 3ee68dfb62bb..81256553bc8b 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -575,7 +575,7 @@ LayerManagerComposite::InvalidateDebugOverlay(nsIntRegion& aInvalidRegion, const aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 650, 400)); } if (drawFrameColorBars) { - aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 10, aBounds.height)); + aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 10, aBounds.Height())); } #ifdef USE_SKIA @@ -626,33 +626,33 @@ LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds) border = 4; width = 6; effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(0, 0, 0, 1)); - mCompositor->DrawQuad(gfx::Rect(border, border, aBounds.width - 2 * border, width), + mCompositor->DrawQuad(gfx::Rect(border, border, aBounds.Width() - 2 * border, width), aBounds, effects, alpha, gfx::Matrix4x4()); - mCompositor->DrawQuad(gfx::Rect(border, aBounds.height - border - width, aBounds.width - 2 * border, width), + mCompositor->DrawQuad(gfx::Rect(border, aBounds.Height() - border - width, aBounds.Width() - 2 * border, width), aBounds, effects, alpha, gfx::Matrix4x4()); - mCompositor->DrawQuad(gfx::Rect(border, border + width, width, aBounds.height - 2 * border - width * 2), + mCompositor->DrawQuad(gfx::Rect(border, border + width, width, aBounds.Height() - 2 * border - width * 2), aBounds, effects, alpha, gfx::Matrix4x4()); - mCompositor->DrawQuad(gfx::Rect(aBounds.width - border - width, border + width, width, aBounds.height - 2 * border - 2 * width), + mCompositor->DrawQuad(gfx::Rect(aBounds.Width() - border - width, border + width, width, aBounds.Height() - 2 * border - 2 * width), aBounds, effects, alpha, gfx::Matrix4x4()); // Content border = 5; width = 4; effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(1, 1.f - mWarningLevel, 0, 1)); - mCompositor->DrawQuad(gfx::Rect(border, border, aBounds.width - 2 * border, width), + mCompositor->DrawQuad(gfx::Rect(border, border, aBounds.Width() - 2 * border, width), aBounds, effects, alpha, gfx::Matrix4x4()); - mCompositor->DrawQuad(gfx::Rect(border, aBounds.height - border - width, aBounds.width - 2 * border, width), + mCompositor->DrawQuad(gfx::Rect(border, aBounds.height - border - width, aBounds.Width() - 2 * border, width), aBounds, effects, alpha, gfx::Matrix4x4()); - mCompositor->DrawQuad(gfx::Rect(border, border + width, width, aBounds.height - 2 * border - width * 2), + mCompositor->DrawQuad(gfx::Rect(border, border + width, width, aBounds.Height() - 2 * border - width * 2), aBounds, effects, alpha, gfx::Matrix4x4()); - mCompositor->DrawQuad(gfx::Rect(aBounds.width - border - width, border + width, width, aBounds.height - 2 * border - 2 * width), + mCompositor->DrawQuad(gfx::Rect(aBounds.Width() - border - width, border + width, width, aBounds.Height() - 2 * border - 2 * width), aBounds, effects, alpha, gfx::Matrix4x4()); SetDebugOverlayWantsNextFrame(true); } #endif GPUStats stats; - stats.mScreenPixels = mRenderBounds.width * mRenderBounds.height; + stats.mScreenPixels = mRenderBounds.Width() * mRenderBounds.Height(); mCompositor->GetFrameStats(&stats); std::string text = mDiagnostics->GetFrameOverlayString(stats); @@ -670,7 +670,7 @@ LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds) // in the top-right corner EffectChain effects; effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(1, 0, 0, 1)); - mCompositor->DrawQuad(gfx::Rect(aBounds.width - 20, 0, 20, 20), + mCompositor->DrawQuad(gfx::Rect(aBounds.Width() - 20, 0, 20, 20), aBounds, effects, alpha, gfx::Matrix4x4()); mUnusedApzTransformWarning = false; @@ -682,7 +682,7 @@ LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds) // warning box EffectChain effects; effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(1, 1, 0, 1)); - mCompositor->DrawQuad(gfx::Rect(aBounds.width - 40, 0, 20, 20), + mCompositor->DrawQuad(gfx::Rect(aBounds.Width() - 40, 0, 20, 20), aBounds, effects, alpha, gfx::Matrix4x4()); mDisabledApzWarning = false; @@ -691,7 +691,7 @@ LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds) } if (drawFrameColorBars) { - gfx::IntRect sideRect(0, 0, 10, aBounds.height); + gfx::IntRect sideRect(0, 0, 10, aBounds.Height()); EffectChain effects; effects.mPrimaryEffect = new EffectSolidColor(gfxUtils::GetColorForFrameNumber(sFrameCount)); @@ -905,7 +905,7 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi } ParentLayerIntRect clipRect; - IntRect bounds(mRenderBounds.x, mRenderBounds.y, mRenderBounds.width, mRenderBounds.height); + IntRect bounds(mRenderBounds.x, mRenderBounds.y, mRenderBounds.Width(), mRenderBounds.Height()); IntRect actualBounds; CompositorBench(mCompositor, bounds); @@ -921,12 +921,12 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi #endif if (mRoot->GetClipRect()) { clipRect = *mRoot->GetClipRect(); - IntRect rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height); + IntRect rect(clipRect.x, clipRect.y, clipRect.Width(), clipRect.Height()); mCompositor->BeginFrame(aInvalidRegion, &rect, bounds, aOpaqueRegion, nullptr, &actualBounds); } else { gfx::IntRect rect; mCompositor->BeginFrame(aInvalidRegion, nullptr, bounds, aOpaqueRegion, &rect, &actualBounds); - clipRect = ParentLayerIntRect(rect.x, rect.y, rect.width, rect.height); + clipRect = ParentLayerIntRect(rect.x, rect.y, rect.Width(), rect.Height()); } #if defined(MOZ_WIDGET_ANDROID) ScreenCoord offset = GetContentShiftForToolbar(); @@ -970,7 +970,7 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi if (!mRegionToClear.IsEmpty()) { for (auto iter = mRegionToClear.RectIter(); !iter.Done(); iter.Next()) { const IntRect& r = iter.Get(); - mCompositor->ClearRect(Rect(r.x, r.y, r.width, r.height)); + mCompositor->ClearRect(Rect(r.x, r.y, r.Width(), r.Height())); } } diff --git a/gfx/layers/composite/PaintCounter.cpp b/gfx/layers/composite/PaintCounter.cpp index a8f619fed9c3..3128f985672c 100644 --- a/gfx/layers/composite/PaintCounter.cpp +++ b/gfx/layers/composite/PaintCounter.cpp @@ -71,7 +71,7 @@ PaintCounter::Draw(Compositor* aCompositor, TimeDuration aPaintTime, TimeDuratio effectChain.mPrimaryEffect = mTexturedEffect; gfx::Matrix4x4 identity; - Rect rect(mRect.x, mRect.y, mRect.width, mRect.height); + Rect rect(mRect.x, mRect.y, mRect.Width(), mRect.Height()); aCompositor->DrawQuad(rect, mRect, effectChain, 1.0, identity); } diff --git a/gfx/layers/composite/TiledContentHost.cpp b/gfx/layers/composite/TiledContentHost.cpp index 59609fe47e24..c1d10a22c76c 100644 --- a/gfx/layers/composite/TiledContentHost.cpp +++ b/gfx/layers/composite/TiledContentHost.cpp @@ -494,14 +494,14 @@ TiledContentHost::RenderTile(TileHost& aTile, for (auto iter = aScreenRegion.RectIter(); !iter.Done(); iter.Next()) { const IntRect& rect = iter.Get(); - Rect graphicsRect(rect.x, rect.y, rect.width, rect.height); + Rect graphicsRect(rect.x, rect.y, rect.Width(), rect.Height()); Rect textureRect(rect.x - aTextureOffset.x, rect.y - aTextureOffset.y, - rect.width, rect.height); + rect.Width(), rect.Height()); effect->mTextureCoords = Rect(textureRect.x / aTextureBounds.width, textureRect.y / aTextureBounds.height, - textureRect.width / aTextureBounds.width, - textureRect.height / aTextureBounds.height); + textureRect.Width() / aTextureBounds.width, + textureRect.Height() / aTextureBounds.height); aCompositor->DrawGeometry(graphicsRect, aClipRect, aEffectChain, opacity, aTransform, aVisibleRect, aGeometry); @@ -576,7 +576,7 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer, effect.mPrimaryEffect = new EffectSolidColor(*aBackgroundColor); for (auto iter = backgroundRegion.RectIter(); !iter.Done(); iter.Next()) { const IntRect& rect = iter.Get(); - Rect graphicsRect(rect.x, rect.y, rect.width, rect.height); + Rect graphicsRect(rect.x, rect.y, rect.Width(), rect.Height()); aCompositor->DrawGeometry(graphicsRect, aClipRect, effect, 1.0, aTransform, aGeometry); } @@ -605,7 +605,7 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer, aTransform, aSamplingFilter, aClipRect, tileDrawRegion, tileOffset * resolution, aLayerBuffer.GetTileSize(), gfx::Rect(visibleRect.x, visibleRect.y, - visibleRect.width, visibleRect.height), + visibleRect.Width(), visibleRect.Height()), aGeometry); if (tile.mTextureHostOnWhite) { @@ -614,7 +614,7 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer, } gfx::Rect rect(visibleRect.x, visibleRect.y, - visibleRect.width, visibleRect.height); + visibleRect.Width(), visibleRect.Height()); aCompositor->DrawDiagnostics(DiagnosticFlags::CONTENT | componentAlphaDiagnostic, rect, aClipRect, aTransform, mFlashCounter); } diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index 9e65a9c40232..b1dafe7f868b 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -326,13 +326,13 @@ already_AddRefed CompositorD3D11::CreateRenderTarget(const gfx::IntRect& aRect, SurfaceInitMode aInit) { - MOZ_ASSERT(aRect.width != 0 && aRect.height != 0); + MOZ_ASSERT(aRect.Width() != 0 && aRect.Height() != 0); - if (aRect.width * aRect.height == 0) { + if (aRect.Width() * aRect.Height() == 0) { return nullptr; } - CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aRect.width, aRect.height, 1, 1, + CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aRect.Width(), aRect.Height(), 1, 1, D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET); RefPtr texture; @@ -343,7 +343,7 @@ CompositorD3D11::CreateRenderTarget(const gfx::IntRect& aRect, } RefPtr rt = new CompositingRenderTargetD3D11(texture, aRect.TopLeft()); - rt->SetSize(IntSize(aRect.width, aRect.height)); + rt->SetSize(IntSize(aRect.Width(), aRect.Height())); if (aInit == INIT_MODE_CLEAR) { FLOAT clear[] = { 0, 0, 0, 0 }; @@ -358,14 +358,14 @@ CompositorD3D11::CreateTexture(const gfx::IntRect& aRect, const CompositingRenderTarget* aSource, const gfx::IntPoint& aSourcePoint) { - MOZ_ASSERT(aRect.width != 0 && aRect.height != 0); + MOZ_ASSERT(aRect.Width() != 0 && aRect.Height() != 0); - if (aRect.width * aRect.height == 0) { + if (aRect.Width() * aRect.Height() == 0) { return nullptr; } CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, - aRect.width, aRect.height, 1, 1, + aRect.Width(), aRect.Height(), 1, 1, D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET); RefPtr texture; @@ -738,16 +738,16 @@ CompositorD3D11::DrawGeometry(const Geometry& aGeometry, bounds = maskTransform.As2D().TransformBounds(bounds); Matrix4x4 transform; - transform._11 = 1.0f / bounds.width; - transform._22 = 1.0f / bounds.height; - transform._41 = float(-bounds.x) / bounds.width; - transform._42 = float(-bounds.y) / bounds.height; + transform._11 = 1.0f / bounds.Width(); + transform._22 = 1.0f / bounds.Height(); + transform._41 = float(-bounds.x) / bounds.Width(); + transform._42 = float(-bounds.y) / bounds.Height(); memcpy(mVSConstants.maskTransform, &transform._11, 64); } D3D11_RECT scissor; - IntRect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height); + IntRect clipRect(aClipRect.x, aClipRect.y, aClipRect.Width(), aClipRect.Height()); if (mCurrentRT == mDefaultRT) { clipRect = clipRect.Intersect(mCurrentClip); } @@ -1014,7 +1014,7 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, IntRect clipRect = invalidRect; if (aClipRectIn) { - clipRect.IntersectRect(clipRect, IntRect(aClipRectIn->x, aClipRectIn->y, aClipRectIn->width, aClipRectIn->height)); + clipRect.IntersectRect(clipRect, IntRect(aClipRectIn->x, aClipRectIn->y, aClipRectIn->Width(), aClipRectIn->Height())); } if (clipRect.IsEmpty()) { @@ -1071,7 +1071,7 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, if (gfxPrefs::LayersDrawFPS()) { uint32_t pixelsPerFrame = 0; for (auto iter = mBackBufferInvalid.RectIter(); !iter.Done(); iter.Next()) { - pixelsPerFrame += iter.Get().width * iter.Get().height; + pixelsPerFrame += iter.Get().Width() * iter.Get().Height(); } mDiagnostics->Start(pixelsPerFrame); diff --git a/gfx/layers/d3d11/MLGDeviceD3D11.cpp b/gfx/layers/d3d11/MLGDeviceD3D11.cpp index 29b3db29bf27..ee9b1aed9b2a 100644 --- a/gfx/layers/d3d11/MLGDeviceD3D11.cpp +++ b/gfx/layers/d3d11/MLGDeviceD3D11.cpp @@ -1407,8 +1407,8 @@ MLGDeviceD3D11::SetViewport(const gfx::IntRect& aViewport) vp.MinDepth = 0.0f; vp.TopLeftX = aViewport.x; vp.TopLeftY = aViewport.y; - vp.Width = aViewport.width; - vp.Height = aViewport.height; + vp.Width = aViewport.Width(); + vp.Height = aViewport.Height(); mCtx->RSSetViewports(1, &vp); } diff --git a/gfx/layers/d3d11/TextureD3D11.cpp b/gfx/layers/d3d11/TextureD3D11.cpp index dd6c72fa47b9..ab4b13015e19 100644 --- a/gfx/layers/d3d11/TextureD3D11.cpp +++ b/gfx/layers/d3d11/TextureD3D11.cpp @@ -1382,7 +1382,7 @@ DataTextureSourceD3D11::Update(DataSourceSurface* aSurface, void* data = map.mData + map.mStride * rect.y + BytesPerPixel(aSurface->GetFormat()) * rect.x; - context->UpdateSubresource(mTexture, 0, &box, data, map.mStride, map.mStride * rect.height); + context->UpdateSubresource(mTexture, 0, &box, data, map.mStride, map.mStride * rect.Height()); } } else { context->UpdateSubresource(mTexture, 0, nullptr, aSurface->GetData(), @@ -1402,8 +1402,8 @@ DataTextureSourceD3D11::Update(DataSourceSurface* aSurface, for (uint32_t i = 0; i < tileCount; i++) { IntRect tileRect = GetTileRect(i); - desc.Width = tileRect.width; - desc.Height = tileRect.height; + desc.Width = tileRect.Width(); + desc.Height = tileRect.Height(); desc.Usage = D3D11_USAGE_IMMUTABLE; D3D11_SUBRESOURCE_DATA initData; @@ -1480,7 +1480,7 @@ IntRect DataTextureSourceD3D11::GetTileRect() { IntRect rect = GetTileRect(mCurrentTile); - return IntRect(rect.x, rect.y, rect.width, rect.height); + return IntRect(rect.x, rect.y, rect.Width(), rect.Height()); } CompositingRenderTargetD3D11::CompositingRenderTargetD3D11(ID3D11Texture2D* aTexture, diff --git a/gfx/layers/ipc/CompositorBridgeChild.cpp b/gfx/layers/ipc/CompositorBridgeChild.cpp index 5b3ed7cbc1e1..e09928d02de7 100644 --- a/gfx/layers/ipc/CompositorBridgeChild.cpp +++ b/gfx/layers/ipc/CompositorBridgeChild.cpp @@ -430,7 +430,7 @@ CompositorBridgeChild::RecvUpdatePluginConfigurations(const LayoutDeviceIntPoint // our OnPaint handler and forwarded over to the plugin process async. widget->Resize(aContentOffset.x + bounds.x, aContentOffset.y + bounds.y, - bounds.width, bounds.height, true); + bounds.Width(), bounds.Height(), true); } widget->Enable(isVisible); diff --git a/gfx/layers/mlgpu/ImageLayerMLGPU.cpp b/gfx/layers/mlgpu/ImageLayerMLGPU.cpp index 88aff09ad5fb..49e8f01d599c 100644 --- a/gfx/layers/mlgpu/ImageLayerMLGPU.cpp +++ b/gfx/layers/mlgpu/ImageLayerMLGPU.cpp @@ -48,9 +48,8 @@ ImageLayerMLGPU::ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSu mScaleToSize.width != 0.0 && mScaleToSize.height != 0.0) { - Size scale( - sourceRect.width / mScaleToSize.width, - sourceRect.height / mScaleToSize.height); + Size scale(sourceRect.Width() / mScaleToSize.width, + sourceRect.Height() / mScaleToSize.height); mScale = Some(scale); } @@ -66,7 +65,7 @@ ImageLayerMLGPU::GetSamplingFilter() bool ImageLayerMLGPU::IsContentOpaque() { - if (mPictureRect.width == 0 || mPictureRect.height == 0) { + if (mPictureRect.Width() == 0 || mPictureRect.Height() == 0) { return false; } if (mScaleMode == ScaleMode::STRETCH) { diff --git a/gfx/layers/mlgpu/MaskOperation.cpp b/gfx/layers/mlgpu/MaskOperation.cpp index d8e747460585..12d7efc8b205 100644 --- a/gfx/layers/mlgpu/MaskOperation.cpp +++ b/gfx/layers/mlgpu/MaskOperation.cpp @@ -61,10 +61,10 @@ MaskTexture::operator <(const MaskTexture& aOther) const return mRect.y < aOther.mRect.y; } if (mRect.width != aOther.mRect.width) { - return mRect.width < aOther.mRect.width; + return mRect.Width() < aOther.mRect.Width(); } if (mRect.height != aOther.mRect.height) { - return mRect.height < aOther.mRect.height; + return mRect.Height() < aOther.mRect.Height(); } return mSource < aOther.mSource; } diff --git a/gfx/layers/mlgpu/RenderPassMLGPU.cpp b/gfx/layers/mlgpu/RenderPassMLGPU.cpp index a8242f1bcaa6..ae3a48d9efe3 100644 --- a/gfx/layers/mlgpu/RenderPassMLGPU.cpp +++ b/gfx/layers/mlgpu/RenderPassMLGPU.cpp @@ -506,13 +506,13 @@ TexturedRenderPass::AddClippedItem(Txn& aTxn, Rect textureRect( offset.x * xScale, offset.y * yScale, - aDrawRect.width * xScale, - aDrawRect.height * yScale); + aDrawRect.Width() * xScale, + aDrawRect.Height() * yScale); Rect textureCoords = TextureRectToCoords(textureRect, aTextureSize); if (mTextureFlags & TextureFlags::ORIGIN_BOTTOM_LEFT) { textureCoords.y = 1.0 - textureCoords.y; - textureCoords.height = -textureCoords.height; + textureCoords.SetHeight(-textureCoords.Height()); } Rect layerRects[4]; diff --git a/gfx/layers/mlgpu/TexturedLayerMLGPU.cpp b/gfx/layers/mlgpu/TexturedLayerMLGPU.cpp index d6c3fbc50444..6897dd45529b 100644 --- a/gfx/layers/mlgpu/TexturedLayerMLGPU.cpp +++ b/gfx/layers/mlgpu/TexturedLayerMLGPU.cpp @@ -102,7 +102,7 @@ TexturedLayerMLGPU::OnPrepareToRender(FrameBuilder* aBuilder) mTexture = source; } - mPictureRect = IntRect(0, 0, info.img->mPictureRect.width, info.img->mPictureRect.height); + mPictureRect = IntRect(0, 0, info.img->mPictureRect.Width(), info.img->mPictureRect.Height()); mHost->FinishRendering(info); return true; diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index 3b60d972cf67..94e1592f5962 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -521,9 +521,9 @@ CompositorOGL::PrepareViewport(CompositingRenderTargetOGL* aRenderTarget) already_AddRefed CompositorOGL::CreateRenderTarget(const IntRect &aRect, SurfaceInitMode aInit) { - MOZ_ASSERT(aRect.width != 0 && aRect.height != 0, "Trying to create a render target of invalid size"); + MOZ_ASSERT(aRect.Width() != 0 && aRect.Height() != 0, "Trying to create a render target of invalid size"); - if (aRect.width * aRect.height == 0) { + if (aRect.Width() * aRect.Height() == 0) { return nullptr; } @@ -548,9 +548,9 @@ CompositorOGL::CreateRenderTargetFromSource(const IntRect &aRect, const CompositingRenderTarget *aSource, const IntPoint &aSourcePoint) { - MOZ_ASSERT(aRect.width != 0 && aRect.height != 0, "Trying to create a render target of invalid size"); + MOZ_ASSERT(aRect.Width() != 0 && aRect.Height() != 0, "Trying to create a render target of invalid size"); - if (aRect.width * aRect.height == 0) { + if (aRect.Width() * aRect.Height() == 0) { return nullptr; } @@ -619,10 +619,10 @@ void CompositorOGL::ClearRect(const gfx::Rect& aRect) { // Map aRect to OGL coordinates, origin:bottom-left - GLint y = mViewportSize.height - (aRect.y + aRect.height); + GLint y = mViewportSize.height - (aRect.y + aRect.Height()); ScopedGLState scopedScissorTestState(mGLContext, LOCAL_GL_SCISSOR_TEST, true); - ScopedScissorRect autoScissorRect(mGLContext, aRect.x, y, aRect.width, aRect.height); + ScopedScissorRect autoScissorRect(mGLContext, aRect.x, y, aRect.Width(), aRect.Height()); mGLContext->fClearColor(0.0, 0.0, 0.0, 0.0); mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT); } @@ -643,15 +643,15 @@ CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion, if (mUseExternalSurfaceSize) { rect = gfx::IntRect(0, 0, mSurfaceSize.width, mSurfaceSize.height); } else { - rect = gfx::IntRect(aRenderBounds.x, aRenderBounds.y, aRenderBounds.width, aRenderBounds.height); + rect = gfx::IntRect(aRenderBounds.x, aRenderBounds.y, aRenderBounds.Width(), aRenderBounds.Height()); } if (aRenderBoundsOut) { *aRenderBoundsOut = rect; } - GLint width = rect.width; - GLint height = rect.height; + GLint width = rect.Width(); + GLint height = rect.Height(); // We can't draw anything to something with no area // so just return @@ -727,8 +727,8 @@ CompositorOGL::CreateTexture(const IntRect& aRect, bool aCopyFromSource, // See bug 827170 for a discussion. IntRect clampedRect = aRect; int32_t maxTexSize = GetMaxTextureSize(); - clampedRect.width = std::min(clampedRect.width, maxTexSize); - clampedRect.height = std::min(clampedRect.height, maxTexSize); + clampedRect.SetWidth(std::min(clampedRect.Width(), maxTexSize)); + clampedRect.SetHeight(std::min(clampedRect.Height(), maxTexSize)); GLuint tex; @@ -758,25 +758,25 @@ CompositorOGL::CreateTexture(const IntRect& aRect, bool aCopyFromSource, mGLContext->fCopyTexImage2D(mFBOTextureTarget, 0, LOCAL_GL_RGBA, - clampedRect.x, FlipY(clampedRect.y + clampedRect.height), - clampedRect.width, clampedRect.height, + clampedRect.x, FlipY(clampedRect.y + clampedRect.Height()), + clampedRect.Width(), clampedRect.Height(), 0); } else { // Curses, incompatible formats. Take a slow path. // RGBA - size_t bufferSize = clampedRect.width * clampedRect.height * 4; + size_t bufferSize = clampedRect.Width() * clampedRect.Height() * 4; auto buf = MakeUnique(bufferSize); mGLContext->fReadPixels(clampedRect.x, clampedRect.y, - clampedRect.width, clampedRect.height, + clampedRect.Width(), clampedRect.Height(), LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE, buf.get()); mGLContext->fTexImage2D(mFBOTextureTarget, 0, LOCAL_GL_RGBA, - clampedRect.width, clampedRect.height, + clampedRect.Width(), clampedRect.Height(), 0, LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE, @@ -794,7 +794,7 @@ CompositorOGL::CreateTexture(const IntRect& aRect, bool aCopyFromSource, mGLContext->fTexImage2D(mFBOTextureTarget, 0, LOCAL_GL_RGBA, - clampedRect.width, clampedRect.height, + clampedRect.Width(), clampedRect.Height(), 0, LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE, @@ -811,8 +811,8 @@ CompositorOGL::CreateTexture(const IntRect& aRect, bool aCopyFromSource, mGLContext->fBindTexture(mFBOTextureTarget, 0); if (aAllocSize) { - aAllocSize->width = clampedRect.width; - aAllocSize->height = clampedRect.height; + aAllocSize->width = clampedRect.Width(); + aAllocSize->height = clampedRect.Height(); } return tex; @@ -1647,8 +1647,8 @@ CompositorOGL::CopyToTarget(DrawTarget* aTarget, const nsIntPoint& aTopLeft, con } else { rect = IntRect(0, 0, mWidgetSize.width, mWidgetSize.height); } - GLint width = rect.width; - GLint height = rect.height; + GLint width = rect.Width(); + GLint height = rect.Height(); if ((int64_t(width) * int64_t(height) * int64_t(4)) > INT32_MAX) { NS_ERROR("Widget size too big - integer overflow!"); @@ -1681,7 +1681,7 @@ CompositorOGL::CopyToTarget(DrawTarget* aTarget, const nsIntPoint& aTopLeft, con Matrix oldMatrix = aTarget->GetTransform(); aTarget->SetTransform(glToCairoTransform); - Rect floatRect = Rect(rect.x, rect.y, rect.width, rect.height); + Rect floatRect = Rect(rect.x, rect.y, rect.Width(), rect.Height()); aTarget->DrawSurface(source, floatRect, floatRect, DrawSurfaceOptions(), DrawOptions(1.0f, CompositionOp::OP_SOURCE)); aTarget->SetTransform(oldMatrix); aTarget->Flush(); diff --git a/gfx/layers/opengl/GLBlitTextureImageHelper.cpp b/gfx/layers/opengl/GLBlitTextureImageHelper.cpp index 8c6ac1703109..c13d379921e9 100644 --- a/gfx/layers/opengl/GLBlitTextureImageHelper.cpp +++ b/gfx/layers/opengl/GLBlitTextureImageHelper.cpp @@ -53,8 +53,8 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const gfx::IntRec ScopedGLState scopedBlendState(gl, LOCAL_GL_BLEND, false); // 2.0 means scale up by two - float blitScaleX = float(aDstRect.width) / float(aSrcRect.width); - float blitScaleY = float(aDstRect.height) / float(aSrcRect.height); + float blitScaleX = float(aDstRect.Width()) / float(aSrcRect.Width()); + float blitScaleY = float(aDstRect.Height()) / float(aSrcRect.Height()); // We start iterating over all destination tiles aDst->BeginBigImageIteration(); @@ -116,8 +116,8 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const gfx::IntRec float dx0 = 2.0f * float(srcSubInDstRect.x) / float(dstSize.width) - 1.0f; float dy0 = 2.0f * float(srcSubInDstRect.y) / float(dstSize.height) - 1.0f; - float dx1 = 2.0f * float(srcSubInDstRect.x + srcSubInDstRect.width) / float(dstSize.width) - 1.0f; - float dy1 = 2.0f * float(srcSubInDstRect.y + srcSubInDstRect.height) / float(dstSize.height) - 1.0f; + float dx1 = 2.0f * float(srcSubInDstRect.x + srcSubInDstRect.Width()) / float(dstSize.width) - 1.0f; + float dy1 = 2.0f * float(srcSubInDstRect.y + srcSubInDstRect.Height()) / float(dstSize.height) - 1.0f; ScopedViewportRect autoViewportRect(gl, 0, 0, dstSize.width, dstSize.height); RectTriangles rects; diff --git a/gfx/layers/wr/AsyncImagePipelineManager.cpp b/gfx/layers/wr/AsyncImagePipelineManager.cpp index 4ac2169a664f..167206b8f373 100644 --- a/gfx/layers/wr/AsyncImagePipelineManager.cpp +++ b/gfx/layers/wr/AsyncImagePipelineManager.cpp @@ -266,7 +266,7 @@ AsyncImagePipelineManager::ApplyAsyncImages() continue; } - wr::LayoutSize contentSize { pipeline->mScBounds.width, pipeline->mScBounds.height }; + wr::LayoutSize contentSize { pipeline->mScBounds.Width(), pipeline->mScBounds.Height() }; wr::DisplayListBuilder builder(pipelineId, contentSize); if (!keys.IsEmpty()) { @@ -308,7 +308,7 @@ AsyncImagePipelineManager::ApplyAsyncImages() wr::BuiltDisplayList dl; wr::LayoutSize builderContentSize; builder.Finalize(builderContentSize, dl); - mApi->SetRootDisplayList(gfx::Color(0.f, 0.f, 0.f, 0.f), epoch, LayerSize(pipeline->mScBounds.width, pipeline->mScBounds.height), + mApi->SetRootDisplayList(gfx::Color(0.f, 0.f, 0.f, 0.f), epoch, LayerSize(pipeline->mScBounds.Width(), pipeline->mScBounds.Height()), pipelineId, builderContentSize, dl.dl_desc, dl.dl.inner.data, dl.dl.inner.length); } diff --git a/gfx/layers/wr/WebRenderCanvasLayer.cpp b/gfx/layers/wr/WebRenderCanvasLayer.cpp index 2bc89eae16b3..3fe0c8d1dd47 100644 --- a/gfx/layers/wr/WebRenderCanvasLayer.cpp +++ b/gfx/layers/wr/WebRenderCanvasLayer.cpp @@ -46,13 +46,13 @@ WebRenderCanvasLayer::RenderLayer(wr::DisplayListBuilder& aBuilder, Maybe transform; if (canvasRenderer->NeedsYFlip()) { - transform = Some(GetTransform().PreTranslate(0, mBounds.height, 0).PreScale(1, -1, 1)); + transform = Some(GetTransform().PreTranslate(0, mBounds.Height(), 0).PreScale(1, -1, 1)); } ScrollingLayersHelper scroller(this, aBuilder, aSc); StackingContextHelper sc(aSc, aBuilder, this, transform); - LayerRect rect(0, 0, mBounds.width, mBounds.height); + LayerRect rect(0, 0, mBounds.Width(), mBounds.Height()); DumpLayerInfo("CanvasLayer", rect); wr::ImageRendering filter = wr::ToImageRendering(mSamplingFilter); diff --git a/gfx/layers/wr/WebRenderImageHost.cpp b/gfx/layers/wr/WebRenderImageHost.cpp index 69e102bcbd58..98a62ca2b8e1 100644 --- a/gfx/layers/wr/WebRenderImageHost.cpp +++ b/gfx/layers/wr/WebRenderImageHost.cpp @@ -291,7 +291,7 @@ WebRenderImageHost::GetImageSize() const { const TimedImage* img = ChooseImage(); if (img) { - return IntSize(img->mPictureRect.width, img->mPictureRect.height); + return IntSize(img->mPictureRect.Width(), img->mPictureRect.Height()); } return IntSize(); } diff --git a/gfx/layers/wr/WebRenderLayerManager.cpp b/gfx/layers/wr/WebRenderLayerManager.cpp index 611528da08ef..d456926c24c1 100644 --- a/gfx/layers/wr/WebRenderLayerManager.cpp +++ b/gfx/layers/wr/WebRenderLayerManager.cpp @@ -323,7 +323,7 @@ WebRenderLayerManager::CreateImageKey(nsDisplayItem* aItem, LayerRect rect = ViewAs( LayoutDeviceRect::FromAppUnits(bounds, appUnitsPerDevPixel), PixelCastJustification::WebRenderHasUnitResolution); - LayerRect scBounds(0, 0, rect.width, rect.height); + LayerRect scBounds(0, 0, rect.width, rect.Height()); MaybeIntSize scaleToSize; if (!aContainer->GetScaleHint().IsEmpty()) { scaleToSize = Some(aContainer->GetScaleHint()); @@ -397,14 +397,14 @@ PaintItemByDrawTarget(nsDisplayItem* aItem, if (gfxPrefs::WebRenderHighlightPaintedLayers()) { aDT->SetTransform(Matrix()); - aDT->FillRect(Rect(0, 0, aImageRect.width, aImageRect.height), ColorPattern(Color(1.0, 0.0, 0.0, 0.5))); + aDT->FillRect(Rect(0, 0, aImageRect.Width(), aImageRect.Height()), ColorPattern(Color(1.0, 0.0, 0.0, 0.5))); } if (aItem->Frame()->PresContext()->GetPaintFlashing()) { aDT->SetTransform(Matrix()); float r = float(rand()) / RAND_MAX; float g = float(rand()) / RAND_MAX; float b = float(rand()) / RAND_MAX; - aDT->FillRect(Rect(0, 0, aImageRect.width, aImageRect.height), ColorPattern(Color(r, g, b, 0.5))); + aDT->FillRect(Rect(0, 0, aImageRect.Width(), aImageRect.Height()), ColorPattern(Color(r, g, b, 0.5))); } } @@ -767,8 +767,8 @@ WebRenderLayerManager::MakeSnapshotIfRequired(LayoutDeviceIntSize aSize) gfxUtils::WriteAsPNG(snapshot, filename); */ - Rect dst(bounds.x, bounds.y, bounds.width, bounds.height); - Rect src(0, 0, bounds.width, bounds.height); + Rect dst(bounds.x, bounds.y, bounds.Width(), bounds.Height()); + Rect src(0, 0, bounds.Width(), bounds.Height()); // The data we get from webrender is upside down. So flip and translate up so the image is rightside up. // Webrender always does a full screen readback. diff --git a/gfx/src/nsDeviceContext.cpp b/gfx/src/nsDeviceContext.cpp index 913f46d272cc..f71bdd726443 100644 --- a/gfx/src/nsDeviceContext.cpp +++ b/gfx/src/nsDeviceContext.cpp @@ -454,8 +454,8 @@ nsDeviceContext::GetDeviceSurfaceDimensions(nscoord &aWidth, nscoord &aHeight) } else { nsRect area; ComputeFullAreaUsingScreen(&area); - aWidth = area.width; - aHeight = area.height; + aWidth = area.Width(); + aHeight = area.Height(); } return NS_OK; @@ -467,8 +467,8 @@ nsDeviceContext::GetRect(nsRect &aRect) if (IsPrinterContext()) { aRect.x = 0; aRect.y = 0; - aRect.width = mWidth; - aRect.height = mHeight; + aRect.SetWidth(mWidth); + aRect.SetHeight(mHeight); } else ComputeFullAreaUsingScreen ( &aRect ); @@ -481,8 +481,8 @@ nsDeviceContext::GetClientRect(nsRect &aRect) if (IsPrinterContext()) { aRect.x = 0; aRect.y = 0; - aRect.width = mWidth; - aRect.height = mHeight; + aRect.SetWidth(mWidth); + aRect.SetHeight(mHeight); } else ComputeClientRectUsingScreen(&aRect); @@ -623,8 +623,8 @@ nsDeviceContext::ComputeClientRectUsingScreen(nsRect* outRect) // convert to device units outRect->y = NSIntPixelsToAppUnits(y, AppUnitsPerDevPixel()); outRect->x = NSIntPixelsToAppUnits(x, AppUnitsPerDevPixel()); - outRect->width = NSIntPixelsToAppUnits(width, AppUnitsPerDevPixel()); - outRect->height = NSIntPixelsToAppUnits(height, AppUnitsPerDevPixel()); + outRect->SetWidth(NSIntPixelsToAppUnits(width, AppUnitsPerDevPixel())); + outRect->SetHeight(NSIntPixelsToAppUnits(height, AppUnitsPerDevPixel())); } } @@ -644,11 +644,11 @@ nsDeviceContext::ComputeFullAreaUsingScreen(nsRect* outRect) // convert to device units outRect->y = NSIntPixelsToAppUnits(y, AppUnitsPerDevPixel()); outRect->x = NSIntPixelsToAppUnits(x, AppUnitsPerDevPixel()); - outRect->width = NSIntPixelsToAppUnits(width, AppUnitsPerDevPixel()); - outRect->height = NSIntPixelsToAppUnits(height, AppUnitsPerDevPixel()); + outRect->SetWidth(NSIntPixelsToAppUnits(width, AppUnitsPerDevPixel())); + outRect->SetHeight(NSIntPixelsToAppUnits(height, AppUnitsPerDevPixel())); - mWidth = outRect->width; - mHeight = outRect->height; + mWidth = outRect->Width(); + mHeight = outRect->Height(); } } diff --git a/gfx/src/nsRect.cpp b/gfx/src/nsRect.cpp index 85be958f0f6b..ef239bdcc8d3 100644 --- a/gfx/src/nsRect.cpp +++ b/gfx/src/nsRect.cpp @@ -49,10 +49,10 @@ FILE* operator<<(FILE* out, const nsRect& rect) tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.y, nsDeviceContext::AppUnitsPerCSSPixel())); tmp.AppendLiteral(", "); - tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.width, + tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.Width(), nsDeviceContext::AppUnitsPerCSSPixel())); tmp.AppendLiteral(", "); - tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.height, + tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.Height(), nsDeviceContext::AppUnitsPerCSSPixel())); tmp.Append('}'); fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out); diff --git a/gfx/src/nsRegion.cpp b/gfx/src/nsRegion.cpp index 3b0bec1e311d..a685da64e417 100644 --- a/gfx/src/nsRegion.cpp +++ b/gfx/src/nsRegion.cpp @@ -555,7 +555,7 @@ uint64_t nsRegion::Area () const uint64_t area = 0; for (auto iter = RectIter(); !iter.Done(); iter.Next()) { const nsRect& rect = iter.Get(); - area += uint64_t(rect.width) * rect.height; + area += uint64_t(rect.Width()) * rect.Height(); } return area; } @@ -610,7 +610,7 @@ TransformRect(const mozilla::gfx::IntRect& aRect, const mozilla::gfx::Matrix4x4& return mozilla::gfx::IntRect(); } - mozilla::gfx::RectDouble rect(aRect.x, aRect.y, aRect.width, aRect.height); + mozilla::gfx::RectDouble rect(aRect.x, aRect.y, aRect.Width(), aRect.Height()); rect = aTransform.TransformAndClipBounds(rect, mozilla::gfx::RectDouble::MaxIntRect()); rect.RoundOut(); diff --git a/gfx/src/nsScriptableRegion.cpp b/gfx/src/nsScriptableRegion.cpp index f0afff8f4a37..7818143beb5d 100644 --- a/gfx/src/nsScriptableRegion.cpp +++ b/gfx/src/nsScriptableRegion.cpp @@ -103,8 +103,8 @@ NS_IMETHODIMP nsScriptableRegion::GetBoundingBox(int32_t *aX, int32_t *aY, int32 mozilla::gfx::IntRect boundRect = mRegion.GetBounds(); *aX = boundRect.x; *aY = boundRect.y; - *aWidth = boundRect.width; - *aHeight = boundRect.height; + *aWidth = boundRect.Width(); + *aHeight = boundRect.Height(); return NS_OK; } @@ -148,8 +148,8 @@ NS_IMETHODIMP nsScriptableRegion::GetRects(JSContext* aCx, JS::MutableHandleSubmit(::vr::EVREye::Eye_Left, &tex, &bounds); @@ -316,8 +316,8 @@ VRDisplayOpenVR::SubmitFrame(void* aTextureHandle, bounds.uMin = aRightEyeRect.x; bounds.vMin = 1.0 - aRightEyeRect.y; - bounds.uMax = aRightEyeRect.x + aRightEyeRect.width; - bounds.vMax = 1.0 - aRightEyeRect.y - aRightEyeRect.height; + bounds.uMax = aRightEyeRect.x + aRightEyeRect.Width(); + bounds.vMax = 1.0 - aRightEyeRect.y - aRightEyeRect.Height(); err = mVRCompositor->Submit(::vr::EVREye::Eye_Right, &tex, &bounds); if (err != ::vr::EVRCompositorError::VRCompositorError_None) { diff --git a/gfx/vr/ipc/VRManagerChild.cpp b/gfx/vr/ipc/VRManagerChild.cpp index bf6940f7d921..0ef9ca5af3af 100644 --- a/gfx/vr/ipc/VRManagerChild.cpp +++ b/gfx/vr/ipc/VRManagerChild.cpp @@ -403,10 +403,10 @@ VRManagerChild::CreateVRLayer(uint32_t aDisplayID, uint32_t aGroup) { PVRLayerChild* vrLayerChild = AllocPVRLayerChild(aDisplayID, aLeftEyeRect.x, - aLeftEyeRect.y, aLeftEyeRect.width, - aLeftEyeRect.height, aRightEyeRect.x, - aRightEyeRect.y, aRightEyeRect.width, - aRightEyeRect.height, + aLeftEyeRect.y, aLeftEyeRect.Width(), + aLeftEyeRect.Height(), aRightEyeRect.x, + aRightEyeRect.y, aRightEyeRect.Width(), + aRightEyeRect.Height(), aGroup); // Do the DOM labeling. if (aTarget) { @@ -414,10 +414,10 @@ VRManagerChild::CreateVRLayer(uint32_t aDisplayID, MOZ_ASSERT(vrLayerChild->GetActorEventTarget()); } return SendPVRLayerConstructor(vrLayerChild, aDisplayID, aLeftEyeRect.x, - aLeftEyeRect.y, aLeftEyeRect.width, - aLeftEyeRect.height, aRightEyeRect.x, - aRightEyeRect.y, aRightEyeRect.width, - aRightEyeRect.height, + aLeftEyeRect.y, aLeftEyeRect.Width(), + aLeftEyeRect.Height(), aRightEyeRect.x, + aRightEyeRect.y, aRightEyeRect.Width(), + aRightEyeRect.Height(), aGroup); }