--- a/gfx/2d/Blur.cpp
+++ b/gfx/2d/Blur.cpp
@@ -497,23 +497,23 @@ AlphaBoxBlur::Init(const Rect& aRect,
if (mSkipRect.IsEqualInterior(mRect))
return;
mSkipRect -= mRect.TopLeft();
} else {
mSkipRect = IntRect(0, 0, 0, 0);
}
- CheckedInt<int32_t> stride = RoundUpToMultipleOf4(mRect.width);
+ CheckedInt<int32_t> 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;
}
}
}
AlphaBoxBlur::AlphaBoxBlur(const Rect& aRect,
int32_t aStride,
@@ -522,32 +522,32 @@ AlphaBoxBlur::AlphaBoxBlur(const Rect& a
: mRect(TruncatedToInt(aRect)),
mSpreadRadius(),
mBlurRadius(CalculateBlurRadius(Point(aSigmaX, aSigmaY))),
mStride(aStride),
mSurfaceAllocationSize(0)
{
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;
}
}
}
AlphaBoxBlur::~AlphaBoxBlur()
{
}
IntSize
AlphaBoxBlur::GetSize()
{
- IntSize size(mRect.width, mRect.height);
+ IntSize size(mRect.Width(), mRect.Height());
return size;
}
int32_t
AlphaBoxBlur::GetStride()
{
return mStride;
}
--- a/gfx/2d/DrawTargetD2D1.cpp
+++ b/gfx/2d/DrawTargetD2D1.cpp
@@ -187,18 +187,18 @@ DrawTargetD2D1::DrawSurface(SourceSurfac
D2D1_RECT_F samplingBounds;
if (aSurfOptions.mSamplingBounds == SamplingBounds::BOUNDED) {
samplingBounds = D2DRect(aSource);
} else {
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<ID2D1ImageBrush> brush;
// Here we scale the source pattern up to the size and position where we want
// it to be.
Matrix transform;
transform.PreTranslate(aDest.x - aSource.x * xScale, aDest.y - aSource.y * yScale);
transform.PreScale(xScale, yScale);
@@ -420,18 +420,18 @@ DrawTargetD2D1::MaskSurface(const Patter
FinalizeDrawing(aOptions.mCompositionOp, aSource);
return;
} else {
// If this is a data source surface, we might have created a partial bitmap
// for this surface and only uploaded part of the mask. In that case,
// 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
mDC->SetAntialiasMode(D2D1_ANTIALIAS_MODE_ALIASED);
Rect maskRect = Rect(0.f, 0.f, Float(size.width), Float(size.height));
RefPtr<ID2D1Brush> brush = CreateBrushForPattern(aSource, aOptions.mAlpha);
mDC->FillOpacityMask(bitmap, brush, D2D1_OPACITY_MASK_CONTENT_GRAPHICS, D2DRect(dest), D2DRect(maskRect));
@@ -483,20 +483,20 @@ DrawTargetD2D1::CopySurface(SourceSurfac
mDC->SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND_COPY);
mDC->FillOpacityMask(bitmap, brush, D2D1_OPACITY_MASK_CONTENT_GRAPHICS);
mDC->SetAntialiasMode(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
mDC->SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND_SOURCE_OVER);
return;
}
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);
mDC->DrawBitmap(bitmap, D2DRect(dstRect), 1.0f,
D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR,
D2DRect(srcRect));
mDC->SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND_SOURCE_OVER);
return;
@@ -1876,17 +1876,17 @@ DrawTargetD2D1::CreateBrushForPattern(co
samplingBounds = D2D1::RectF(0, 0,
Float(pat->mSurface->GetSize().width),
Float(pat->mSurface->GetSize().height));
} else if (pat->mSurface->GetType() == SurfaceType::D2D1_1_IMAGE) {
samplingBounds = D2DRect(pat->mSamplingRect);
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);
D2D1_EXTEND_MODE yRepeat = D2DExtend(pat->mExtendMode, Axis::Y_AXIS);
mDC->CreateImageBrush(image,
D2D1::ImageBrushProperties(samplingBounds,
xRepeat,
--- a/gfx/2d/DrawTargetSkia.cpp
+++ b/gfx/2d/DrawTargetSkia.cpp
@@ -188,18 +188,18 @@ VerifyRGBXCorners(uint8_t* aData, const
return true;
}
IntRect bounds = CalculateSurfaceBounds(aSize, aBounds, aMatrix);
if (bounds.IsEmpty()) {
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);
const int translation = bounds.y * aStride + bounds.x * pixelSize;
const int topLeft = translation;
const int topRight = topLeft + (width - 1) * pixelSize;
const int bottomLeft = translation + (height - 1) * aStride;
const int bottomRight = bottomLeft + (width - 1) * pixelSize;
@@ -843,41 +843,41 @@ UserSpaceStrokeClip(const IntRect &aDevi
static Rect
ShrinkClippedStrokedRect(const Rect &aStrokedRect, const IntRect &aDeviceClip,
const Matrix &aTransform,
const StrokeOptions &aStrokeOptions)
{
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
// so that the visible dashes stay in the same place.
MarginDouble insetBy = strokedRectDouble - intersection;
insetBy.top = RoundDownToMultiple(insetBy.top, dashPeriodLength);
insetBy.right = RoundDownToMultiple(insetBy.right, dashPeriodLength);
insetBy.bottom = RoundDownToMultiple(insetBy.bottom, dashPeriodLength);
insetBy.left = RoundDownToMultiple(insetBy.left, dashPeriodLength);
strokedRectDouble.Deflate(insetBy);
return Rect(strokedRectDouble.x,
strokedRectDouble.y,
- strokedRectDouble.width,
- strokedRectDouble.height);
+ strokedRectDouble.Width(),
+ strokedRectDouble.Height());
}
void
DrawTargetSkia::StrokeRect(const Rect &aRect,
const Pattern &aPattern,
const StrokeOptions &aStrokeOptions,
const DrawOptions &aOptions)
{
@@ -1564,17 +1564,17 @@ DrawTarget::Draw3DTransformedSurface(Sou
!srcImage->isOpaque() ?
aSurface->GetFormat() : SurfaceFormat::A8R8G8B8_UINT32,
true);
if (!dstSurf) {
return false;
}
std::unique_ptr<SkCanvas> dstCanvas(
SkCanvas::MakeRasterDirect(
- SkImageInfo::Make(xformBounds.width, xformBounds.height,
+ SkImageInfo::Make(xformBounds.Width(), xformBounds.Height(),
GfxFormatToSkiaColorType(dstSurf->GetFormat()),
kPremul_SkAlphaType),
dstSurf->GetData(), dstSurf->Stride()));
if (!dstCanvas) {
return false;
}
// Do the transform.
@@ -1814,17 +1814,17 @@ DrawTargetSkia::CopySurface(SourceSurfac
sk_sp<SkImage> image = GetSkImageForSurface(aSurface);
if (!image) {
return;
}
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()) {
// Keep the xfermode as SOURCE_OVER for opaque bitmaps
// http://code.google.com/p/skia/issues/detail?id=628
paint.setBlendMode(SkBlendMode::kSrc);
}
// drawImage with A8 images ends up doing a mask operation
--- a/gfx/2d/FilterNodeD2D1.cpp
+++ b/gfx/2d/FilterNodeD2D1.cpp
@@ -807,17 +807,17 @@ FilterNodeD2D1::SetAttribute(uint32_t aI
void
FilterNodeD2D1::SetAttribute(uint32_t aIndex, const IntRect &aValue)
{
if (mType == FilterType::TURBULENCE) {
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;
}
UINT32 input = GetD2D1PropForAttribute(mType, aIndex);
MOZ_ASSERT(input < mEffect->GetPropertyCount());
mEffect->SetValue(input, D2D1::RectF(Float(aValue.x), Float(aValue.y),
Float(aValue.XMost()), Float(aValue.YMost())));
--- a/gfx/2d/FilterNodeSoftware.cpp
+++ b/gfx/2d/FilterNodeSoftware.cpp
@@ -213,27 +213,27 @@ FillRectWithPixel(DataSourceSurface *aSu
}
uint8_t* sourcePixelData = DataAtOffset(aSurface, surfMap.GetMappedSurface(), aPixelPos);
uint8_t* data = DataAtOffset(aSurface, surfMap.GetMappedSurface(), aFillRect.TopLeft());
int bpp = BytesPerPixel(aSurface->GetFormat());
// 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);
}
}
static void
FillRectWithVerticallyRepeatingHorizontalStrip(DataSourceSurface *aSurface,
const IntRect &aFillRect,
const IntRect &aSampleRect)
{
@@ -247,23 +247,23 @@ FillRectWithVerticallyRepeatingHorizonta
DataSourceSurface::ScopedMap surfMap(aSurface, DataSourceSurface::READ_WRITE);
if (MOZ2D_WARN_IF(!surfMap.IsMapped())) {
return;
}
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();
}
}
}
static void
FillRectWithHorizontallyRepeatingVerticalStrip(DataSourceSurface *aSurface,
const IntRect &aFillRect,
@@ -279,28 +279,28 @@ FillRectWithHorizontallyRepeatingVertica
DataSourceSurface::ScopedMap surfMap(aSurface, DataSourceSurface::READ_WRITE);
if (MOZ2D_WARN_IF(!surfMap.IsMapped())) {
return;
}
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();
}
}
}
static void
DuplicateEdges(DataSourceSurface* aSurface, const IntRect &aFromRect)
@@ -311,59 +311,59 @@ DuplicateEdges(DataSourceSurface* aSurfa
IntSize size = aSurface->GetSize();
IntRect fill;
IntRect sampleRect;
for (int32_t ix = 0; ix < 3; ix++) {
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);
for (int32_t iy = 0; iy < 3; iy++) {
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);
if (!xIsMiddle && !yIsMiddle) {
// Corner
FillRectWithPixel(aSurface, fill, sampleRect.TopLeft());
}
if (xIsMiddle && !yIsMiddle) {
@@ -376,32 +376,32 @@ DuplicateEdges(DataSourceSurface* aSurfa
}
}
}
}
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
TileSurface(DataSourceSurface* aSource, DataSourceSurface* aTarget, const IntPoint &aOffset)
{
IntRect sourceRect(aOffset, aSource->GetSize());
IntRect targetRect(IntPoint(0, 0), aTarget->GetSize());
IntPoint startIndex = TileIndex(sourceRect, targetRect.TopLeft());
IntPoint endIndex = TileIndex(sourceRect, targetRect.BottomRight());
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;
CopyRect(aSource, aTarget, srcRect, destRect.TopLeft());
}
}
}
@@ -689,17 +689,17 @@ FilterNodeSoftware::GetInputDataSourceSu
const IntRect *aTransparencyPaddedSourceRect)
{
if (aRect.Overflows()) {
return nullptr;
}
#ifdef DEBUG_DUMP_SURFACES
printf("<section><h1>GetInputDataSourceSurface with aRect: %d, %d, %d, %d</h1>\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()) {
gfxDevCrash(LogReason::FilterInputData) << "Invalid data " << inputIndex << " vs. " << NumberOfSetInputs();
return nullptr;
}
if (aRect.IsEmpty()) {
@@ -1142,17 +1142,17 @@ FilterNodeTransformSoftware::Render(cons
surf->GetSize(),
mapping.mStride,
surf->GetFormat());
if (!dt) {
gfxWarning() << "FilterNodeTransformSoftware::Render failed in CreateDrawTargetForData";
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));
dt->Flush();
surf->Unmap();
return surf.forget();
}
@@ -1213,17 +1213,17 @@ FilterNodeMorphologySoftware::SetAttribu
static already_AddRefed<DataSourceSurface>
ApplyMorphology(const IntRect& aSourceRect, DataSourceSurface* aInput,
const IntRect& aDestRect, int32_t rx, int32_t ry,
MorphologyOperator aOperator)
{
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 &&
margin.bottom >= ry && margin.left >= rx, "insufficient margin");
#endif
RefPtr<DataSourceSurface> tmp;
if (rx == 0) {
@@ -1494,30 +1494,30 @@ FilterNodeFloodSoftware::Render(const In
return nullptr;
}
uint8_t* targetData = targetMap.GetData();
int32_t stride = targetMap.GetStride();
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 {
gfxDevCrash(LogReason::FilterInputFormat) << "Bad format in flood render " << (int)format;
return nullptr;
}
return target.forget();
@@ -1550,35 +1550,35 @@ FilterNodeTileSoftware::InputIndex(uint3
}
void
FilterNodeTileSoftware::SetAttribute(uint32_t aIndex,
const IntRect &aSourceRect)
{
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();
}
namespace {
struct CompareIntRects
{
bool operator()(const IntRect& a, const IntRect& b) const
{
if (a.x != b.x) {
return a.x < b.x;
}
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();
}
};
} // namespace
already_AddRefed<DataSourceSurface>
FilterNodeTileSoftware::Render(const IntRect& aRect)
{
@@ -1594,18 +1594,18 @@ FilterNodeTileSoftware::Render(const Int
typedef std::map<IntRect, RefPtr<DataSourceSurface>, CompareIntRects> InputMap;
InputMap inputs;
IntPoint startIndex = TileIndex(mSourceRect, aRect.TopLeft());
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()) {
continue;
}
RefPtr<DataSourceSurface> input;
InputMap::iterator it = inputs.find(srcRect);
@@ -2499,20 +2499,20 @@ FilterNodeConvolveMatrixSoftware::DoRend
MOZ_ASSERT(255.0 * maxResultAbs * factorFromShifts <= INT32_MAX / 2.0, "badly chosen float-to-int scale");
int32_t* intKernel = new int32_t[kernel.size()];
for (size_t i = 0; i < kernel.size(); i++) {
intKernel[i] = NS_lround(kernel[i] * factorFromShifts);
}
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);
}
}
delete[] intKernel;
return target.forget();
@@ -2645,30 +2645,30 @@ FilterNodeDisplacementMapSoftware::Rende
B8G8R8A8_COMPONENT_BYTEOFFSET_B,
B8G8R8A8_COMPONENT_BYTEOFFSET_A };
uint16_t xChannel = channelMap[mChannelX];
uint16_t yChannel = channelMap[mChannelY];
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 +
scaleOver255 * mapData[mapIndex + xChannel] + scaleAdjustment;
int32_t sourceY = y +
scaleOver255 * mapData[mapIndex + yChannel] + scaleAdjustment;
*(uint32_t*)(targetData + targIndex) =
ColorAtPoint(sourceData, sourceStride, sourceX, sourceY);
}
// 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();
}
void
FilterNodeDisplacementMapSoftware::RequestFromInputsForRect(const IntRect &aRect)
{
@@ -2969,17 +2969,17 @@ FilterNodeBlurXYSoftware::Render(const I
IntRect srcRect = InflatedSourceOrDestRect(aRect);
RefPtr<DataSourceSurface> input =
GetInputDataSourceSurface(IN_GAUSSIAN_BLUR_IN, srcRect);
if (!input) {
return nullptr;
}
RefPtr<DataSourceSurface> 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);
if (MOZ2D_WARN_IF(!target)) {
return nullptr;
}
CopyRect(input, target, IntRect(IntPoint(), input->GetSize()), IntPoint());
--- a/gfx/gl/DecomposeIntoNoRepeatTriangles.cpp
+++ b/gfx/gl/DecomposeIntoNoRepeatTriangles.cpp
@@ -105,18 +105,18 @@ DecomposeIntoNoRepeatTriangles(const gfx
// we have the length (1-tl)+(br) that needs to map into 0->1.
// These are only valid if there is wrap involved, they won't be used
// otherwise.
GLfloat xlen = (1.0f - tl[0]) + br[0];
GLfloat ylen = (1.0f - tl[1]) + br[1];
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,
1.0f, 1.0f,
tl[0], tl[1],
br[0], br[1],
aFlipY);
} else if (!xwrap && ywrap) {
--- a/gfx/gl/GLTextureImage.cpp
+++ b/gfx/gl/GLTextureImage.cpp
@@ -354,19 +354,19 @@ gfx::IntRect TiledTextureImage::GetTileR
rect.MoveBy(xPos, yPos);
return rect;
}
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
TiledTextureImage::BindTexture(GLenum aTextureUnit)
{
if (!GetTileCount()) {
return;
}
--- a/gfx/gl/GLUploadHelpers.cpp
+++ b/gfx/gl/GLUploadHelpers.cpp
@@ -501,18 +501,18 @@ UploadImageDataToTexture(GLContext* gl,
const unsigned char* rectData =
aData + DataOffset(rect.TopLeft(), aStride, aFormat);
TexSubImage2DHelper(gl,
aTextureTarget,
0,
rect.x,
rect.y,
- rect.width,
- rect.height,
+ rect.Width(),
+ rect.Height(),
aStride,
pixelSize,
format,
type,
rectData);
}
}
--- a/gfx/layers/Compositor.cpp
+++ b/gfx/layers/Compositor.cpp
@@ -181,37 +181,37 @@ Compositor::DrawDiagnosticsInternal(Diag
static void
UpdateTextureCoordinates(gfx::TexturedTriangle& aTriangle,
const gfx::Rect& aRect,
const gfx::Rect& aIntersection,
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)
{
if (f >= 1.0f) f = 1.0f;
if (f <= 0.0f) f = 0.0f;
};
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);
};
UpdatePoint(aTriangle.p1, aTriangle.textureCoords.p1);
UpdatePoint(aTriangle.p2, aTriangle.textureCoords.p2);
UpdatePoint(aTriangle.p3, aTriangle.textureCoords.p3);
@@ -290,18 +290,18 @@ GenerateTexturedTriangles(const gfx::Pol
for (const gfx::Triangle& triangle : clipped.ToTriangles()) {
const gfx::Rect intersection = rect.Intersect(triangle.BoundingBox());
// Cull completely invisible triangles.
if (intersection.IsEmpty()) {
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.
gfx::TexturedTriangle t(triangle);
UpdateTextureCoordinates(t, rect, intersection, texRect);
texturedTriangles.AppendElement(Move(t));
}
}
@@ -367,32 +367,32 @@ Compositor::SlowDrawRect(const gfx::Rect
// TODO This should draw a rect using a single draw call but since
// this is only used for debugging overlays it's not worth optimizing ATM.
float opacity = 1.0f;
EffectChain effects;
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);
}
void
Compositor::FillRect(const gfx::Rect& aRect, const gfx::Color& aColor,
const gfx::IntRect& aClipRect,
const gfx::Matrix4x4& aTransform)
@@ -448,33 +448,33 @@ DecomposeIntoNoRepeatRects(const gfx::Re
decomposedRectArrayT* aLayerRects,
decomposedRectArrayT* aTextureRects)
{
gfx::Rect texCoordRect = aTexCoordRect;
// 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?");
// Get the top left and bottom right points of the rectangle. Note that
// tl.x/tl.y are within [0,1] but br.x/br.y are within [0,2].
gfx::Point tl = texCoordRect.TopLeft();
gfx::Point br = texCoordRect.BottomRight();
@@ -508,18 +508,18 @@ DecomposeIntoNoRepeatRects(const gfx::Re
// wrap them here as well.
br = gfx::Point(xwrap ? WrapTexCoord(br.x) : br.x,
ywrap ? WrapTexCoord(br.y) : br.y);
// If we wrap around along the x axis, we will draw first from
// 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
// remain consistent going from absolute to relative and back again.
NS_ASSERTION(!xwrap ||
(xmid >= aRect.x &&
xmid <= aRect.XMost() &&
FuzzyEqual((xmid - aRect.x) + (aRect.XMost() - xmid), aRect.XMost() - aRect.x)),
--- a/gfx/layers/D3D9SurfaceImage.cpp
+++ b/gfx/layers/D3D9SurfaceImage.cpp
@@ -168,17 +168,17 @@ D3D9SurfaceImage::AllocateAndCopy(D3D9Re
}
// Copy the image onto the texture, preforming YUV -> RGB conversion if necessary.
RefPtr<IDirect3DSurface9> textureSurface = GetD3D9Surface();
if (!textureSurface) {
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);
mSize = aRegion.Size();
return S_OK;
}
already_AddRefed<IDirect3DSurface9>
--- a/gfx/layers/ImageLayers.cpp
+++ b/gfx/layers/ImageLayers.cpp
@@ -39,21 +39,21 @@ void ImageLayer::ComputeEffectiveTransfo
// This makes our snapping equivalent to what would happen if our content
// was drawn into a PaintedLayer (gfxContext would snap using the local
// transform, then we'd snap again when compositing the PaintedLayer).
mEffectiveTransform =
SnapTransform(local, sourceRect, nullptr) *
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) *
SnapTransformTranslation(aTransformToSurface, nullptr);
} else {
mEffectiveTransformForBuffer = mEffectiveTransform;
}
--- a/gfx/layers/LayerScope.cpp
+++ b/gfx/layers/LayerScope.cpp
@@ -371,18 +371,18 @@ LayerScopeManager gLayerScopeManager;
* 1. DumpRect
* 2. DumpFilter
*/
template<typename T>
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,
const SamplingFilter aSamplingFilter)
{
switch (aSamplingFilter) {
case SamplingFilter::GOOD:
aTexturePacket->set_mfilter(TexturePacket::GOOD);
--- a/gfx/layers/LayerTreeInvalidation.cpp
+++ b/gfx/layers/LayerTreeInvalidation.cpp
@@ -78,17 +78,17 @@ GetTransformForInvalidation(Layer* aLaye
static IntRect
TransformRect(const IntRect& aRect, const Matrix4x4& aTransform)
{
if (aRect.IsEmpty()) {
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();
IntRect intRect;
if (!gfxUtils::GfxRectToIntRect(ThebesRect(rect), &intRect)) {
return IntRect();
}
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -520,17 +520,17 @@ Layer::CalculateScissorRect(const Render
RenderTargetIntRect scissor = clipRect;
if (!container->UseIntermediateSurface()) {
gfx::Matrix matrix;
DebugOnly<bool> is2D = container->GetEffectiveTransform().Is2D(&matrix);
// 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;
if (!gfxUtils::GfxRectToIntRect(trScissor, &tmp)) {
return RenderTargetIntRect(currentClip.TopLeft(), RenderTargetIntSize(0, 0));
}
scissor = ViewAs<RenderTargetPixel>(tmp);
@@ -1878,18 +1878,18 @@ DumpTransform(layerscope::LayersPacket::
// The static helper function sets the IntRect into the packet
template <typename T, typename Sub, typename Point, typename SizeT, typename MarginT>
static void
DumpRect(layerscope::LayersPacket::Layer::Rect* aLayerRect,
const BaseRect<T, Sub, Point, SizeT, MarginT>& aRect)
{
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
static void
DumpRegion(layerscope::LayersPacket::Layer::Region* aLayerRegion, const nsIntRegion& aRegion)
{
for (auto iter = aRegion.RectIter(); !iter.Done(); iter.Next()) {
DumpRect(aLayerRegion->add_r(), iter.Get());
@@ -2456,29 +2456,29 @@ SetAntialiasingFlags(Layer* aLayer, Draw
bool permitSubpixelAA = !(aLayer->GetContentFlags() & Layer::CONTENT_DISABLE_SUBPIXEL_AA);
if (aTarget->IsCurrentGroupOpaque()) {
aTarget->SetPermitSubpixelAA(permitSubpixelAA);
return;
}
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);
permitSubpixelAA &= !(aLayer->GetContentFlags() & Layer::CONTENT_COMPONENT_ALPHA) ||
aTarget->GetOpaqueRect().Contains(intTransformedBounds);
aTarget->SetPermitSubpixelAA(permitSubpixelAA);
}
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)
: Layer(aManager, aImplData)
{}
TextLayer::~TextLayer()
{}
--- a/gfx/layers/LayersHelpers.cpp
+++ b/gfx/layers/LayersHelpers.cpp
@@ -23,37 +23,37 @@ ComputeBackdropCopyRect(const gfx::Rect&
IntSize rtSize = aRenderTargetRect.Size();
gfx::IntRect renderBounds(0, 0, rtSize.width, rtSize.height);
renderBounds.IntersectRect(renderBounds, aClipRect);
renderBounds.MoveBy(rtOffset);
// 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.
IntRect result;
dest.RoundOut();
dest.ToIntRect(&result);
// Create a transform from adjusted clip space to render target space,
// translate it for the backdrop rect, then transform it into the backdrop's
// uv-space.
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;
}
} // namespace layers
} // namespace mozilla
--- a/gfx/layers/LayersLogging.cpp
+++ b/gfx/layers/LayersLogging.cpp
@@ -60,17 +60,17 @@ AppendToString(std::stringstream& aStrea
void
AppendToString(std::stringstream& aStream, const nsRect& r,
const char* pfx, const char* sfx)
{
aStream << pfx;
aStream << nsPrintfCString(
"(x=%d, y=%d, w=%d, h=%d)",
- r.x, r.y, r.width, r.height).get();
+ r.x, r.y, r.Width(), r.Height()).get();
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const wr::ColorF& c,
const char* pfx, const char* sfx)
{
aStream << pfx;
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -36,38 +36,38 @@ using namespace gfx;
namespace layers {
IntRect
RotatedBuffer::GetQuadrantRectangle(XSide aXSide, YSide aYSide) const
{
// quadrantTranslation is the amount we translate the top-left
// of the quadrant by to get coordinates relative to the layer
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;
}
Rect
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;
}
/**
* @param aXSide LEFT means we draw from the left side of the buffer (which
* is drawn on the right side of mBufferRect). RIGHT means we draw from
* the right side of the buffer (which is drawn on the left side of
@@ -410,17 +410,17 @@ static IntRect
ComputeBufferRect(const IntRect& aRequestedRect)
{
IntRect rect(aRequestedRect);
// Set a minimum width to guarantee a minimum size of buffers we
// allocate (and work around problems on some platforms with smaller
// dimensions). 64 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;
}
void
RotatedContentBuffer::FlushBuffers()
{
if (mDTBuffer) {
mDTBuffer->Flush();
@@ -582,18 +582,18 @@ RotatedContentBuffer::BeginPaint(Painted
}
IntRect keepArea;
if (keepArea.IntersectRect(destBufferRect, mBufferRect)) {
// Set mBufferRotation so that the pixels currently in mDTBuffer
// will still be rendered in the right place when mBufferRect
// changes to destBufferRect.
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;
int32_t yBoundary = destBufferRect.YMost() - newRotation.y;
bool drawWrapsBuffer = (drawBounds.x < xBoundary && xBoundary < drawBounds.XMost()) ||
(drawBounds.y < yBoundary && yBoundary < drawBounds.YMost());
if ((drawWrapsBuffer && !(aFlags & PAINT_CAN_DRAW_ROTATED)) ||
(newRotation != IntPoint(0,0) && !canHaveRotation)) {
@@ -657,18 +657,18 @@ RotatedContentBuffer::BeginPaint(Painted
}
if (!result.mDidSelfCopy) {
destBufferRect = ComputeBufferRect(neededRegion.GetBounds());
CreateBuffer(result.mContentType, destBufferRect, bufferFlags,
&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;
}
}
}
} else {
mBufferRect = destBufferRect;
mBufferRotation = newRotation;
@@ -681,18 +681,18 @@ RotatedContentBuffer::BeginPaint(Painted
mBufferRotation = IntPoint(0,0);
}
} else {
// The buffer's not big enough, so allocate a new one
CreateBuffer(result.mContentType, destBufferRect, bufferFlags,
&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;
}
}
NS_ASSERTION(!(aFlags & PAINT_WILL_RESAMPLE) || destBufferRect == neededRegion.GetBounds(),
"If we're resampling, we need to validate the entire buffer");
@@ -783,27 +783,27 @@ RotatedContentBuffer::PrepareDrawTargetF
!whiteTarget || !whiteTarget->IsValid()) {
// This can happen in release builds if allocating one of the two buffers
// failed. This in turn can happen if unreasonably large textures are
// requested.
return false;
}
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 &&
target->IsValid()) {
// 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()));
}
}
return true;
}
nsIntRegion
RotatedContentBuffer::ExpandDrawRegion(PaintState& aPaintState,
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -1398,19 +1398,19 @@ nsEventStatus AsyncPanZoomController::On
// When we zoom in with focus, we can zoom too much towards the boundaries
// that we actually go over them. These are the needed displacements along
// either axis such that we don't overscroll the boundaries when zooming.
CSSPoint neededDisplacement;
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;
}
bool doScale = (spanRatio > 1.0 && userZoom < realMaxZoom) ||
(spanRatio < 1.0 && userZoom > realMinZoom);
if (!mZoomConstraints.mAllowZoom) {
@@ -3059,22 +3059,22 @@ ExpandDisplayPortToDangerZone(const CSSS
* other axis, while maintaining total displayport area.
*/
static void
RedistributeDisplayPortExcess(CSSSize& aDisplayPortSize,
const CSSRect& aScrollableRect)
{
// 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();
}
}
/* static */
const ScreenMargin AsyncPanZoomController::CalculatePendingDisplayPort(
const FrameMetrics& aFrameMetrics,
const ParentLayerPoint& aVelocity)
{
@@ -3114,24 +3114,24 @@ const ScreenMargin AsyncPanZoomControlle
// Offset the displayport, depending on how fast we're moving and the
// estimated time it takes to paint, to try to minimise checkerboarding.
float paintFactor = kDefaultEstimatedPaintDurationMs;
displayPort.MoveBy(velocity * paintFactor * gfxPrefs::APZVelocityBias());
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();
}
void AsyncPanZoomController::ScheduleComposite() {
if (mCompositorController) {
mCompositorController->ScheduleRenderOnCompositorThread();
}
@@ -3261,20 +3261,20 @@ AsyncPanZoomController::RequestContentRe
fabsf(marginDelta.right) < EPSILON &&
fabsf(marginDelta.bottom) < EPSILON &&
fabsf(mLastPaintRequestMetrics.GetScrollOffset().x -
aFrameMetrics.GetScrollOffset().x) < EPSILON &&
fabsf(mLastPaintRequestMetrics.GetScrollOffset().y -
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() ==
mLastPaintRequestMetrics.GetScrollUpdateType()) {
return;
}
APZC_LOG_FM(aFrameMetrics, "%p requesting content repaint", this);
@@ -3705,22 +3705,22 @@ void AsyncPanZoomController::NotifyLayer
CheckerboardEvent::PaintedCriticalDisplayPort,
aLayerMetrics.GetCriticalDisplayPort() + aLayerMetrics.GetScrollOffset());
}
}
}
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;
}
mFrameMetrics.SetViewport(aLayerMetrics.GetViewport());
}
// If the layers update was not triggered by our own repaint request, then
// we want to take the new scroll offset. Check the scroll generation as well
@@ -3771,17 +3771,17 @@ void AsyncPanZoomController::NotifyLayer
APZC_LOG("%p detected non-empty margins which probably need updating\n", this);
needContentRepaint = true;
}
} else {
// If we're not taking the aLayerMetrics wholesale we still need to pull
// 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
// already included in our zoom; however, other components of the
// cumulative resolution (a parent document's pres-shell resolution, or
// the css-driven resolution) may have changed, and we need to update
// our zoom to reflect that. Note that we can't just take
// aLayerMetrics.mZoom because the APZ may have additional async zoom
@@ -3932,25 +3932,25 @@ void AsyncPanZoomController::ZoomToRect(
CSSToParentLayerScale targetZoom;
// The minimum zoom to prevent over-zoom-out.
// If the zoom factor is lower than this (i.e. we are zoomed more into the page),
// then the CSS content rect, in layers pixels, will be smaller than the
// 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
// requested that we zoom out.
// 2. currentZoom is equal to mZoomConstraints.mMaxZoom and user still double-tapping it
// 3. currentZoom is equal to localMinZoom and user still double-tapping it
// Treat these three cases as a request to zoom out as much as possible.
bool zoomOut;
@@ -3961,26 +3961,26 @@ void AsyncPanZoomController::ZoomToRect(
(currentZoom == localMaxZoom && targetZoom >= localMaxZoom) ||
(currentZoom == localMinZoom && targetZoom <= localMinZoom);
}
if (zoomOut) {
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);
FrameMetrics endZoomToMetrics = mFrameMetrics;
if (aFlags & PAN_INTO_VIEW_ONLY) {
targetZoom = currentZoom;
} else if(aFlags & ONLY_ZOOM_TO_DEFAULT_SCALE) {
CSSToParentLayerScale zoomAtDefaultScale =
@@ -3995,31 +3995,31 @@ void AsyncPanZoomController::ZoomToRect(
}
}
endZoomToMetrics.SetZoom(CSSToParentLayerScale2D(targetZoom));
// Adjust the zoomToRect to a sensible position to prevent overscrolling.
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;
}
}
// 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;
}
endZoomToMetrics.SetScrollOffset(aRect.TopLeft());
StartAnimation(new ZoomAnimation(
mFrameMetrics.GetScrollOffset(),
mFrameMetrics.GetZoom(),
--- a/gfx/layers/apz/src/Axis.cpp
+++ b/gfx/layers/apz/src/Axis.cpp
@@ -500,17 +500,17 @@ AxisX::AxisX(AsyncPanZoomController* aAs
ParentLayerCoord AxisX::GetPointOffset(const ParentLayerPoint& aPoint) const
{
return aPoint.x;
}
ParentLayerCoord AxisX::GetRectLength(const ParentLayerRect& aRect) const
{
- return aRect.width;
+ return aRect.Width();
}
ParentLayerCoord AxisX::GetRectOffset(const ParentLayerRect& aRect) const
{
return aRect.x;
}
CSSToParentLayerScale AxisX::GetScaleForAxis(const CSSToParentLayerScale2D& aScale) const
@@ -536,17 +536,17 @@ AxisY::AxisY(AsyncPanZoomController* aAs
ParentLayerCoord AxisY::GetPointOffset(const ParentLayerPoint& aPoint) const
{
return aPoint.y;
}
ParentLayerCoord AxisY::GetRectLength(const ParentLayerRect& aRect) const
{
- return aRect.height;
+ return aRect.Height();
}
ParentLayerCoord AxisY::GetRectOffset(const ParentLayerRect& aRect) const
{
return aRect.y;
}
CSSToParentLayerScale AxisY::GetScaleForAxis(const CSSToParentLayerScale2D& aScale) const
--- a/gfx/layers/apz/src/CheckerboardEvent.cpp
+++ b/gfx/layers/apz/src/CheckerboardEvent.cpp
@@ -109,18 +109,18 @@ CheckerboardEvent::LogInfo(RendertracePr
// and will move to about:checkerboard in bug 1238042. The format is not
// formally specced, but an informal description can be found at
// https://github.com/staktrace/rendertrace/blob/master/index.html#L30
mRendertraceInfo << "RENDERTRACE "
<< (aTimestamp - mOriginTime).ToMilliseconds() << " rect "
<< sColors[aProperty] << " "
<< aRect.x << " "
<< aRect.y << " "
- << aRect.width << " "
- << aRect.height << " "
+ << aRect.Width() << " "
+ << aRect.Height() << " "
<< "// " << sDescriptions[aProperty]
<< aExtraInfo << std::endl;
}
bool
CheckerboardEvent::RecordFrameInfo(uint32_t aCssPixelsCheckerboarded)
{
TimeStamp sampleTime = TimeStamp::Now();
--- a/gfx/layers/apz/util/APZCCallbackHelper.cpp
+++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp
@@ -205,18 +205,18 @@ SetDisplayPortMargins(nsIPresShell* aPre
nsLayoutUtils::SetDisplayPortMargins(aContent, aPresShell, margins, 0);
if (!hadDisplayPort) {
nsLayoutUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(
aContent->GetPrimaryFrame(), nsLayoutUtils::RepaintMode::Repaint);
}
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);
}
static already_AddRefed<nsIPresShell>
GetPresShell(const nsIContent* aContent)
{
nsCOMPtr<nsIPresShell> result;
if (nsIDocument* doc = aContent->GetComposedDoc()) {
--- a/gfx/layers/apz/util/DoubleTapToZoom.cpp
+++ b/gfx/layers/apz/util/DoubleTapToZoom.cpp
@@ -72,22 +72,22 @@ ShouldZoomToElement(const nsCOMPtr<dom::
static bool
IsRectZoomedIn(const CSSRect& aRect, const CSSRect& aCompositedArea)
{
// This functions checks to see if the area of the rect visible in the
// 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);
}
CSSRect
CalculateRectToZoomTo(const nsCOMPtr<nsIDocument>& aRootContentDocument,
const CSSPoint& aPoint)
{
@@ -124,37 +124,37 @@ CalculateRectToZoomTo(const nsCOMPtr<nsI
CSSRect compositedArea(metrics.GetScrollOffset(), metrics.CalculateCompositedSizeInCssPixels());
const CSSCoord margin = 15;
CSSRect rect = nsLayoutUtils::GetBoundingContentRect(element, rootScrollFrame);
// If the element is taller than the visible area of the page scale
// 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.
if (IsRectZoomedIn(rect, compositedArea)) {
return zoomOut;
}
CSSRect rounded(rect);
@@ -162,17 +162,17 @@ CalculateRectToZoomTo(const nsCOMPtr<nsI
// If the block we're zooming to is really tall, and the user double-tapped
// more than a screenful of height from the top of it, then adjust the
// y-coordinate so that we center the actual point the user double-tapped
// upon. This prevents flying to the top of the page when double-tapping
// 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;
}
}
}
--- a/gfx/layers/basic/BasicCanvasLayer.cpp
+++ b/gfx/layers/basic/BasicCanvasLayer.cpp
@@ -53,22 +53,22 @@ BasicCanvasLayer::Paint(DrawTarget* aDT,
if (!surface) {
return;
}
Matrix oldTM;
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);
if (canvasRenderer->NeedsYFlip()) {
aDT->SetTransform(oldTM);
}
--- a/gfx/layers/basic/BasicColorLayer.cpp
+++ b/gfx/layers/basic/BasicColorLayer.cpp
@@ -48,17 +48,17 @@ public:
virtual void Paint(DrawTarget* aDT,
const gfx::Point& aDeviceOffset,
Layer* aMaskLayer) override
{
if (IsHidden()) {
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.
aDT->PushClipRect(snapped);
FillRectWithMask(aDT, aDeviceOffset, snapped, mColor,
DrawOptions(GetEffectiveOpacity(), GetEffectiveOperator(this)),
aMaskLayer);
aDT->PopClip();
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -253,19 +253,19 @@ BasicCompositor::GetTextureFactoryIdenti
XRE_GetProcessType(),
GetMaxTextureSize());
return ident;
}
already_AddRefed<CompositingRenderTarget>
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;
}
RefPtr<DrawTarget> target = mDrawTarget->CreateSimilarDrawTarget(aRect.Size(), SurfaceFormat::B8G8R8A8);
if (!target) {
return nullptr;
}
@@ -283,19 +283,19 @@ BasicCompositor::CreateRenderTargetFromS
MOZ_CRASH("GFX: Shouldn't be called!");
return nullptr;
}
already_AddRefed<CompositingRenderTarget>
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;
}
RefPtr<BasicCompositingRenderTarget> rt;
IntRect rect = aRect.ToUnknownRect();
if (aBufferMode != BufferMode::BUFFER_NONE) {
RefPtr<DrawTarget> target = mWidget->GetBackBufferDrawTarget(mDrawTarget, aRect, aClearRect);
@@ -456,18 +456,18 @@ DrawSurfaceWithTextureCoords(gfx::DrawTa
if (!aSource) {
gfxWarning() << "DrawSurfaceWithTextureCoords problem " << gfx::hexa(aSource) << " and " << gfx::hexa(aMask);
return;
}
// 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.
sourceRect.Round();
// Compute a transform that maps sourceRect to aDestRect.
Matrix matrix =
gfxUtils::TransformRectToRect(sourceRect,
@@ -553,20 +553,20 @@ AttemptVideoScale(TextureSourceBasic* aS
fillRect = fillRect.Intersect(IntRect(IntPoint(0, 0), aDest->GetSize()));
IntPoint offset = fillRect.TopLeft() - dstRect.TopLeft();
RefPtr<DataSourceSurface> srcSource = aSource->GetSurface(aDest)->GetDataSurface();
DataSourceSurface::ScopedMap mapSrc(srcSource, DataSourceSurface::READ);
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;
} else
#endif // MOZILLA_SSE_HAVE_CPUID_DETECTION
return false;
}
@@ -837,17 +837,17 @@ BasicCompositor::DrawGeometry(const Geom
dest->Flush();
RefPtr<SourceSurface> destSnapshot = dest->Snapshot();
SetupMask(aEffectChain, buffer, offset, sourceMask, maskTransform);
if (sourceMask) {
RefPtr<DrawTarget> 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 &&
transformDT->Draw3DTransformedSurface(destSnapshot, new3DTransform)) {
RefPtr<SourceSurface> transformSnapshot = transformDT->Snapshot();
// Transform the source by it's normal transform, and then the inverse
// of the mask transform so that it's in the mask's untransformed
@@ -896,17 +896,17 @@ BasicCompositor::BeginFrame(const nsIntR
{
if (mIsPendingEndRemoteDrawing) {
// Force to end previous remote drawing.
TryToEndRemoteDrawing(/* aForceToEnd */ true);
MOZ_ASSERT(!mIsPendingEndRemoteDrawing);
}
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.
invalidRegionSafe.And(
LayoutDeviceIntRegion::FromUnknownRegion(aInvalidRegion), intRect);
mInvalidRegion = invalidRegionSafe;
mInvalidRect = mInvalidRegion.GetBounds();
@@ -1048,17 +1048,17 @@ BasicCompositor::TryToEndRemoteDrawing(b
nsIntPoint offset = mTarget ? mTargetBounds.TopLeft() : nsIntPoint();
// The source DrawTarget is clipped to the invalidation region, so we have
// to copy the individual rectangles in the region or else we'll draw blank
// pixels.
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);
}
}
if (aForceToEnd || !mTarget) {
mWidget->EndRemoteDrawingInRegion(mDrawTarget, mInvalidRegion);
}
--- a/gfx/layers/basic/BasicLayerManager.cpp
+++ b/gfx/layers/basic/BasicLayerManager.cpp
@@ -57,17 +57,17 @@ using namespace mozilla::gfx;
* Clips to the smallest device-pixel-aligned rectangle containing aRect
* in user space.
* Returns true if the clip is "perfect", i.e. we actually clipped exactly to
* aRect.
*/
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();
gfxMatrix currentMatrix = aContext->CurrentMatrix();
aContext->SetMatrix(gfxMatrix());
aContext->NewPath();
aContext->Rectangle(deviceRect);
aContext->Clip();
@@ -265,17 +265,17 @@ public:
// Try to annotate currentSurface with a region of pixels that have been
// (or will be) painted opaque, if no such region is currently set.
if (targetOpaqueRect.IsEmpty() && visibleRegion.GetNumRects() == 1 &&
(mLayer->GetContentFlags() & Layer::CONTENT_OPAQUE) &&
!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)) {
mTarget->GetDrawTarget()->SetOpaqueRect(intOpaqueRect);
mPushedOpaqueRect = true;
}
}
}
@@ -369,17 +369,17 @@ BasicLayerManager::BeginTransactionWithT
mTarget = aTarget;
return true;
}
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));
}
/**
* This function assumes that GetEffectiveTransform transforms
* all layers to the same coordinate system (the "root coordinate system").
* It can't be used as is by accelerated layers because of intermediate surfaces.
@@ -619,17 +619,17 @@ BasicLayerManager::EndTransactionInterna
ApplyDoubleBuffering(mRoot, clipRect);
}
}
PaintLayer(mTarget, mRoot, aCallback, aCallbackData);
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) {
FlashWidgetUpdateArea(mTarget);
}
RecordFrame();
if (!mTransactionIncomplete) {
@@ -796,17 +796,17 @@ InstallLayerClipPreserves3D(gfxContext*
gfxDevCrash(LogReason::CannotDraw3D) << "GFX: We should not have a 3D transform that CanDraw2D() is false!";
}
gfxMatrix oldTransform = aTarget->CurrentMatrix();
transform *= ToMatrix(oldTransform);
aTarget->SetMatrix(ThebesMatrix(transform));
aTarget->NewPath();
aTarget->SnappedRectangle(gfxRect(clipRect->x, clipRect->y,
- clipRect->width, clipRect->height));
+ clipRect->Width(), clipRect->Height()));
aTarget->Clip();
aTarget->SetMatrix(oldTransform);
}
void
BasicLayerManager::PaintLayer(gfxContext* aTarget,
Layer* aLayer,
@@ -901,17 +901,17 @@ BasicLayerManager::PaintLayer(gfxContext
if (!needsGroup && container) {
PaintSelfOrChildren(paintLayerContext, aTarget);
return;
}
IntRect bounds = visibleRegion.GetBounds();
// DrawTarget without the 3D transform applied:
RefPtr<DrawTarget> untransformedDT =
- gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(IntSize(bounds.width, bounds.height),
+ gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(IntSize(bounds.Width(), bounds.Height()),
SurfaceFormat::B8G8R8A8);
if (!untransformedDT || !untransformedDT->IsValid()) {
return;
}
untransformedDT->SetTransform(Matrix::Translation(-Point(bounds.x, bounds.y)));
RefPtr<gfxContext> groupTarget =
gfxContext::CreatePreservingTransformOrNull(untransformedDT);
@@ -934,17 +934,17 @@ BasicLayerManager::PaintLayer(gfxContext
effectiveTransform.TransformAndClipBounds(Rect(bounds),
ToRect(aTarget->GetClipExtents()));
xformBounds.RoundOut();
effectiveTransform.PostTranslate(-xformBounds.x, -xformBounds.y, 0);
effectiveTransform.PreTranslate(bounds.x, bounds.y, 0);
RefPtr<SourceSurface> untransformedSurf = untransformedDT->Snapshot();
RefPtr<DrawTarget> xformDT =
- untransformedDT->CreateSimilarDrawTarget(IntSize::Truncate(xformBounds.width, xformBounds.height),
+ untransformedDT->CreateSimilarDrawTarget(IntSize::Truncate(xformBounds.Width(), xformBounds.Height()),
SurfaceFormat::B8G8R8A8);
RefPtr<SourceSurface> xformSurf;
if(xformDT && untransformedSurf &&
xformDT->Draw3DTransformedSurface(untransformedSurf, effectiveTransform)) {
xformSurf = xformDT->Snapshot();
}
if (xformSurf) {
--- a/gfx/layers/basic/BasicTextLayer.cpp
+++ b/gfx/layers/basic/BasicTextLayer.cpp
@@ -49,17 +49,17 @@ public:
virtual void Paint(DrawTarget* aDT,
const gfx::Point& aDeviceOffset,
Layer* aMaskLayer) override
{
if (IsHidden() || !mFont) {
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
// don't check if there's an opaque background color behind them.
// We should fix this before using them in production.
aDT->SetPermitSubpixelAA(false);
for (GlyphArray& g : mGlyphs) {
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -627,18 +627,18 @@ ClientLayerManager::MakeSnapshotIfRequir
// Make a copy of |inSnapshot| because the call to send it over IPC
// will call forget() on the Shmem inside, and zero it out.
SurfaceDescriptor outSnapshot = inSnapshot;
if (remoteRenderer->SendMakeSnapshot(inSnapshot, bounds)) {
RefPtr<DataSourceSurface> 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(),
mTargetRotation);
gfx::Matrix oldMatrix = dt->GetTransform();
dt->SetTransform(rotate * oldMatrix);
dt->DrawSurface(surf, dstRect, srcRect,
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -132,17 +132,17 @@ ContentClientBasic::CreateBuffer(Content
RefPtr<gfx::DrawTarget>* aBlackDT,
RefPtr<gfx::DrawTarget>* aWhiteDT)
{
MOZ_ASSERT(!(aFlags & BUFFER_COMPONENT_ALPHA));
if (aFlags & BUFFER_COMPONENT_ALPHA) {
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)) {
RefPtr<gfxASurface> surf =
new gfxWindowsSurface(size, aType == gfxContentType::COLOR ? gfxImageFormat::X8R8G8B8_UINT32 :
gfxImageFormat::A8R8G8B8_UINT32);
*aBlackDT = gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(surf, size);
@@ -322,17 +322,17 @@ ContentClientRemoteBuffer::BuildTextureC
MOZ_ASSERT(!mIsNewBuffer,
"Bad! Did we create a buffer twice without painting?");
mIsNewBuffer = true;
DestroyBuffers();
mSurfaceFormat = aFormat;
- mSize = IntSize(aRect.width, aRect.height);
+ mSize = IntSize(aRect.Width(), aRect.Height());
mTextureFlags = TextureFlagsForRotatedContentBufferFlags(aFlags);
if (aFlags & BUFFER_COMPONENT_ALPHA) {
mTextureFlags |= TextureFlags::COMPONENT_ALPHA;
}
CreateBackBuffer(mBufferRect);
}
@@ -620,18 +620,18 @@ ContentClientDoubleBuffered::FinalizeFra
if (!mFrontClient) {
return;
}
MOZ_LAYERS_LOG(("BasicShadowableThebes(%p): reading back <x=%d,y=%d,w=%d,h=%d>",
this,
mFrontUpdatedRegion.GetBounds().x,
mFrontUpdatedRegion.GetBounds().y,
- mFrontUpdatedRegion.GetBounds().width,
- mFrontUpdatedRegion.GetBounds().height));
+ mFrontUpdatedRegion.GetBounds().Width(),
+ mFrontUpdatedRegion.GetBounds().Height()));
mFrontAndBackBufferDiffer = false;
nsIntRegion updateRegion = mFrontUpdatedRegion;
if (mDidSelfCopy) {
mDidSelfCopy = false;
updateRegion = mBufferRect;
}
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -201,18 +201,18 @@ SharedFrameMetricsHelper::UpdateFromComp
// Never abort drawing if we can't be sure we've sent a more recent
// display-port. If we abort updating when we shouldn't, we can end up
// with blank regions on the screen and we open up the risk of entering
// an endless updating cycle.
if (fabsf(contentMetrics.GetScrollOffset().x - compositorMetrics.GetScrollOffset().x) <= 2 &&
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;
}
// When not a low precision pass and the page is in danger of checker boarding
// abort update.
if (!aLowPrecision && !mProgressiveUpdateWasInDanger) {
bool scrollUpdatePending = contentMetrics.GetScrollOffsetUpdated() &&
contentMetrics.GetScrollGeneration() != compositorMetrics.GetScrollGeneration();
@@ -517,17 +517,17 @@ TileClient::ValidateBackBufferFromFront(
// Just redraw it all.
return;
}
// Copy the bounding rect of regionToCopy. As tiles are quite small, it
// is unlikely that we'd save much by copying each individual rect of the
// region, but we can reevaluate this if it becomes an issue.
const 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) {
MOZ_ASSERT(mFrontBufferOnWhite);
CopyFrontToBack(mFrontBufferOnWhite, mBackBufferOnWhite, gfxRectToCopy);
}
mInvalidBack.SetEmpty();
@@ -918,19 +918,19 @@ void ClientMultiTiledLayerBuffer::Update
{
const IntSize scaledTileSize = GetScaledTileSize();
const gfx::IntRect newBounds = newValidRegion.GetBounds();
const TilesPlacement oldTiles = mTiles;
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;
nsTArray<TileClient> oldRetainedTiles;
mRetainedTiles.SwapElements(oldRetainedTiles);
mRetainedTiles.SetLength(newTileCount);
@@ -1101,18 +1101,18 @@ ClientMultiTiledLayerBuffer::ValidateTil
mMoz2DTiles.push_back(moz2DTile);
mTilingOrigin.x = std::min(mTilingOrigin.x, moz2DTile.mTileOrigin.x);
mTilingOrigin.y = std::min(mTilingOrigin.y, moz2DTile.mTileOrigin.y);
for (auto iter = aDirtyRegion.RectIter(); !iter.Done(); iter.Next()) {
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
aTile.mInvalidFront.Or(aTile.mInvalidFront, IntRect::RoundOut(drawRect));
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
dt->FillRect(drawRect, ColorPattern(Color(0.0, 0.0, 0.0, 1.0)));
dtOnWhite->FillRect(drawRect, ColorPattern(Color(1.0, 1.0, 1.0, 1.0)));
--- a/gfx/layers/composite/AsyncCompositionManager.cpp
+++ b/gfx/layers/composite/AsyncCompositionManager.cpp
@@ -60,17 +60,17 @@ IsSameDimension(dom::ScreenOrientationIn
bool isO1portrait = (o1 == dom::eScreenOrientation_PortraitPrimary || o1 == dom::eScreenOrientation_PortraitSecondary);
bool isO2portrait = (o2 == dom::eScreenOrientation_PortraitPrimary || o2 == dom::eScreenOrientation_PortraitSecondary);
return !(isO1portrait ^ isO2portrait);
}
static bool
ContentMightReflowOnOrientationChange(const IntRect& rect)
{
- return rect.width != rect.height;
+ return rect.Width() != rect.Height();
}
AsyncCompositionManager::AsyncCompositionManager(CompositorBridgeParent* aParent,
HostLayerManager* aManager)
: mLayerManager(aManager)
, mIsFirstPaint(true)
, mLayersUpdated(false)
, mReadyForCompose(true)
--- a/gfx/layers/composite/ContainerLayerComposite.cpp
+++ b/gfx/layers/composite/ContainerLayerComposite.cpp
@@ -36,19 +36,19 @@
#include <vector>
#include "GeckoProfiler.h" // for GeckoProfiler
#include "ProfilerMarkerPayload.h" // for LayerTranslationMarkerPayload
#define CULLING_LOG(...)
// #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 {
using namespace gfx;
static void
DrawLayerInfo(const RenderTargetIntRect& aClipRect,
@@ -62,17 +62,17 @@ DrawLayerInfo(const RenderTargetIntRect&
return;
}
std::stringstream ss;
aLayer->PrintInfo(ss, "");
LayerIntRegion visibleRegion = aLayer->GetVisibleRegion();
- uint32_t maxWidth = std::min<uint32_t>(visibleRegion.GetBounds().width, 500);
+ uint32_t maxWidth = std::min<uint32_t>(visibleRegion.GetBounds().Width(), 500);
IntPoint topLeft = visibleRegion.ToUnknownRegion().GetBounds().TopLeft();
aManager->GetTextRenderer()->RenderText(
aManager->GetCompositor(),
ss.str().c_str(),
topLeft,
aLayer->GetEffectiveTransform(), 16,
maxWidth);
@@ -81,18 +81,18 @@ DrawLayerInfo(const RenderTargetIntRect&
static void
PrintUniformityInfo(Layer* aLayer)
{
if (!profiler_is_active()) {
return;
}
// 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;
}
Matrix4x4 transform = aLayer->AsHostLayer()->GetShadowBaseTransform();
if (!transform.Is2D()) {
return;
}
@@ -428,17 +428,17 @@ RenderLayers(ContainerT* aContainer, Lay
if (layerToRender->HasLayerBeenComposited()) {
// Composer2D will compose this layer so skip GPU composition
// this time. The flag will be reset for the next composition phase
// at the beginning of LayerManagerComposite::Rener().
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));
}
} else {
// Since we force an intermediate surface for nested 3D contexts,
// aGeometry and childGeometry are both in the same coordinate space.
Maybe<gfx::Polygon> geometry =
SelectLayerGeometry(aGeometry, childGeometry);
@@ -528,17 +528,17 @@ CreateOrRecycleTarget(ContainerT* aConta
template<class ContainerT> RefPtr<CompositingRenderTarget>
CreateTemporaryTargetAndCopyFromBackground(ContainerT* aContainer,
LayerManagerComposite* aManager)
{
Compositor* compositor = aManager->GetCompositor();
gfx::IntRect visibleRect = aContainer->GetLocalVisibleRegion().ToUnknownRegion().GetBounds();
RefPtr<CompositingRenderTarget> 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);
gfx::Matrix4x4 transform = aContainer->GetEffectiveTransform();
DebugOnly<gfx::Matrix> transform2d;
MOZ_ASSERT(transform.Is2D(&transform2d) && !gfx::ThebesMatrix(transform2d).HasNonIntegerTranslation());
sourcePoint += gfx::IntPoint::Truncate(transform._41, transform._42);
--- a/gfx/layers/composite/ContentHost.cpp
+++ b/gfx/layers/composite/ContentHost.cpp
@@ -170,22 +170,22 @@ ContentHostTexture::Composite(Compositor
if (tileScreenRect.IsEmpty())
continue;
tileRegionRect = regionRect.Intersect(currentTileRect);
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);
if (usingTiles) {
DiagnosticFlags diagnostics = DiagnosticFlags::CONTENT | DiagnosticFlags::BIGIMAGE;
if (iterOnWhite) {
diagnostics |= DiagnosticFlags::COMPONENT_ALPHA;
@@ -354,18 +354,18 @@ ContentHostSingleBuffered::UpdateThebes(
if (mReceivedNewHost) {
destRegion.Or(destRegion, aOldValidRegionBack);
mReceivedNewHost = false;
}
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;
}
// destRegion is now in logical coordinates relative to the buffer, but we
// need to account for rotation. We do that by moving the region to the
// rotation offset and then wrapping any pixels that extend off the
// bottom/right edges.
@@ -376,21 +376,21 @@ ContentHostSingleBuffered::UpdateThebes(
IntSize bufferSize = aData.rect().Size();
// Select only the pixels that are still within the buffer.
nsIntRegion finalRegion;
finalRegion.And(IntRect(IntPoint(), bufferSize), destRegion);
// For each of the overlap areas (right, bottom-right, bottom), select those
// pixels and wrap them around to the opposite edge of the buffer rect.
- 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) {
mTextureHostOnWhite->Updated(&finalRegion);
}
mInitialised = true;
mBufferRect = aData.rect();
--- a/gfx/layers/composite/ImageHost.cpp
+++ b/gfx/layers/composite/ImageHost.cpp
@@ -235,17 +235,17 @@ ImageHost::Composite(Compositor* aCompos
DiagnosticFlags diagnosticFlags = DiagnosticFlags::IMAGE;
if (effect->mType == EffectTypes::NV12) {
diagnosticFlags |= DiagnosticFlags::NV12;
} else if (effect->mType == EffectTypes::YCBCR) {
diagnosticFlags |= DiagnosticFlags::YCBCR;
}
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) {
// This iteration does not work if we have multiple texture sources here
// (e.g. 3 YCbCr textures). There's nothing preventing the different
// planes from having different resolutions or tile sizes. For example, a
// YCbCr frame could have Cb and Cr planes that are half the resolution of
// the Y plane, in such a way that the Y plane overflows the maximum
@@ -258,45 +258,45 @@ ImageHost::Composite(Compositor* aCompos
// per-plane per-tile texture coords.
// DrawQuad currently assumes that all planes use the same texture coords.
MOZ_ASSERT(it->GetTileCount() == 1 || !mCurrentTextureSource->GetNextSibling(),
"Can't handle multi-plane BigImages");
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);
aCompositor->DrawDiagnostics(diagnosticFlags | DiagnosticFlags::BIGIMAGE,
rect, aClipRect, aTransform, mFlashCounter);
} while (it->NextTile());
it->EndBigImageIteration();
// layer border
aCompositor->DrawDiagnostics(diagnosticFlags, pictureRect,
aClipRect, aTransform, mFlashCounter);
} else {
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,
aOpacity, aTransform, aGeometry);
aCompositor->DrawDiagnostics(diagnosticFlags,
pictureRect, aClipRect,
aTransform, mFlashCounter);
}
@@ -454,31 +454,31 @@ ImageHost::Unlock()
mLocked = false;
}
IntSize
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();
}
bool
ImageHost::IsOpaque()
{
const TimedImage* img = ChooseImage();
if (!img) {
return false;
}
- if (img->mPictureRect.width == 0 ||
- img->mPictureRect.height == 0 ||
+ if (img->mPictureRect.Width() == 0 ||
+ img->mPictureRect.Height() == 0 ||
!img->mTextureHost) {
return false;
}
gfx::SurfaceFormat format = img->mTextureHost->GetFormat();
if (gfx::IsOpaque(format)) {
return true;
}
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -570,17 +570,17 @@ LayerManagerComposite::InvalidateDebugOv
{
bool drawFps = gfxPrefs::LayersDrawFPS();
bool drawFrameColorBars = gfxPrefs::CompositorDrawColorBars();
if (drawFps) {
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
bool drawPaintTimes = gfxPrefs::AlwaysPaint();
if (drawPaintTimes) {
aInvalidRegion.Or(aInvalidRegion, nsIntRect(PaintCounter::GetPaintRect()));
}
#endif
@@ -621,43 +621,43 @@ LayerManagerComposite::RenderDebugOverla
TimeStamp now = TimeStamp::Now();
if (!mWarnTime.IsNull() && (now - mWarnTime).ToMilliseconds() < kVisualWarningDuration) {
EffectChain effects;
// Black blorder
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);
mTextRenderer->RenderText(
mCompositor,
text,
IntPoint(2, 5),
Matrix4x4(),
@@ -665,38 +665,38 @@ LayerManagerComposite::RenderDebugOverla
600,
TextRenderer::FontType::FixedWidth);
if (mUnusedApzTransformWarning) {
// If we have an unused APZ transform on this composite, draw a 20x20 red box
// 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;
SetDebugOverlayWantsNextFrame(true);
}
if (mDisabledApzWarning) {
// If we have a disabled APZ on this composite, draw a 20x20 yellow box
// in the top-right corner, to the left of the unused-apz-transform
// 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;
SetDebugOverlayWantsNextFrame(true);
}
}
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));
mCompositor->DrawQuad(Rect(sideRect),
sideRect,
effects,
1.0,
gfx::Matrix4x4());
@@ -900,38 +900,38 @@ LayerManagerComposite::Render(const nsIn
AUTO_PROFILER_LABEL("LayerManagerComposite::Render:Prerender", GRAPHICS);
if (!mCompositor->GetWidget()->PreRender(&widgetContext)) {
return;
}
}
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);
MOZ_ASSERT(mRoot->GetOpacity() == 1);
#if defined(MOZ_WIDGET_ANDROID)
LayerMetricsWrapper wrapper = GetRootContentLayer();
if (wrapper) {
mCompositor->SetClearColor(wrapper.Metadata().GetBackgroundColor());
} else {
mCompositor->SetClearColorToDefault();
}
#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();
ScopedCompositorRenderOffset scopedOffset(mCompositor->AsCompositorOGL(), ScreenPoint(0.0f, offset));
#endif
if (actualBounds.IsEmpty()) {
mCompositor->GetWidget()->PostRender(&widgetContext);
@@ -965,17 +965,17 @@ LayerManagerComposite::Render(const nsIn
mDiagnostics->RecordCompositeTime(record.Duration());
}
}
RootLayer()->Cleanup();
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()));
}
}
if (mTwoPassTmpTarget) {
MOZ_ASSERT(haveLayerEffects);
PopGroupForLayerEffects(previousTarget, clipRect.ToUnknownRect(),
grayscaleVal, invertVal, contrastVal);
}
--- a/gfx/layers/composite/PaintCounter.cpp
+++ b/gfx/layers/composite/PaintCounter.cpp
@@ -66,14 +66,14 @@ PaintCounter::Draw(Compositor* aComposit
}
mTextureSource->Update(mSurface);
EffectChain effectChain;
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);
}
} // end namespace layers
} // end namespace mozilla
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -489,24 +489,24 @@ TiledContentHost::RenderTile(TileHost& a
return;
}
float opacity = aTile.GetFadeInOpacity(aOpacity);
aEffectChain.mPrimaryEffect = effect;
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);
}
DiagnosticFlags flags = DiagnosticFlags::CONTENT | DiagnosticFlags::TILE;
if (aTile.mTextureHostOnWhite) {
flags |= DiagnosticFlags::COMPONENT_ALPHA;
@@ -571,17 +571,17 @@ TiledContentHost::RenderLayerBuffer(Tile
if (aBackgroundColor) {
nsIntRegion backgroundRegion = compositeRegion;
backgroundRegion.ScaleRoundOut(resolution, resolution);
EffectChain effect;
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);
}
}
for (size_t i = 0; i < aLayerBuffer.GetTileCount(); ++i) {
TileHost& tile = aLayerBuffer.GetTile(i);
if (tile.IsPlaceholderTile()) {
@@ -600,26 +600,26 @@ TiledContentHost::RenderLayerBuffer(Tile
continue;
}
tileDrawRegion.ScaleRoundOut(resolution, resolution);
RenderTile(tile, aCompositor, aEffectChain, aOpacity,
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) {
componentAlphaDiagnostic = DiagnosticFlags::COMPONENT_ALPHA;
}
}
gfx::Rect rect(visibleRect.x, visibleRect.y,
- visibleRect.width, visibleRect.height);
+ visibleRect.Width(), visibleRect.Height());
aCompositor->DrawDiagnostics(DiagnosticFlags::CONTENT | componentAlphaDiagnostic,
rect, aClipRect, aTransform, mFlashCounter);
}
void
TiledContentHost::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{
aStream << aPrefix;
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -321,56 +321,56 @@ CompositorD3D11::GetMaxTextureSize() con
{
return GetMaxTextureSizeForFeatureLevel(mFeatureLevel);
}
already_AddRefed<CompositingRenderTarget>
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<ID3D11Texture2D> texture;
HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, getter_AddRefs(texture));
if (FAILED(hr) || !texture) {
gfxCriticalNote << "Failed in CreateRenderTarget " << hexa(hr);
return nullptr;
}
RefPtr<CompositingRenderTargetD3D11> 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 };
mContext->ClearRenderTargetView(rt->mRTView, clear);
}
return rt.forget();
}
RefPtr<ID3D11Texture2D>
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<ID3D11Texture2D> texture;
HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, getter_AddRefs(texture));
if (FAILED(hr) || !texture) {
gfxCriticalNote << "Failed in CreateRenderTargetFromSource " << hexa(hr);
HandleError(hr);
@@ -733,26 +733,26 @@ CompositorD3D11::DrawGeometry(const Geom
mContext->PSSetShaderResources(TexSlot::Mask, 1, &srView);
const gfx::Matrix4x4& maskTransform = maskEffect->mMaskTransform;
NS_ASSERTION(maskTransform.Is2D(), "How did we end up with a 3D transform here?!");
Rect bounds = Rect(Point(), Size(maskEffect->mSize));
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);
}
if (clipRect.IsEmpty()) {
return;
}
@@ -1009,17 +1009,17 @@ CompositorD3D11::BeginFrame(const nsIntR
} else {
invalidRegionSafe.And(aInvalidRegion, intRect);
}
IntRect invalidRect = invalidRegionSafe.GetBounds();
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()) {
CancelFrame();
*aRenderBoundsOut = IntRect();
return;
}
@@ -1066,17 +1066,17 @@ CompositorD3D11::BeginFrame(const nsIntR
*aRenderBoundsOut = IntRect();
return;
}
}
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);
}
}
void
CompositorD3D11::NormalDrawingDone()
--- a/gfx/layers/d3d11/MLGDeviceD3D11.cpp
+++ b/gfx/layers/d3d11/MLGDeviceD3D11.cpp
@@ -1402,18 +1402,18 @@ MLGDeviceD3D11::GetRenderTarget()
void
MLGDeviceD3D11::SetViewport(const gfx::IntRect& aViewport)
{
D3D11_VIEWPORT vp;
vp.MaxDepth = 1.0f;
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);
}
static inline D3D11_RECT
ToD3D11Rect(const gfx::IntRect& aRect)
{
D3D11_RECT rect;
rect.left = aRect.x;
--- a/gfx/layers/d3d11/TextureD3D11.cpp
+++ b/gfx/layers/d3d11/TextureD3D11.cpp
@@ -1377,17 +1377,17 @@ DataTextureSourceD3D11::Update(DataSourc
box.back = 1;
box.left = rect.x;
box.top = rect.y;
box.right = rect.XMost();
box.bottom = rect.YMost();
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(),
aSurface->Stride(), aSurface->Stride() * mSize.height);
}
aSurface->Unmap();
} else {
@@ -1397,18 +1397,18 @@ DataTextureSourceD3D11::Update(DataSourc
mTileTextures.resize(tileCount);
mTileSRVs.resize(tileCount);
mTexture = nullptr;
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;
initData.pSysMem = aSurface->GetData() +
tileRect.y * aSurface->Stride() +
tileRect.x * bpp;
initData.SysMemPitch = aSurface->Stride();
@@ -1475,17 +1475,17 @@ DataTextureSourceD3D11::GetTileRect(uint
{
return GetTileRectD3D11(aIndex, mSize, GetMaxTextureSizeFromDevice(mDevice));
}
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,
const gfx::IntPoint& aOrigin,
DXGI_FORMAT aFormatOverride)
: CompositingRenderTarget(aOrigin)
{
MOZ_ASSERT(aTexture);
--- a/gfx/layers/ipc/CompositorBridgeChild.cpp
+++ b/gfx/layers/ipc/CompositorBridgeChild.cpp
@@ -425,17 +425,17 @@ CompositorBridgeChild::RecvUpdatePluginC
rv = widget->SetWindowClipRegion(rectsOut, false);
NS_ASSERTION(NS_SUCCEEDED(rv), "widget call failure");
// This will trigger a browser window paint event for areas uncovered
// by a child window move, and will call invalidate on the plugin
// parent window which the browser owns. The latter gets picked up in
// 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);
// visible state - updated after clipping, prior to invalidating
widget->Show(isVisible);
// Handle invalidation, this can be costly, avoid if it is not needed.
--- a/gfx/layers/mlgpu/ImageLayerMLGPU.cpp
+++ b/gfx/layers/mlgpu/ImageLayerMLGPU.cpp
@@ -43,35 +43,34 @@ ImageLayerMLGPU::ComputeEffectiveTransfo
SnapTransform(local, sourceRect, nullptr) *
SnapTransformTranslation(aTransformToSurface, nullptr);
mEffectiveTransformForBuffer = mEffectiveTransform;
if (mScaleMode == ScaleMode::STRETCH &&
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);
}
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
}
gfx::SamplingFilter
ImageLayerMLGPU::GetSamplingFilter()
{
return ImageLayer::GetSamplingFilter();
}
bool
ImageLayerMLGPU::IsContentOpaque()
{
- if (mPictureRect.width == 0 || mPictureRect.height == 0) {
+ if (mPictureRect.Width() == 0 || mPictureRect.Height() == 0) {
return false;
}
if (mScaleMode == ScaleMode::STRETCH) {
return gfx::IsOpaque(mHost->CurrentTextureHost()->GetFormat());
}
return false;
}
--- a/gfx/layers/mlgpu/MaskOperation.cpp
+++ b/gfx/layers/mlgpu/MaskOperation.cpp
@@ -56,20 +56,20 @@ MaskTexture::operator <(const MaskTextur
{
if (mRect.x != aOther.mRect.x) {
return mRect.x < aOther.mRect.x;
}
if (mRect.y != aOther.mRect.y) {
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;
}
RefPtr<TextureSource>
GetMaskLayerTexture(Layer* aLayer)
{
LayerMLGPU* layer = aLayer->AsHostLayer()->AsLayerMLGPU();
--- a/gfx/layers/mlgpu/RenderPassMLGPU.cpp
+++ b/gfx/layers/mlgpu/RenderPassMLGPU.cpp
@@ -501,23 +501,23 @@ TexturedRenderPass::AddClippedItem(Txn&
{
float xScale = aScale ? aScale->width : 1.0f;
float yScale = aScale ? aScale->height : 1.0f;
Point offset = aDrawRect.TopLeft() - aDestOrigin;
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];
Rect textureRects[4];
size_t numRects =
DecomposeIntoNoRepeatRects(aDrawRect, textureCoords, &layerRects, &textureRects);
for (size_t i = 0; i < numRects; i++) {
--- a/gfx/layers/mlgpu/TexturedLayerMLGPU.cpp
+++ b/gfx/layers/mlgpu/TexturedLayerMLGPU.cpp
@@ -97,17 +97,17 @@ TexturedLayerMLGPU::OnPrepareToRender(Fr
if (source->AsBigImageIterator()) {
mBigImageTexture = source;
mTexture = nullptr;
} else {
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;
}
void
TexturedLayerMLGPU::AssignToView(FrameBuilder* aBuilder,
RenderViewMLGPU* aView,
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -516,19 +516,19 @@ CompositorOGL::PrepareViewport(Compositi
aRenderTarget->GetProjection(mProjMatrix, depthEnable, zNear, zFar);
mGLContext->fDepthRange(zNear, zFar);
}
}
already_AddRefed<CompositingRenderTarget>
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;
}
if (!gl()) {
// CompositingRenderTargetOGL does not work without a gl context.
return nullptr;
}
@@ -543,19 +543,19 @@ CompositorOGL::CreateRenderTarget(const
return surface.forget();
}
already_AddRefed<CompositingRenderTarget>
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;
}
if (!gl()) {
return nullptr;
}
GLuint tex = 0;
@@ -614,20 +614,20 @@ GetFrameBufferInternalFormat(GLContext*
}
return LOCAL_GL_RGBA;
}
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);
}
void
CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
const IntRect *aClipRectIn,
const IntRect& aRenderBounds,
@@ -638,25 +638,25 @@ CompositorOGL::BeginFrame(const nsIntReg
AUTO_PROFILER_LABEL("CompositorOGL::BeginFrame", GRAPHICS);
MOZ_ASSERT(!mFrameInProgress, "frame still in progress (should have called EndFrame");
gfx::IntRect rect;
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
if (width == 0 || height == 0)
return;
// We're about to actually draw a frame.
mFrameInProgress = true;
@@ -722,18 +722,18 @@ CompositorOGL::CreateTexture(const IntRe
// we're about to create a framebuffer backed by textures to use as an intermediate
// surface. What to do if its size (as given by aRect) would exceed the
// maximum texture size supported by the GL? The present code chooses the compromise
// of just clamping the framebuffer's size to the max supported size.
// This gives us a lower resolution rendering of the intermediate surface (children layers).
// 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;
mGLContext->fActiveTexture(LOCAL_GL_TEXTURE0);
mGLContext->fGenTextures(1, &tex);
mGLContext->fBindTexture(mFBOTextureTarget, tex);
if (aCopyFromSource) {
@@ -753,35 +753,35 @@ CompositorOGL::CreateTexture(const IntRe
bool isFormatCompatibleWithRGBA
= gl()->IsGLES() ? (format == LOCAL_GL_RGBA)
: true;
if (isFormatCompatibleWithRGBA) {
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<uint8_t[]>(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,
buf.get());
}
GLenum error = mGLContext->fGetError();
if (error != LOCAL_GL_NO_ERROR) {
@@ -789,35 +789,35 @@ CompositorOGL::CreateTexture(const IntRe
msg.AppendPrintf("Texture initialization failed! -- error 0x%x, Source %d, Source format %d, RGBA Compat %d",
error, aSourceFrameBuffer, format, isFormatCompatibleWithRGBA);
NS_ERROR(msg.get());
}
} else {
mGLContext->fTexImage2D(mFBOTextureTarget,
0,
LOCAL_GL_RGBA,
- clampedRect.width, clampedRect.height,
+ clampedRect.Width(), clampedRect.Height(),
0,
LOCAL_GL_RGBA,
LOCAL_GL_UNSIGNED_BYTE,
nullptr);
}
mGLContext->fTexParameteri(mFBOTextureTarget, LOCAL_GL_TEXTURE_MIN_FILTER,
LOCAL_GL_LINEAR);
mGLContext->fTexParameteri(mFBOTextureTarget, LOCAL_GL_TEXTURE_MAG_FILTER,
LOCAL_GL_LINEAR);
mGLContext->fTexParameteri(mFBOTextureTarget, LOCAL_GL_TEXTURE_WRAP_S,
LOCAL_GL_CLAMP_TO_EDGE);
mGLContext->fTexParameteri(mFBOTextureTarget, LOCAL_GL_TEXTURE_WRAP_T,
LOCAL_GL_CLAMP_TO_EDGE);
mGLContext->fBindTexture(mFBOTextureTarget, 0);
if (aAllocSize) {
- aAllocSize->width = clampedRect.width;
- aAllocSize->height = clampedRect.height;
+ aAllocSize->width = clampedRect.Width();
+ aAllocSize->height = clampedRect.Height();
}
return tex;
}
ShaderConfigOGL
CompositorOGL::GetShaderConfigFor(Effect *aEffect,
MaskType aMask,
@@ -1642,18 +1642,18 @@ CompositorOGL::CopyToTarget(DrawTarget*
{
MOZ_ASSERT(aTarget);
IntRect rect;
if (mUseExternalSurfaceSize) {
rect = IntRect(0, 0, mSurfaceSize.width, mSurfaceSize.height);
} 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!");
return;
}
mGLContext->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, 0);
@@ -1676,17 +1676,17 @@ CompositorOGL::CopyToTarget(DrawTarget*
glToCairoTransform.Invert();
glToCairoTransform.PreScale(1.0, -1.0);
glToCairoTransform.PreTranslate(0.0, -height);
glToCairoTransform.PostTranslate(-aTopLeft.x, -aTopLeft.y);
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();
}
void
CompositorOGL::Pause()
{
--- a/gfx/layers/opengl/GLBlitTextureImageHelper.cpp
+++ b/gfx/layers/opengl/GLBlitTextureImageHelper.cpp
@@ -48,18 +48,18 @@ GLBlitTextureImageHelper::BlitTextureIma
int savedFb = 0;
gl->fGetIntegerv(LOCAL_GL_FRAMEBUFFER_BINDING, &savedFb);
ScopedGLState scopedScissorTestState(gl, LOCAL_GL_SCISSOR_TEST, false);
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();
do {
// calculate portion of the tile that is going to be painted to
gfx::IntRect dstSubRect;
gfx::IntRect dstTextureRect = aDst->GetTileRect();
dstSubRect.IntersectRect(aDstRect, dstTextureRect);
@@ -111,18 +111,18 @@ GLBlitTextureImageHelper::BlitTextureIma
// we transform these rectangles to be relative to the current src and dst tiles, respectively
gfx::IntSize srcSize = srcTextureRect.Size();
gfx::IntSize dstSize = dstTextureRect.Size();
srcSubRect.MoveBy(-srcTextureRect.x, -srcTextureRect.y);
srcSubInDstRect.MoveBy(-dstTextureRect.x, -dstTextureRect.y);
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;
gfx::IntSize realTexSize = srcSize;
if (!CanUploadNonPowerOfTwo(gl)) {
realTexSize = gfx::IntSize(RoundUpPow2(srcSize.width),
RoundUpPow2(srcSize.height));
--- a/gfx/layers/wr/AsyncImagePipelineManager.cpp
+++ b/gfx/layers/wr/AsyncImagePipelineManager.cpp
@@ -261,17 +261,17 @@ AsyncImagePipelineManager::ApplyAsyncIma
bool updateDisplayList = UpdateImageKeys(useExternalImage,
pipeline,
keys,
keysToDelete);
if (!updateDisplayList) {
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()) {
MOZ_ASSERT(pipeline->mCurrentTexture.get());
float opacity = 1.0f;
builder.PushStackingContext(wr::ToLayoutRect(pipeline->mScBounds),
0,
@@ -303,17 +303,17 @@ AsyncImagePipelineManager::ApplyAsyncIma
keys[0]);
}
builder.PopStackingContext();
}
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);
}
DeleteOldAsyncImages();
mKeysToDelete.SwapElements(keysToDelete);
}
void
--- a/gfx/layers/wr/WebRenderCanvasLayer.cpp
+++ b/gfx/layers/wr/WebRenderCanvasLayer.cpp
@@ -41,23 +41,23 @@ WebRenderCanvasLayer::RenderLayer(wr::Di
const StackingContextHelper& aSc)
{
WebRenderCanvasRendererSync* canvasRenderer = mCanvasRenderer->AsWebRenderCanvasRendererSync();
MOZ_ASSERT(canvasRenderer);
canvasRenderer->UpdateCompositableClient();
Maybe<gfx::Matrix4x4> 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);
if (gfxPrefs::LayersDump()) {
printf_stderr("CanvasLayer %p texture-filter=%s\n",
this->GetLayer(),
Stringify(filter).c_str());
--- a/gfx/layers/wr/WebRenderImageHost.cpp
+++ b/gfx/layers/wr/WebRenderImageHost.cpp
@@ -286,17 +286,17 @@ WebRenderImageHost::Unlock()
MOZ_ASSERT_UNREACHABLE("unexpected to be called");
}
IntSize
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();
}
void
WebRenderImageHost::SetWrBridge(WebRenderBridgeParent* aWrBridge)
{
// For image hosts created through ImageBridgeParent, there may be multiple
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -318,17 +318,17 @@ WebRenderLayerManager::CreateImageKey(ns
if (aContainer->IsAsync()) {
bool snap;
nsRect bounds = aItem->GetBounds(nullptr, &snap);
int32_t appUnitsPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel();
LayerRect rect = ViewAs<LayerPixel>(
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());
}
imageData->CreateAsyncImageWebRenderCommands(aBuilder,
aContainer,
aSc,
rect,
@@ -392,24 +392,24 @@ PaintItemByDrawTarget(nsDisplayItem* aIt
context->SetMatrix(gfxMatrix::Translation(-aOffset.x, -aOffset.y));
static_cast<nsDisplayMask*>(aItem)->PaintMask(aDisplayListBuilder, context);
} else {
aItem->Paint(aDisplayListBuilder, context);
}
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)));
}
}
already_AddRefed<WebRenderFallbackData>
WebRenderLayerManager::GenerateFallbackData(nsDisplayItem* aItem,
wr::DisplayListBuilder& aBuilder,
nsDisplayListBuilder* aDisplayListBuilder,
LayerRect& aImageRect,
@@ -761,18 +761,18 @@ WebRenderLayerManager::MakeSnapshotIfReq
/*
static int count = 0;
char filename[100];
snprintf(filename, 100, "output%d.png", count++);
printf_stderr("Writing to :%s\n", filename);
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.
SurfacePattern pattern(snapshot, ExtendMode::CLAMP,
Matrix::Scaling(1.0, -1.0).PostTranslate(0.0, aSize.height));
DrawTarget* dt = mTarget->GetDrawTarget();
MOZ_RELEASE_ASSERT(dt);
dt->FillRect(dst, pattern);
--- a/gfx/src/nsDeviceContext.cpp
+++ b/gfx/src/nsDeviceContext.cpp
@@ -449,45 +449,45 @@ nsresult
nsDeviceContext::GetDeviceSurfaceDimensions(nscoord &aWidth, nscoord &aHeight)
{
if (IsPrinterContext()) {
aWidth = mWidth;
aHeight = mHeight;
} else {
nsRect area;
ComputeFullAreaUsingScreen(&area);
- aWidth = area.width;
- aHeight = area.height;
+ aWidth = area.Width();
+ aHeight = area.Height();
}
return NS_OK;
}
nsresult
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 );
return NS_OK;
}
nsresult
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);
return NS_OK;
}
nsresult
@@ -618,18 +618,18 @@ nsDeviceContext::ComputeClientRectUsingS
FindScreen (getter_AddRefs(screen));
if (screen) {
int32_t x, y, width, height;
screen->GetAvailRect(&x, &y, &width, &height);
// 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()));
}
}
void
nsDeviceContext::ComputeFullAreaUsingScreen(nsRect* outRect)
{
// if we have more than one screen, we always need to recompute the clientRect
// because the window may have moved onto a different screen. In the single
@@ -639,21 +639,21 @@ nsDeviceContext::ComputeFullAreaUsingScr
FindScreen ( getter_AddRefs(screen) );
if ( screen ) {
int32_t x, y, width, height;
screen->GetRect ( &x, &y, &width, &height );
// 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();
}
}
//
// FindScreen
//
// Determines which screen intersects the largest area of the given surface.
//
--- a/gfx/src/nsRect.cpp
+++ b/gfx/src/nsRect.cpp
@@ -44,19 +44,19 @@ FILE* operator<<(FILE* out, const nsRect
// Output the coordinates in fractional pixels so they're easier to read
tmp.Append('{');
tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.x,
nsDeviceContext::AppUnitsPerCSSPixel()));
tmp.AppendLiteral(", ");
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);
return out;
}
#endif // DEBUG
--- a/gfx/src/nsRegion.cpp
+++ b/gfx/src/nsRegion.cpp
@@ -550,17 +550,17 @@ void nsRegion::SimplifyInward (uint32_t
SetEmpty();
}
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;
}
nsRegion& nsRegion::ScaleRoundOut (float aXScale, float aYScale)
{
if (mozilla::gfx::FuzzyEqual(aXScale, 1.0f) &&
mozilla::gfx::FuzzyEqual(aYScale, 1.0f)) {
@@ -605,17 +605,17 @@ nsRegion& nsRegion::ScaleInverseRoundOut
static mozilla::gfx::IntRect
TransformRect(const mozilla::gfx::IntRect& aRect, const mozilla::gfx::Matrix4x4& aTransform)
{
if (aRect.IsEmpty()) {
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();
mozilla::gfx::IntRect intRect;
if (!gfxUtils::GfxRectToIntRect(ThebesRect(rect), &intRect)) {
return mozilla::gfx::IntRect();
}
--- a/gfx/src/nsScriptableRegion.cpp
+++ b/gfx/src/nsScriptableRegion.cpp
@@ -98,18 +98,18 @@ NS_IMETHODIMP nsScriptableRegion::IsEqua
return NS_OK;
}
NS_IMETHODIMP nsScriptableRegion::GetBoundingBox(int32_t *aX, int32_t *aY, int32_t *aWidth, int32_t *aHeight)
{
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;
}
NS_IMETHODIMP nsScriptableRegion::Offset(int32_t aXOffset, int32_t aYOffset)
{
mRegion.MoveBy(aXOffset, aYOffset);
return NS_OK;
}
@@ -143,17 +143,17 @@ NS_IMETHODIMP nsScriptableRegion::GetRec
aRects.setObject(*destArray);
uint32_t n = 0;
for (auto iter = mRegion.RectIter(); !iter.Done(); iter.Next()) {
const mozilla::gfx::IntRect& rect = iter.Get();
if (!JS_DefineElement(aCx, destArray, n, rect.x, JSPROP_ENUMERATE) ||
!JS_DefineElement(aCx, destArray, n + 1, rect.y, JSPROP_ENUMERATE) ||
- !JS_DefineElement(aCx, destArray, n + 2, rect.width, JSPROP_ENUMERATE) ||
- !JS_DefineElement(aCx, destArray, n + 3, rect.height, JSPROP_ENUMERATE)) {
+ !JS_DefineElement(aCx, destArray, n + 2, rect.Width(), JSPROP_ENUMERATE) ||
+ !JS_DefineElement(aCx, destArray, n + 3, rect.Height(), JSPROP_ENUMERATE)) {
return NS_ERROR_FAILURE;
}
n += 4;
}
return NS_OK;
}
--- a/gfx/tests/gtest/TestRegion.cpp
+++ b/gfx/tests/gtest/TestRegion.cpp
@@ -60,17 +60,17 @@ public:
for (int32_t i = 0; i < nTests; i++) {
nsRegion r2;
r2.Sub(r, tests[i].rect);
EXPECT_TRUE(r2.IsComplex()) << "nsRegion code got unexpectedly smarter!";
nsRect largest = r2.GetLargestRectangle();
- EXPECT_TRUE(largest.width * largest.height == tests[i].expectedArea) <<
+ EXPECT_TRUE(largest.Width() * largest.Height() == tests[i].expectedArea) <<
"Did not successfully find largest rectangle in non-rectangular region on iteration " << i;
}
}
static void TwoRectTest() {
nsRegion r(nsRect(0, 0, 100, 100));
const int nTests = 4;
struct {
@@ -86,17 +86,17 @@ public:
nsRegion r2;
r2.Sub(r, tests[i].rect1);
r2.Sub(r2, tests[i].rect2);
EXPECT_TRUE(r2.IsComplex()) << "nsRegion code got unexpectedly smarter!";
nsRect largest = r2.GetLargestRectangle();
- EXPECT_TRUE(largest.width * largest.height == tests[i].expectedArea) <<
+ EXPECT_TRUE(largest.Width() * largest.Height() == tests[i].expectedArea) <<
"Did not successfully find largest rectangle in two-rect-subtract region on iteration " << i;
}
}
static void TestContainsSpecifiedRect() {
nsRegion r(nsRect(0, 0, 100, 100));
r.Or(r, nsRect(0, 300, 50, 50));
EXPECT_TRUE(r.GetLargestRectangle(nsRect(0, 300, 10, 10)).IsEqualInterior(nsRect(0, 300, 50, 50))) <<
"Chose wrong rectangle";
--- a/gfx/vr/VRDisplayPresentation.cpp
+++ b/gfx/vr/VRDisplayPresentation.cpp
@@ -42,33 +42,33 @@ VRDisplayPresentation::CreateLayers()
/// XXX In the future we will support WebVR in WebWorkers here
continue;
}
Rect leftBounds(0.0, 0.0, 0.5, 1.0);
if (layer.mLeftBounds.Length() == 4) {
leftBounds.x = layer.mLeftBounds[0];
leftBounds.y = layer.mLeftBounds[1];
- leftBounds.width = layer.mLeftBounds[2];
- leftBounds.height = layer.mLeftBounds[3];
+ leftBounds.SetWidth(layer.mLeftBounds[2]);
+ leftBounds.SetHeight(layer.mLeftBounds[3]);
} else if (layer.mLeftBounds.Length() != 0) {
/**
* We ignore layers with an incorrect number of values.
* In the future, VRDisplay.requestPresent may throw in
* this case. See https://github.com/w3c/webvr/issues/71
*/
continue;
}
Rect rightBounds(0.5, 0.0, 0.5, 1.0);
if (layer.mRightBounds.Length() == 4) {
rightBounds.x = layer.mRightBounds[0];
rightBounds.y = layer.mRightBounds[1];
- rightBounds.width = layer.mRightBounds[2];
- rightBounds.height = layer.mRightBounds[3];
+ rightBounds.SetWidth(layer.mRightBounds[2]);
+ rightBounds.SetHeight(layer.mRightBounds[3]);
} else if (layer.mRightBounds.Length() != 0) {
/**
* We ignore layers with an incorrect number of values.
* In the future, VRDisplay.requestPresent may throw in
* this case. See https://github.com/w3c/webvr/issues/71
*/
continue;
}
--- a/gfx/vr/gfxVROculus.cpp
+++ b/gfx/vr/gfxVROculus.cpp
@@ -1115,22 +1115,22 @@ VRDisplayOculus::SubmitFrame(TextureSour
layer.Header.Type = ovrLayerType_EyeFov;
layer.Header.Flags = 0;
layer.ColorTexture[0] = mSession->GetSwapChain();
layer.ColorTexture[1] = nullptr;
layer.Fov[0] = mFOVPort[0];
layer.Fov[1] = mFOVPort[1];
layer.Viewport[0].Pos.x = aSize.width * aLeftEyeRect.x;
layer.Viewport[0].Pos.y = aSize.height * aLeftEyeRect.y;
- layer.Viewport[0].Size.w = aSize.width * aLeftEyeRect.width;
- layer.Viewport[0].Size.h = aSize.height * aLeftEyeRect.height;
+ layer.Viewport[0].Size.w = aSize.width * aLeftEyeRect.Width();
+ layer.Viewport[0].Size.h = aSize.height * aLeftEyeRect.Height();
layer.Viewport[1].Pos.x = aSize.width * aRightEyeRect.x;
layer.Viewport[1].Pos.y = aSize.height * aRightEyeRect.y;
- layer.Viewport[1].Size.w = aSize.width * aRightEyeRect.width;
- layer.Viewport[1].Size.h = aSize.height * aRightEyeRect.height;
+ layer.Viewport[1].Size.w = aSize.width * aRightEyeRect.Width();
+ layer.Viewport[1].Size.h = aSize.height * aRightEyeRect.Height();
const Point3D& l = mDisplayInfo.mEyeTranslation[0];
const Point3D& r = mDisplayInfo.mEyeTranslation[1];
const ovrVector3f hmdToEyeViewOffset[2] = { { l.x, l.y, l.z },
{ r.x, r.y, r.z } };
const VRHMDSensorState& sensorState = mDisplayInfo.GetSensorState();
--- a/gfx/vr/gfxVROpenVR.cpp
+++ b/gfx/vr/gfxVROpenVR.cpp
@@ -300,29 +300,29 @@ VRDisplayOpenVR::SubmitFrame(void* aText
::vr::Texture_t tex;
tex.handle = aTextureHandle;
tex.eType = aTextureType;
tex.eColorSpace = ::vr::EColorSpace::ColorSpace_Auto;
::vr::VRTextureBounds_t bounds;
bounds.uMin = aLeftEyeRect.x;
bounds.vMin = 1.0 - aLeftEyeRect.y;
- bounds.uMax = aLeftEyeRect.x + aLeftEyeRect.width;
- bounds.vMax = 1.0 - aLeftEyeRect.y - aLeftEyeRect.height;
+ bounds.uMax = aLeftEyeRect.x + aLeftEyeRect.Width();
+ bounds.vMax = 1.0 - aLeftEyeRect.y - aLeftEyeRect.Height();
::vr::EVRCompositorError err;
err = mVRCompositor->Submit(::vr::EVREye::Eye_Left, &tex, &bounds);
if (err != ::vr::EVRCompositorError::VRCompositorError_None) {
printf_stderr("OpenVR Compositor Submit() failed.\n");
}
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) {
printf_stderr("OpenVR Compositor Submit() failed.\n");
}
mVRCompositor->PostPresentHandoff();
return true;
--- a/gfx/vr/ipc/VRManagerChild.cpp
+++ b/gfx/vr/ipc/VRManagerChild.cpp
@@ -398,31 +398,31 @@ VRManagerChild::DeallocShmem(ipc::Shmem&
PVRLayerChild*
VRManagerChild::CreateVRLayer(uint32_t aDisplayID,
const Rect& aLeftEyeRect,
const Rect& aRightEyeRect,
nsIEventTarget* aTarget,
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) {
SetEventTargetForActor(vrLayerChild, aTarget);
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);
}
// XXX TODO - VRManagerChild::FrameRequest is the same as nsIDocument::FrameRequest, should we consolodate these?
struct VRManagerChild::FrameRequest
{
FrameRequest(mozilla::dom::FrameRequestCallback& aCallback,