зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1423570: Use BaseRect access methods instead of member variables in gfx/ r=bas.schouten
MozReview-Commit-ID: ZGySgc9oP3 --HG-- extra : rebase_source : 23aadc10e9885002290155684b2c495780d979ce
This commit is contained in:
Родитель
d6bdc5ded0
Коммит
099cfc4242
|
@ -34,6 +34,9 @@ struct BasePoint {
|
|||
constexpr BasePoint() : x(0), y(0) {}
|
||||
constexpr BasePoint(Coord aX, Coord aY) : x(aX), y(aY) {}
|
||||
|
||||
MOZ_ALWAYS_INLINE T X() const { return x; }
|
||||
MOZ_ALWAYS_INLINE T Y() const { return y; }
|
||||
|
||||
void MoveTo(T aX, T aY) { x = aX; y = aY; }
|
||||
void MoveBy(T aDx, T aDy) { x += aDx; y += aDy; }
|
||||
|
||||
|
|
|
@ -225,6 +225,12 @@ struct BaseRect {
|
|||
{
|
||||
x = aX; y = aY; width = aXMost - aX; height = aYMost - aY;
|
||||
}
|
||||
MOZ_ALWAYS_INLINE void SetNonEmptyBox(T aX, T aY, T aXMost, T aYMost)
|
||||
{
|
||||
x = aX; y = aY;
|
||||
width = std::max(0,aXMost - aX);
|
||||
height = std::max(0,aYMost - aY);
|
||||
}
|
||||
MOZ_ALWAYS_INLINE void SetBoxX(T aX, T aXMost)
|
||||
{
|
||||
x = aX; width = aXMost - aX;
|
||||
|
@ -237,7 +243,7 @@ struct BaseRect {
|
|||
{
|
||||
SetRect(aPt.x, aPt.y, aSize.width, aSize.height);
|
||||
}
|
||||
MOZ_ALWAYS_INLINE void GetRect(T* aX, T* aY, T* aWidth, T* aHeight)
|
||||
MOZ_ALWAYS_INLINE void GetRect(T* aX, T* aY, T* aWidth, T* aHeight) const
|
||||
{
|
||||
*aX = x; *aY = y; *aWidth = width; *aHeight = height;
|
||||
}
|
||||
|
|
|
@ -232,8 +232,7 @@ BoxBlur(uint8_t* aData,
|
|||
{
|
||||
if (aTranspose) {
|
||||
swap(aWidth, aRows);
|
||||
swap(aSkipRect.x, aSkipRect.y);
|
||||
swap(aSkipRect.width, aSkipRect.height);
|
||||
aSkipRect.Swap();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aWidth > 0);
|
||||
|
@ -251,15 +250,14 @@ BoxBlur(uint8_t* aData,
|
|||
uint8_t* tmpRow2 = tmpRow + aWidth;
|
||||
|
||||
const int32_t stride = aTranspose ? 1 : aStride;
|
||||
bool skipRectCoversWholeRow = 0 >= aSkipRect.x &&
|
||||
bool skipRectCoversWholeRow = 0 >= aSkipRect.X() &&
|
||||
aWidth <= aSkipRect.XMost();
|
||||
|
||||
for (int32_t y = 0; y < aRows; y++) {
|
||||
// Check whether the skip rect intersects this row. If the skip
|
||||
// rect covers the whole surface in this row, we can avoid
|
||||
// this row entirely (and any others along the skip rect).
|
||||
bool inSkipRectY = y >= aSkipRect.y &&
|
||||
y < aSkipRect.YMost();
|
||||
bool inSkipRectY = aSkipRect.ContainsY(y);
|
||||
if (inSkipRectY && skipRectCoversWholeRow) {
|
||||
aData += stride * (aSkipRect.YMost() - y);
|
||||
y = aSkipRect.YMost() - 1;
|
||||
|
@ -275,7 +273,7 @@ BoxBlur(uint8_t* aData,
|
|||
// Write back data to the destination transposed if necessary too.
|
||||
// Make sure not to overwrite the skip rect by only outputting to the
|
||||
// destination before and after the skip rect, if requested.
|
||||
int32_t skipStart = inSkipRectY ? min(max(aSkipRect.x, 0), aWidth) : aWidth;
|
||||
int32_t skipStart = inSkipRectY ? min(max(aSkipRect.X(), 0), aWidth) : aWidth;
|
||||
int32_t skipEnd = max(skipStart, aSkipRect.XMost());
|
||||
if (skipStart > 0) {
|
||||
BoxBlurRow<false, aTranspose>(tmpRow2, aData, aLobes[2][0], aLobes[2][1], aWidth, aStride, 0, skipStart);
|
||||
|
@ -349,14 +347,13 @@ SpreadHorizontal(uint8_t* aInput,
|
|||
return;
|
||||
}
|
||||
|
||||
bool skipRectCoversWholeRow = 0 >= aSkipRect.x &&
|
||||
bool skipRectCoversWholeRow = 0 >= aSkipRect.X() &&
|
||||
aWidth <= aSkipRect.XMost();
|
||||
for (int32_t y = 0; y < aRows; y++) {
|
||||
// Check whether the skip rect intersects this row. If the skip
|
||||
// rect covers the whole surface in this row, we can avoid
|
||||
// this row entirely (and any others along the skip rect).
|
||||
bool inSkipRectY = y >= aSkipRect.y &&
|
||||
y < aSkipRect.YMost();
|
||||
bool inSkipRectY = aSkipRect.ContainsY(y);
|
||||
if (inSkipRectY && skipRectCoversWholeRow) {
|
||||
y = aSkipRect.YMost() - 1;
|
||||
continue;
|
||||
|
@ -365,8 +362,7 @@ SpreadHorizontal(uint8_t* aInput,
|
|||
for (int32_t x = 0; x < aWidth; x++) {
|
||||
// Check whether we are within the skip rect. If so, go
|
||||
// to the next point outside the skip rect.
|
||||
if (inSkipRectY && x >= aSkipRect.x &&
|
||||
x < aSkipRect.XMost()) {
|
||||
if (inSkipRectY && aSkipRect.ContainsX(x)) {
|
||||
x = aSkipRect.XMost();
|
||||
if (x >= aWidth)
|
||||
break;
|
||||
|
@ -397,11 +393,10 @@ SpreadVertical(uint8_t* aInput,
|
|||
return;
|
||||
}
|
||||
|
||||
bool skipRectCoversWholeColumn = 0 >= aSkipRect.y &&
|
||||
bool skipRectCoversWholeColumn = 0 >= aSkipRect.Y() &&
|
||||
aRows <= aSkipRect.YMost();
|
||||
for (int32_t x = 0; x < aWidth; x++) {
|
||||
bool inSkipRectX = x >= aSkipRect.x &&
|
||||
x < aSkipRect.XMost();
|
||||
bool inSkipRectX = aSkipRect.ContainsX(x);
|
||||
if (inSkipRectX && skipRectCoversWholeColumn) {
|
||||
x = aSkipRect.XMost() - 1;
|
||||
continue;
|
||||
|
@ -410,8 +405,7 @@ SpreadVertical(uint8_t* aInput,
|
|||
for (int32_t y = 0; y < aRows; y++) {
|
||||
// Check whether we are within the skip rect. If so, go
|
||||
// to the next point outside the skip rect.
|
||||
if (inSkipRectX && y >= aSkipRect.y &&
|
||||
y < aSkipRect.YMost()) {
|
||||
if (inSkipRectX && aSkipRect.ContainsY(y)) {
|
||||
y = aSkipRect.YMost();
|
||||
if (y >= aRows)
|
||||
break;
|
||||
|
@ -808,7 +802,9 @@ AlphaBoxBlur::BoxBlur_C(uint8_t* aData,
|
|||
uint8_t *data = aData;
|
||||
int32_t stride = mStride;
|
||||
for (int32_t y = 0; y < size.height; y++) {
|
||||
bool inSkipRectY = y > skipRect.y && y < skipRect.YMost();
|
||||
// Not using ContainsY(y) because we do not skip y == skipRect.Y()
|
||||
// although that may not be done on purpose
|
||||
bool inSkipRectY = y > skipRect.Y() && y < skipRect.YMost();
|
||||
|
||||
uint32_t *topLeftBase = innerIntegral + ((y - aTopLobe) * stride32bit - aLeftLobe);
|
||||
uint32_t *topRightBase = innerIntegral + ((y - aTopLobe) * stride32bit + aRightLobe);
|
||||
|
@ -816,7 +812,9 @@ AlphaBoxBlur::BoxBlur_C(uint8_t* aData,
|
|||
uint32_t *bottomLeftBase = innerIntegral + ((y + aBottomLobe) * stride32bit - aLeftLobe);
|
||||
|
||||
for (int32_t x = 0; x < size.width; x++) {
|
||||
if (inSkipRectY && x > skipRect.x && x < skipRect.XMost()) {
|
||||
// Not using ContainsX(x) because we do not skip x == skipRect.X()
|
||||
// although that may not be done on purpose
|
||||
if (inSkipRectY && x > skipRect.X() && x < skipRect.XMost()) {
|
||||
x = skipRect.XMost() - 1;
|
||||
// Trigger early jump on coming loop iterations, this will be reset
|
||||
// next line anyway.
|
||||
|
|
|
@ -238,7 +238,9 @@ AlphaBoxBlur::BoxBlur_SSE2(uint8_t* aData,
|
|||
int32_t stride = mStride;
|
||||
uint8_t *data = aData;
|
||||
for (int32_t y = 0; y < size.height; y++) {
|
||||
bool inSkipRectY = y > skipRect.y && y < skipRect.YMost();
|
||||
// Not using ContainsY(y) because we do not skip y == skipRect.Y()
|
||||
// although that may not be done on purpose
|
||||
bool inSkipRectY = y > skipRect.Y() && y < skipRect.YMost();
|
||||
|
||||
uint32_t *topLeftBase = innerIntegral + ((y - aTopLobe) * ptrdiff_t(stride32bit) - aLeftLobe);
|
||||
uint32_t *topRightBase = innerIntegral + ((y - aTopLobe) * ptrdiff_t(stride32bit) + aRightLobe);
|
||||
|
@ -248,7 +250,9 @@ AlphaBoxBlur::BoxBlur_SSE2(uint8_t* aData,
|
|||
int32_t x = 0;
|
||||
// Process 16 pixels at a time for as long as possible.
|
||||
for (; x <= size.width - 16; x += 16) {
|
||||
if (inSkipRectY && x > skipRect.x && x < skipRect.XMost()) {
|
||||
// Not using ContainsX(x) because we do not skip x == skipRect.X()
|
||||
// although that may not be done on purpose
|
||||
if (inSkipRectY && x > skipRect.X() && x < skipRect.XMost()) {
|
||||
x = skipRect.XMost() - 16;
|
||||
// Trigger early jump on coming loop iterations, this will be reset
|
||||
// next line anyway.
|
||||
|
@ -292,7 +296,9 @@ AlphaBoxBlur::BoxBlur_SSE2(uint8_t* aData,
|
|||
|
||||
// Process the remaining pixels 4 bytes at a time.
|
||||
for (; x < size.width; x += 4) {
|
||||
if (inSkipRectY && x > skipRect.x && x < skipRect.XMost()) {
|
||||
// Not using Containsx(x) because we do not skip x == skipRect.X()
|
||||
// although that may not be done on purpose
|
||||
if (inSkipRectY && x > skipRect.X() && x < skipRect.XMost()) {
|
||||
x = skipRect.XMost() - 4;
|
||||
// Trigger early jump on coming loop iterations, this will be reset
|
||||
// next line anyway.
|
||||
|
|
|
@ -136,26 +136,26 @@ ConditionRect(Rect& r) {
|
|||
return false;
|
||||
|
||||
if (r.X() < 0.f) {
|
||||
r.width += r.X();
|
||||
if (r.width < 0.f)
|
||||
r.SetWidth(r.XMost());
|
||||
if (r.Width() < 0.f)
|
||||
return false;
|
||||
r.x = 0.f;
|
||||
r.MoveToX(0.f);
|
||||
}
|
||||
|
||||
if (r.XMost() > CAIRO_COORD_MAX) {
|
||||
r.width = CAIRO_COORD_MAX - r.X();
|
||||
r.SetRightEdge(CAIRO_COORD_MAX);
|
||||
}
|
||||
|
||||
if (r.Y() < 0.f) {
|
||||
r.height += r.Y();
|
||||
r.SetHeight(r.YMost());
|
||||
if (r.Height() < 0.f)
|
||||
return false;
|
||||
|
||||
r.y = 0.f;
|
||||
r.MoveToY(0.f);
|
||||
}
|
||||
|
||||
if (r.YMost() > CAIRO_COORD_MAX) {
|
||||
r.height = CAIRO_COORD_MAX - r.Y();
|
||||
r.SetBottomEdge(CAIRO_COORD_MAX);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -219,9 +219,12 @@ CopyToImageSurface(unsigned char *aData,
|
|||
{
|
||||
MOZ_ASSERT(aData);
|
||||
|
||||
auto aRectWidth = aRect.Width();
|
||||
auto aRectHeight = aRect.Height();
|
||||
|
||||
cairo_surface_t* surf = cairo_image_surface_create(GfxFormatToCairoFormat(aFormat),
|
||||
aRect.width,
|
||||
aRect.height);
|
||||
aRectWidth,
|
||||
aRectHeight);
|
||||
// In certain scenarios, requesting larger than 8k image fails. Bug 803568
|
||||
// covers the details of how to run into it, but the full detailed
|
||||
// investigation hasn't been done to determine the underlying cause. We
|
||||
|
@ -236,14 +239,14 @@ CopyToImageSurface(unsigned char *aData,
|
|||
int32_t pixelWidth = BytesPerPixel(aFormat);
|
||||
|
||||
unsigned char* source = aData +
|
||||
aRect.y * aStride +
|
||||
aRect.x * pixelWidth;
|
||||
aRect.Y() * aStride +
|
||||
aRect.X() * pixelWidth;
|
||||
|
||||
MOZ_ASSERT(aStride >= aRect.width * pixelWidth);
|
||||
for (int32_t y = 0; y < aRect.height; ++y) {
|
||||
MOZ_ASSERT(aStride >= aRectWidth * pixelWidth);
|
||||
for (int32_t y = 0; y < aRectHeight; ++y) {
|
||||
memcpy(surfData + y * surfStride,
|
||||
source + y * aStride,
|
||||
aRect.width * pixelWidth);
|
||||
aRectWidth * pixelWidth);
|
||||
}
|
||||
cairo_surface_mark_dirty(surf);
|
||||
return surf;
|
||||
|
@ -277,16 +280,16 @@ cairo_surface_t* CreateSubImageForData(unsigned char* aData,
|
|||
return nullptr;
|
||||
}
|
||||
unsigned char *data = aData +
|
||||
aRect.y * aStride +
|
||||
aRect.x * BytesPerPixel(aFormat);
|
||||
aRect.Y() * aStride +
|
||||
aRect.X() * BytesPerPixel(aFormat);
|
||||
|
||||
cairo_surface_t *image =
|
||||
cairo_image_surface_create_for_data(data,
|
||||
GfxFormatToCairoFormat(aFormat),
|
||||
aRect.width,
|
||||
aRect.height,
|
||||
aRect.Width(),
|
||||
aRect.Height(),
|
||||
aStride);
|
||||
cairo_surface_set_device_offset(image, -aRect.x, -aRect.y);
|
||||
cairo_surface_set_device_offset(image, -aRect.X(), -aRect.Y());
|
||||
return image;
|
||||
}
|
||||
|
||||
|
@ -314,15 +317,15 @@ cairo_surface_t* ExtractSubImage(cairo_surface_t* aSurface,
|
|||
cairo_surface_t* similar =
|
||||
cairo_surface_create_similar(aSurface,
|
||||
cairo_surface_get_content(aSurface),
|
||||
aSubImage.width, aSubImage.height);
|
||||
aSubImage.Width(), aSubImage.Height());
|
||||
|
||||
cairo_t* ctx = cairo_create(similar);
|
||||
cairo_set_operator(ctx, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_set_source_surface(ctx, aSurface, -aSubImage.x, -aSubImage.y);
|
||||
cairo_set_source_surface(ctx, aSurface, -aSubImage.X(), -aSubImage.Y());
|
||||
cairo_paint(ctx);
|
||||
cairo_destroy(ctx);
|
||||
|
||||
cairo_surface_set_device_offset(similar, -aSubImage.x, -aSubImage.y);
|
||||
cairo_surface_set_device_offset(similar, -aSubImage.X(), -aSubImage.Y());
|
||||
return similar;
|
||||
}
|
||||
|
||||
|
@ -1056,12 +1059,12 @@ DrawTargetCairo::FillRect(const Rect &aRect,
|
|||
Rect r = aRect;
|
||||
|
||||
/* Clamp coordinates to work around a design bug in cairo */
|
||||
if (r.width > CAIRO_COORD_MAX ||
|
||||
r.height > CAIRO_COORD_MAX ||
|
||||
r.x < -CAIRO_COORD_MAX ||
|
||||
r.x > CAIRO_COORD_MAX ||
|
||||
r.y < -CAIRO_COORD_MAX ||
|
||||
r.y > CAIRO_COORD_MAX)
|
||||
if (r.Width() > CAIRO_COORD_MAX ||
|
||||
r.Height() > CAIRO_COORD_MAX ||
|
||||
r.X() < -CAIRO_COORD_MAX ||
|
||||
r.X() > CAIRO_COORD_MAX ||
|
||||
r.Y() < -CAIRO_COORD_MAX ||
|
||||
r.Y() > CAIRO_COORD_MAX)
|
||||
{
|
||||
if (!mat.IsRectilinear()) {
|
||||
gfxWarning() << "DrawTargetCairo::FillRect() misdrawing huge Rect "
|
||||
|
@ -1082,7 +1085,7 @@ DrawTargetCairo::FillRect(const Rect &aRect,
|
|||
}
|
||||
|
||||
cairo_new_path(mContext);
|
||||
cairo_rectangle(mContext, r.x, r.y, r.Width(), r.Height());
|
||||
cairo_rectangle(mContext, r.X(), r.Y(), r.Width(), r.Height());
|
||||
|
||||
bool pathBoundsClip = false;
|
||||
|
||||
|
@ -1109,13 +1112,13 @@ DrawTargetCairo::CopySurfaceInternal(cairo_surface_t* aSurface,
|
|||
|
||||
cairo_identity_matrix(mContext);
|
||||
|
||||
cairo_set_source_surface(mContext, aSurface, aDest.x - aSource.x, aDest.y - aSource.y);
|
||||
cairo_set_source_surface(mContext, aSurface, aDest.x - aSource.X(), aDest.y - aSource.Y());
|
||||
cairo_set_operator(mContext, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_set_antialias(mContext, CAIRO_ANTIALIAS_NONE);
|
||||
|
||||
cairo_reset_clip(mContext);
|
||||
cairo_new_path(mContext);
|
||||
cairo_rectangle(mContext, aDest.x, aDest.y, aSource.width, aSource.height);
|
||||
cairo_rectangle(mContext, aDest.x, aDest.y, aSource.Width(), aSource.Height());
|
||||
cairo_fill(mContext);
|
||||
}
|
||||
|
||||
|
@ -1160,19 +1163,17 @@ DrawTargetCairo::CopyRect(const IntRect &aSource,
|
|||
cairo_surface_t* surf = mSurface;
|
||||
|
||||
if (!SupportsSelfCopy(mSurface) &&
|
||||
aDest.y >= aSource.y &&
|
||||
aDest.y < aSource.YMost()) {
|
||||
aSource.ContainsY(aDest.y)) {
|
||||
cairo_surface_t* similar = cairo_surface_create_similar(mSurface,
|
||||
GfxFormatToCairoContent(GetFormat()),
|
||||
aSource.width, aSource.height);
|
||||
aSource.Width(), aSource.Height());
|
||||
cairo_t* ctx = cairo_create(similar);
|
||||
cairo_set_operator(ctx, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_set_source_surface(ctx, surf, -aSource.x, -aSource.y);
|
||||
cairo_set_source_surface(ctx, surf, -aSource.X(), -aSource.Y());
|
||||
cairo_paint(ctx);
|
||||
cairo_destroy(ctx);
|
||||
|
||||
source.x = 0;
|
||||
source.y = 0;
|
||||
source.MoveTo(0, 0);
|
||||
surf = similar;
|
||||
}
|
||||
|
||||
|
@ -1219,7 +1220,7 @@ DrawTargetCairo::StrokeRect(const Rect &aRect,
|
|||
AutoPrepareForDrawing prep(this, mContext);
|
||||
|
||||
cairo_new_path(mContext);
|
||||
cairo_rectangle(mContext, aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
cairo_rectangle(mContext, aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
|
||||
DrawPattern(aPattern, aStrokeOptions, aOptions, DRAW_STROKE);
|
||||
}
|
||||
|
|
|
@ -205,7 +205,7 @@ DrawTargetD2D1::DrawSurface(SourceSurface *aSurface,
|
|||
// 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.PreTranslate(aDest.X() - aSource.X() * xScale, aDest.Y() - aSource.Y() * yScale);
|
||||
transform.PreScale(xScale, yScale);
|
||||
|
||||
RefPtr<ID2D1Image> image = GetImageForSurface(aSurface, transform, ExtendMode::CLAMP);
|
||||
|
@ -358,7 +358,7 @@ DrawTargetD2D1::ClearRect(const Rect &aRect)
|
|||
|
||||
RefPtr<ID2D1SolidColorBrush> brush;
|
||||
mDC->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::White), getter_AddRefs(brush));
|
||||
mDC->PushAxisAlignedClip(D2D1::RectF(addClipRect.x, addClipRect.y, addClipRect.XMost(), addClipRect.YMost()), D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
|
||||
mDC->PushAxisAlignedClip(D2D1::RectF(addClipRect.X(), addClipRect.Y(), addClipRect.XMost(), addClipRect.YMost()), D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
|
||||
mDC->FillGeometry(geom, brush);
|
||||
mDC->PopAxisAlignedClip();
|
||||
|
||||
|
@ -458,7 +458,7 @@ DrawTargetD2D1::CopySurface(SourceSurface *aSurface,
|
|||
mDC->SetTransform(D2D1::IdentityMatrix());
|
||||
mTransformDirty = true;
|
||||
|
||||
Matrix mat = Matrix::Translation(aDestination.x - aSourceRect.x, aDestination.y - aSourceRect.y);
|
||||
Matrix mat = Matrix::Translation(aDestination.x - aSourceRect.X(), aDestination.y - aSourceRect.Y());
|
||||
RefPtr<ID2D1Image> image = GetImageForSurface(aSurface, mat, ExtendMode::CLAMP, nullptr, false);
|
||||
|
||||
if (!image) {
|
||||
|
@ -472,10 +472,8 @@ DrawTargetD2D1::CopySurface(SourceSurface *aSurface,
|
|||
}
|
||||
|
||||
IntRect sourceRect = aSourceRect;
|
||||
sourceRect.x += (aDestination.x - aSourceRect.x) - mat._31;
|
||||
sourceRect.width -= (aDestination.x - aSourceRect.x) - mat._31;
|
||||
sourceRect.y += (aDestination.y - aSourceRect.y) - mat._32;
|
||||
sourceRect.height -= (aDestination.y - aSourceRect.y) - mat._32;
|
||||
sourceRect.SetLeftEdge(sourceRect.X() + (aDestination.x - aSourceRect.X()) - mat._31);
|
||||
sourceRect.SetTopEdge(sourceRect.Y() + (aDestination.y - aSourceRect.Y()) - mat._32);
|
||||
|
||||
RefPtr<ID2D1Bitmap> bitmap;
|
||||
HRESULT hr = image->QueryInterface((ID2D1Bitmap**)getter_AddRefs(bitmap));
|
||||
|
@ -492,7 +490,7 @@ DrawTargetD2D1::CopySurface(SourceSurface *aSurface,
|
|||
return;
|
||||
}
|
||||
|
||||
Rect srcRect(Float(sourceRect.x), Float(sourceRect.y),
|
||||
Rect srcRect(Float(sourceRect.X()), Float(sourceRect.Y()),
|
||||
Float(aSourceRect.Width()), Float(aSourceRect.Height()));
|
||||
|
||||
Rect dstRect(Float(aDestination.x), Float(aDestination.y),
|
||||
|
@ -1883,7 +1881,7 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
|
|||
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);
|
||||
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());
|
||||
|
|
|
@ -202,7 +202,7 @@ VerifyRGBXCorners(uint8_t* aData, const IntSize &aSize, const int32_t aStride, S
|
|||
const int pixelSize = 4;
|
||||
MOZ_ASSERT(aSize.width * pixelSize <= aStride);
|
||||
|
||||
const int translation = bounds.y * aStride + bounds.x * pixelSize;
|
||||
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;
|
||||
|
@ -220,7 +220,7 @@ VerifyRGBXCorners(uint8_t* aData, const IntSize &aSize, const int32_t aStride, S
|
|||
int column = (offset % aStride) / pixelSize;
|
||||
gfxCriticalError() << "RGBX corner pixel at (" << column << "," << row << ") in "
|
||||
<< aSize.width << "x" << aSize.height << " surface, bounded by "
|
||||
<< "(" << bounds.x << "," << bounds.y << "," << width << ","
|
||||
<< "(" << bounds.X() << "," << bounds.Y() << "," << width << ","
|
||||
<< height << ") is not opaque: "
|
||||
<< int(aData[offset]) << ","
|
||||
<< int(aData[offset+1]) << ","
|
||||
|
@ -527,7 +527,7 @@ SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern, Float aAlpha = 1.0, Po
|
|||
|
||||
if (!pat.mSamplingRect.IsEmpty()) {
|
||||
image = ExtractSubset(image, pat.mSamplingRect);
|
||||
mat.preTranslate(pat.mSamplingRect.x, pat.mSamplingRect.y);
|
||||
mat.preTranslate(pat.mSamplingRect.X(), pat.mSamplingRect.Y());
|
||||
}
|
||||
|
||||
SkShader::TileMode xTileMode = ExtendModeToTileMode(pat.mExtendMode, Axis::X_AXIS);
|
||||
|
@ -872,16 +872,16 @@ ShrinkClippedStrokedRect(const Rect &aStrokedRect, const IntRect &aDeviceClip,
|
|||
Rect userSpaceStrokeClip =
|
||||
UserSpaceStrokeClip(aDeviceClip, aTransform, aStrokeOptions);
|
||||
RectDouble strokedRectDouble(
|
||||
aStrokedRect.x, aStrokedRect.y, aStrokedRect.Width(), aStrokedRect.Height());
|
||||
aStrokedRect.X(), aStrokedRect.Y(), aStrokedRect.Width(), aStrokedRect.Height());
|
||||
RectDouble intersection =
|
||||
strokedRectDouble.Intersect(RectDouble(userSpaceStrokeClip.x,
|
||||
userSpaceStrokeClip.y,
|
||||
strokedRectDouble.Intersect(RectDouble(userSpaceStrokeClip.X(),
|
||||
userSpaceStrokeClip.Y(),
|
||||
userSpaceStrokeClip.Width(),
|
||||
userSpaceStrokeClip.Height()));
|
||||
Double dashPeriodLength = DashPeriodLength(aStrokeOptions);
|
||||
if (intersection.IsEmpty() || dashPeriodLength == 0.0f) {
|
||||
return Rect(
|
||||
intersection.x, intersection.y, intersection.Width(), intersection.Height());
|
||||
return Rect(intersection.X(), intersection.Y(),
|
||||
intersection.Width(), intersection.Height());
|
||||
}
|
||||
|
||||
// Reduce the rectangle side lengths in multiples of the dash period length
|
||||
|
@ -893,8 +893,8 @@ ShrinkClippedStrokedRect(const Rect &aStrokedRect, const IntRect &aDeviceClip,
|
|||
insetBy.left = RoundDownToMultiple(insetBy.left, dashPeriodLength);
|
||||
|
||||
strokedRectDouble.Deflate(insetBy);
|
||||
return Rect(strokedRectDouble.x,
|
||||
strokedRectDouble.y,
|
||||
return Rect(strokedRectDouble.X(),
|
||||
strokedRectDouble.Y(),
|
||||
strokedRectDouble.Width(),
|
||||
strokedRectDouble.Height());
|
||||
}
|
||||
|
@ -1564,7 +1564,7 @@ DrawTarget::Draw3DTransformedSurface(SourceSurface* aSurface, const Matrix4x4& a
|
|||
return true;
|
||||
}
|
||||
// Offset the matrix by the transformed origin.
|
||||
fullMat.PostTranslate(-xformBounds.x, -xformBounds.y, 0);
|
||||
fullMat.PostTranslate(-xformBounds.X(), -xformBounds.Y(), 0);
|
||||
|
||||
// Read in the source data.
|
||||
sk_sp<SkImage> srcImage = GetSkImageForSurface(aSurface);
|
||||
|
@ -1853,7 +1853,7 @@ DrawTargetSkia::CopySurface(SourceSurface *aSurface,
|
|||
if (SkImageIsMask(image)) {
|
||||
mCanvas->clear(SK_ColorTRANSPARENT);
|
||||
}
|
||||
mCanvas->drawImage(image, -SkIntToScalar(aSourceRect.x), -SkIntToScalar(aSourceRect.y), &paint);
|
||||
mCanvas->drawImage(image, -SkIntToScalar(aSourceRect.X()), -SkIntToScalar(aSourceRect.Y()), &paint);
|
||||
mCanvas->restore();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,10 +38,10 @@ DrawTargetTiled::Init(const TileSet& aTiles)
|
|||
mTiles[i].mTileOrigin.x + mTiles[i].mDrawTarget->GetSize().width);
|
||||
uint32_t newYMost = max(mRect.YMost(),
|
||||
mTiles[i].mTileOrigin.y + mTiles[i].mDrawTarget->GetSize().height);
|
||||
mRect.x = min(mRect.x, mTiles[i].mTileOrigin.x);
|
||||
mRect.y = min(mRect.y, mTiles[i].mTileOrigin.y);
|
||||
mRect.width = newXMost - mRect.x;
|
||||
mRect.height = newYMost - mRect.y;
|
||||
mRect.MoveTo(min(mRect.X(), mTiles[i].mTileOrigin.x),
|
||||
min(mRect.Y(), mTiles[i].mTileOrigin.y));
|
||||
mRect.SetRightEdge(newXMost);
|
||||
mRect.SetBottomEdge(newYMost);
|
||||
mTiles[i].mDrawTarget->SetTransform(Matrix::Translation(-mTiles[i].mTileOrigin.x,
|
||||
-mTiles[i].mTileOrigin.y));
|
||||
}
|
||||
|
|
|
@ -812,7 +812,7 @@ 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_OFFSET, D2D1::Vector2F(Float(aValue.X()), Float(aValue.Y())));
|
||||
mEffect->SetValue(D2D1_TURBULENCE_PROP_SIZE, D2D1::Vector2F(Float(aValue.Width()), Float(aValue.Height())));
|
||||
return;
|
||||
}
|
||||
|
@ -820,7 +820,7 @@ FilterNodeD2D1::SetAttribute(uint32_t aIndex, const IntRect &aValue)
|
|||
UINT32 input = GetD2D1PropForAttribute(mType, aIndex);
|
||||
MOZ_ASSERT(input < mEffect->GetPropertyCount());
|
||||
|
||||
mEffect->SetValue(input, D2D1::RectF(Float(aValue.x), Float(aValue.y),
|
||||
mEffect->SetValue(input, D2D1::RectF(Float(aValue.X()), Float(aValue.Y()),
|
||||
Float(aValue.XMost()), Float(aValue.YMost())));
|
||||
}
|
||||
|
||||
|
@ -1021,7 +1021,7 @@ void
|
|||
FilterNodeConvolveD2D1::UpdateSourceRect()
|
||||
{
|
||||
mExtendInputEffect->SetValue(EXTENDINPUT_PROP_OUTPUT_RECT,
|
||||
D2D1::Vector4F(Float(mSourceRect.x), Float(mSourceRect.y),
|
||||
D2D1::Vector4F(Float(mSourceRect.X()), Float(mSourceRect.Y()),
|
||||
Float(mSourceRect.XMost()), Float(mSourceRect.YMost())));
|
||||
}
|
||||
|
||||
|
|
|
@ -316,22 +316,17 @@ DuplicateEdges(DataSourceSurface* aSurface, const IntRect &aFromRect)
|
|||
for (int32_t ix = 0; ix < 3; ix++) {
|
||||
switch (ix) {
|
||||
case 0:
|
||||
fill.x = 0;
|
||||
fill.SetWidth(aFromRect.x);
|
||||
sampleRect.x = fill.XMost();
|
||||
sampleRect.SetWidth(1);
|
||||
fill.SetRectX(0, aFromRect.X());
|
||||
sampleRect.SetRectX(fill.XMost(), 1);
|
||||
break;
|
||||
case 1:
|
||||
fill.x = aFromRect.x;
|
||||
fill.SetWidth(aFromRect.Width());
|
||||
sampleRect.x = fill.x;
|
||||
sampleRect.SetWidth(fill.Width());
|
||||
fill.SetRectX(aFromRect.X(), aFromRect.Width());
|
||||
sampleRect.SetRectX(fill.X(), fill.Width());
|
||||
break;
|
||||
case 2:
|
||||
fill.x = aFromRect.XMost();
|
||||
fill.SetWidth(size.width - fill.x);
|
||||
sampleRect.x = fill.x - 1;
|
||||
sampleRect.SetWidth(1);
|
||||
fill.MoveToX(aFromRect.XMost());
|
||||
fill.SetRightEdge(size.width);
|
||||
sampleRect.SetRectX(fill.X() - 1, 1);
|
||||
break;
|
||||
}
|
||||
if (fill.Width() <= 0) {
|
||||
|
@ -341,22 +336,17 @@ DuplicateEdges(DataSourceSurface* aSurface, const IntRect &aFromRect)
|
|||
for (int32_t iy = 0; iy < 3; iy++) {
|
||||
switch (iy) {
|
||||
case 0:
|
||||
fill.y = 0;
|
||||
fill.SetHeight(aFromRect.y);
|
||||
sampleRect.y = fill.YMost();
|
||||
sampleRect.SetHeight(1);
|
||||
fill.SetRectY(0, aFromRect.Y());
|
||||
sampleRect.SetRectY(fill.YMost(), 1);
|
||||
break;
|
||||
case 1:
|
||||
fill.y = aFromRect.y;
|
||||
fill.SetHeight(aFromRect.Height());
|
||||
sampleRect.y = fill.y;
|
||||
sampleRect.SetHeight(fill.Height());
|
||||
fill.SetRectY(aFromRect.Y(), aFromRect.Height());
|
||||
sampleRect.SetRectY(fill.Y(), fill.Height());
|
||||
break;
|
||||
case 2:
|
||||
fill.y = aFromRect.YMost();
|
||||
fill.SetHeight(size.height - fill.y);
|
||||
sampleRect.y = fill.y - 1;
|
||||
sampleRect.SetHeight(1);
|
||||
fill.MoveToY(aFromRect.YMost());
|
||||
fill.SetBottomEdge(size.height);
|
||||
sampleRect.SetRectY(fill.Y() - 1, 1);
|
||||
break;
|
||||
}
|
||||
if (fill.Height() <= 0) {
|
||||
|
@ -382,8 +372,8 @@ DuplicateEdges(DataSourceSurface* aSurface, const IntRect &aFromRect)
|
|||
static IntPoint
|
||||
TileIndex(const IntRect &aFirstTileRect, const IntPoint &aPoint)
|
||||
{
|
||||
return IntPoint(int32_t(floor(double(aPoint.x - aFirstTileRect.x) / aFirstTileRect.Width())),
|
||||
int32_t(floor(double(aPoint.y - aFirstTileRect.y) / aFirstTileRect.Height())));
|
||||
return IntPoint(int32_t(floor(double(aPoint.x - aFirstTileRect.X()) / aFirstTileRect.Width())),
|
||||
int32_t(floor(double(aPoint.y - aFirstTileRect.Y()) / aFirstTileRect.Height())));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -396,8 +386,8 @@ TileSurface(DataSourceSurface* aSource, DataSourceSurface* aTarget, const IntPoi
|
|||
|
||||
for (int32_t ix = startIndex.x; ix <= endIndex.x; ix++) {
|
||||
for (int32_t iy = startIndex.y; iy <= endIndex.y; iy++) {
|
||||
IntPoint destPoint(sourceRect.x + ix * sourceRect.Width(),
|
||||
sourceRect.y + iy * sourceRect.Height());
|
||||
IntPoint destPoint(sourceRect.X() + ix * sourceRect.Width(),
|
||||
sourceRect.Y() + iy * sourceRect.Height());
|
||||
IntRect destRect(destPoint, sourceRect.Size());
|
||||
destRect = destRect.Intersect(targetRect);
|
||||
IntRect srcRect = destRect - destPoint;
|
||||
|
@ -1118,8 +1108,8 @@ FilterNodeTransformSoftware::Render(const IntRect& aRect)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Matrix transform = Matrix::Translation(srcRect.x, srcRect.y) * mMatrix *
|
||||
Matrix::Translation(-aRect.x, -aRect.y);
|
||||
Matrix transform = Matrix::Translation(srcRect.X(), srcRect.Y()) * mMatrix *
|
||||
Matrix::Translation(-aRect.X(), -aRect.Y());
|
||||
if (transform.IsIdentity() && srcRect.Size() == aRect.Size()) {
|
||||
return input.forget();
|
||||
}
|
||||
|
@ -1219,7 +1209,7 @@ ApplyMorphology(const IntRect& aSourceRect, DataSourceSurface* aInput,
|
|||
{
|
||||
IntRect srcRect = aSourceRect - aDestRect.TopLeft();
|
||||
IntRect destRect = aDestRect - aDestRect.TopLeft();
|
||||
IntRect tmpRect(destRect.x, srcRect.y, destRect.Width(), srcRect.Height());
|
||||
IntRect tmpRect(destRect.X(), srcRect.Y(), destRect.Width(), srcRect.Height());
|
||||
#ifdef DEBUG
|
||||
IntMargin margin = srcRect - destRect;
|
||||
MOZ_ASSERT(margin.top >= ry && margin.right >= rx &&
|
||||
|
@ -1555,8 +1545,8 @@ 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()));
|
||||
mSourceRect.SetRect(int32_t(aSourceRect.X()), int32_t(aSourceRect.Y()),
|
||||
int32_t(aSourceRect.Width()), int32_t(aSourceRect.Height()));
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
|
@ -1565,11 +1555,11 @@ struct CompareIntRects
|
|||
{
|
||||
bool operator()(const IntRect& a, const IntRect& b) const
|
||||
{
|
||||
if (a.x != b.x) {
|
||||
return a.x < b.x;
|
||||
if (a.X() != b.X()) {
|
||||
return a.X() < b.X();
|
||||
}
|
||||
if (a.y != b.y) {
|
||||
return a.y < b.y;
|
||||
if (a.Y() != b.Y()) {
|
||||
return a.Y() < b.Y();
|
||||
}
|
||||
if (a.Width() != b.Width()) {
|
||||
return a.Width() < b.Width();
|
||||
|
@ -3565,7 +3555,7 @@ FilterNodeLightingSoftware<LightType, LightingType>::DoRender(const IntRect& aRe
|
|||
x, y, mSurfaceScale,
|
||||
aKernelUnitLengthX, aKernelUnitLengthY);
|
||||
|
||||
IntPoint pointInFilterSpace(aRect.x + x, aRect.y + y);
|
||||
IntPoint pointInFilterSpace(aRect.X() + x, aRect.Y() + y);
|
||||
Float Z = mSurfaceScale * sourceData[sourceIndex] / 255.0f;
|
||||
Point3D pt(pointInFilterSpace.x, pointInFilterSpace.y, Z);
|
||||
Point3D rayDir = mLight.GetVectorToLight(pt);
|
||||
|
|
|
@ -395,9 +395,9 @@ inline void ApplyMorphologyHorizontal_SIMD(uint8_t* aSourceData, int32_t aSource
|
|||
IntRect sourceRect = aDestRect;
|
||||
sourceRect.Inflate(aRadius, 0);
|
||||
|
||||
for (int32_t y = aDestRect.y; y < aDestRect.YMost(); y++) {
|
||||
int32_t kernelStartX = aDestRect.x - aRadius;
|
||||
for (int32_t x = aDestRect.x; x < aDestRect.XMost(); x += 4, kernelStartX += 4) {
|
||||
for (int32_t y = aDestRect.Y(); y < aDestRect.YMost(); y++) {
|
||||
int32_t kernelStartX = aDestRect.X() - aRadius;
|
||||
for (int32_t x = aDestRect.X(); x < aDestRect.XMost(); x += 4, kernelStartX += 4) {
|
||||
// We process four pixels (16 color values) at a time.
|
||||
// aSourceData[0] points to the pixel located at aDestRect.TopLeft();
|
||||
// source values can be read beyond that because the source is extended
|
||||
|
@ -455,10 +455,10 @@ static void ApplyMorphologyVertical_SIMD(uint8_t* aSourceData, int32_t aSourceSt
|
|||
op == MORPHOLOGY_OPERATOR_DILATE,
|
||||
"unexpected morphology operator");
|
||||
|
||||
int32_t startY = aDestRect.y - aRadius;
|
||||
int32_t endY = aDestRect.y + aRadius;
|
||||
for (int32_t y = aDestRect.y; y < aDestRect.YMost(); y++, startY++, endY++) {
|
||||
for (int32_t x = aDestRect.x; x < aDestRect.XMost(); x += 4) {
|
||||
int32_t startY = aDestRect.Y() - aRadius;
|
||||
int32_t endY = aDestRect.Y() + aRadius;
|
||||
for (int32_t y = aDestRect.Y(); y < aDestRect.YMost(); y++, startY++, endY++) {
|
||||
for (int32_t x = aDestRect.X(); x < aDestRect.XMost(); x += 4) {
|
||||
int32_t sourceIndex = startY * aSourceStride + 4 * x;
|
||||
u8x16_t u = simd::Load8<u8x16_t>(&aSourceData[sourceIndex]);
|
||||
sourceIndex += aSourceStride;
|
||||
|
|
|
@ -40,10 +40,10 @@ ApplyMorphologyHorizontal_Scalar(uint8_t* aSourceData, int32_t aSourceStride,
|
|||
Operator == MORPHOLOGY_OPERATOR_DILATE,
|
||||
"unexpected morphology operator");
|
||||
|
||||
for (int32_t y = aDestRect.y; y < aDestRect.YMost(); y++) {
|
||||
int32_t startX = aDestRect.x - aRadius;
|
||||
int32_t endX = aDestRect.x + aRadius;
|
||||
for (int32_t x = aDestRect.x; x < aDestRect.XMost(); x++, startX++, endX++) {
|
||||
for (int32_t y = aDestRect.Y(); y < aDestRect.YMost(); y++) {
|
||||
int32_t startX = aDestRect.X() - aRadius;
|
||||
int32_t endX = aDestRect.X() + aRadius;
|
||||
for (int32_t x = aDestRect.X(); x < aDestRect.XMost(); x++, startX++, endX++) {
|
||||
int32_t sourceIndex = y * aSourceStride + 4 * startX;
|
||||
uint8_t u[4];
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
|
@ -92,10 +92,10 @@ static void ApplyMorphologyVertical_Scalar(uint8_t* aSourceData, int32_t aSource
|
|||
Operator == MORPHOLOGY_OPERATOR_DILATE,
|
||||
"unexpected morphology operator");
|
||||
|
||||
int32_t startY = aDestRect.y - aRadius;
|
||||
int32_t endY = aDestRect.y + aRadius;
|
||||
for (int32_t y = aDestRect.y; y < aDestRect.YMost(); y++, startY++, endY++) {
|
||||
for (int32_t x = aDestRect.x; x < aDestRect.XMost(); x++) {
|
||||
int32_t startY = aDestRect.Y() - aRadius;
|
||||
int32_t endY = aDestRect.Y() + aRadius;
|
||||
for (int32_t y = aDestRect.Y(); y < aDestRect.YMost(); y++, startY++, endY++) {
|
||||
for (int32_t x = aDestRect.X(); x < aDestRect.XMost(); x++) {
|
||||
int32_t sourceIndex = startY * aSourceStride + 4 * x;
|
||||
uint8_t u[4];
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
|
|
|
@ -41,7 +41,7 @@ static inline D2D1_SIZE_U D2DIntSize(const IntSize &aSize)
|
|||
template <typename T>
|
||||
static inline D2D1_RECT_F D2DRect(const T &aRect)
|
||||
{
|
||||
return D2D1::RectF(aRect.x, aRect.y, aRect.XMost(), aRect.YMost());
|
||||
return D2D1::RectF(aRect.X(), aRect.Y(), aRect.XMost(), aRect.YMost());
|
||||
}
|
||||
|
||||
static inline D2D1_EXTEND_MODE D2DExtend(ExtendMode aExtendMode, Axis aAxis)
|
||||
|
@ -579,7 +579,7 @@ CreatePartialBitmapForSurface(DataSourceSurface *aSurface, const Matrix &aDestin
|
|||
|
||||
Rect uploadRect(0, 0, Float(size.width), Float(size.height));
|
||||
if (aSourceRect) {
|
||||
uploadRect = Rect(aSourceRect->x, aSourceRect->y, aSourceRect->Width(), aSourceRect->Height());
|
||||
uploadRect = Rect(aSourceRect->X(), aSourceRect->Y(), aSourceRect->Width(), aSourceRect->Height());
|
||||
}
|
||||
|
||||
// Limit the uploadRect as much as possible without supporting discontiguous uploads
|
||||
|
@ -609,11 +609,11 @@ CreatePartialBitmapForSurface(DataSourceSurface *aSurface, const Matrix &aDestin
|
|||
|
||||
// We now proceed to check if we can limit at least one dimension of the
|
||||
// upload rect safely without looking at extend mode.
|
||||
} else if (rect.x >= 0 && rect.XMost() < size.width) {
|
||||
uploadRect.x = rect.x;
|
||||
} else if (rect.X() >= 0 && rect.XMost() < size.width) {
|
||||
uploadRect.MoveToX(rect.X());
|
||||
uploadRect.SetWidth(rect.Width());
|
||||
} else if (rect.y >= 0 && rect.YMost() < size.height) {
|
||||
uploadRect.y = rect.y;
|
||||
} else if (rect.Y() >= 0 && rect.YMost() < size.height) {
|
||||
uploadRect.MoveToY(rect.Y());
|
||||
uploadRect.SetHeight(rect.Height());
|
||||
}
|
||||
|
||||
|
@ -633,13 +633,13 @@ CreatePartialBitmapForSurface(DataSourceSurface *aSurface, const Matrix &aDestin
|
|||
|
||||
// A partial upload will suffice.
|
||||
aRT->CreateBitmap(D2D1::SizeU(uint32_t(uploadRect.Width()), uint32_t(uploadRect.Height())),
|
||||
mapping.GetData() + int(uploadRect.x) * Bpp + int(uploadRect.y) * mapping.GetStride(),
|
||||
mapping.GetData() + int(uploadRect.X()) * Bpp + int(uploadRect.Y()) * mapping.GetStride(),
|
||||
mapping.GetStride(),
|
||||
D2D1::BitmapProperties(D2DPixelFormat(aSurface->GetFormat())),
|
||||
getter_AddRefs(bitmap));
|
||||
}
|
||||
|
||||
aSourceTransform.PreTranslate(uploadRect.x, uploadRect.y);
|
||||
aSourceTransform.PreTranslate(uploadRect.X(), uploadRect.Y());
|
||||
|
||||
return bitmap.forget();
|
||||
} else {
|
||||
|
|
|
@ -274,28 +274,28 @@ PointToSkPoint(const Point &aPoint)
|
|||
static inline SkRect
|
||||
RectToSkRect(const Rect& aRect)
|
||||
{
|
||||
return SkRect::MakeXYWH(SkFloatToScalar(aRect.x), SkFloatToScalar(aRect.y),
|
||||
return SkRect::MakeXYWH(SkFloatToScalar(aRect.X()), SkFloatToScalar(aRect.Y()),
|
||||
SkFloatToScalar(aRect.Width()), SkFloatToScalar(aRect.Height()));
|
||||
}
|
||||
|
||||
static inline SkRect
|
||||
IntRectToSkRect(const IntRect& aRect)
|
||||
{
|
||||
return SkRect::MakeXYWH(SkIntToScalar(aRect.x), SkIntToScalar(aRect.y),
|
||||
return SkRect::MakeXYWH(SkIntToScalar(aRect.X()), SkIntToScalar(aRect.Y()),
|
||||
SkIntToScalar(aRect.Width()), SkIntToScalar(aRect.Height()));
|
||||
}
|
||||
|
||||
static inline SkIRect
|
||||
RectToSkIRect(const Rect& aRect)
|
||||
{
|
||||
return SkIRect::MakeXYWH(int32_t(aRect.x), int32_t(aRect.y),
|
||||
return SkIRect::MakeXYWH(int32_t(aRect.X()), int32_t(aRect.Y()),
|
||||
int32_t(aRect.Width()), int32_t(aRect.Height()));
|
||||
}
|
||||
|
||||
static inline SkIRect
|
||||
IntRectToSkIRect(const IntRect& aRect)
|
||||
{
|
||||
return SkIRect::MakeXYWH(aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
return SkIRect::MakeXYWH(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
}
|
||||
|
||||
static inline IntRect
|
||||
|
|
|
@ -770,12 +770,12 @@ public:
|
|||
// Since intercept.w will always be 0 here, we interpret x,y,z as a
|
||||
// direction towards an infinite vanishing point.
|
||||
if (intercept.x < 0.0f) {
|
||||
min_x = aClip.x;
|
||||
min_x = aClip.X();
|
||||
} else if (intercept.x > 0.0f) {
|
||||
max_x = aClip.XMost();
|
||||
}
|
||||
if (intercept.y < 0.0f) {
|
||||
min_y = aClip.y;
|
||||
min_y = aClip.Y();
|
||||
} else if (intercept.y > 0.0f) {
|
||||
max_y = aClip.YMost();
|
||||
}
|
||||
|
@ -845,17 +845,17 @@ public:
|
|||
Point4DTyped<UnknownUnits, F> points[2][kTransformAndClipRectMaxVerts];
|
||||
Point4DTyped<UnknownUnits, F>* dstPoint = points[0];
|
||||
|
||||
*dstPoint++ = TransformPoint(Point4DTyped<UnknownUnits, F>(aRect.x, aRect.y, 0, 1));
|
||||
*dstPoint++ = TransformPoint(Point4DTyped<UnknownUnits, F>(aRect.XMost(), aRect.y, 0, 1));
|
||||
*dstPoint++ = TransformPoint(Point4DTyped<UnknownUnits, F>(aRect.X(), aRect.Y(), 0, 1));
|
||||
*dstPoint++ = TransformPoint(Point4DTyped<UnknownUnits, F>(aRect.XMost(), aRect.Y(), 0, 1));
|
||||
*dstPoint++ = TransformPoint(Point4DTyped<UnknownUnits, F>(aRect.XMost(), aRect.YMost(), 0, 1));
|
||||
*dstPoint++ = TransformPoint(Point4DTyped<UnknownUnits, F>(aRect.x, aRect.YMost(), 0, 1));
|
||||
*dstPoint++ = TransformPoint(Point4DTyped<UnknownUnits, F>(aRect.X(), aRect.YMost(), 0, 1));
|
||||
|
||||
// View frustum clipping planes are described as normals originating from
|
||||
// the 0,0,0,0 origin.
|
||||
Point4DTyped<UnknownUnits, F> planeNormals[4];
|
||||
planeNormals[0] = Point4DTyped<UnknownUnits, F>(1.0, 0.0, 0.0, -aClip.x);
|
||||
planeNormals[0] = Point4DTyped<UnknownUnits, F>(1.0, 0.0, 0.0, -aClip.X());
|
||||
planeNormals[1] = Point4DTyped<UnknownUnits, F>(-1.0, 0.0, 0.0, aClip.XMost());
|
||||
planeNormals[2] = Point4DTyped<UnknownUnits, F>(0.0, 1.0, 0.0, -aClip.y);
|
||||
planeNormals[2] = Point4DTyped<UnknownUnits, F>(0.0, 1.0, 0.0, -aClip.Y());
|
||||
planeNormals[3] = Point4DTyped<UnknownUnits, F>(0.0, -1.0, 0.0, aClip.YMost());
|
||||
|
||||
// Iterate through each clipping plane and clip the polygon.
|
||||
|
|
|
@ -275,10 +275,10 @@ public:
|
|||
static PolygonTyped<Units> FromRect(const RectTyped<Units>& aRect)
|
||||
{
|
||||
nsTArray<Point4DType> points {
|
||||
Point4DType(aRect.x, aRect.y, 0.0f, 1.0f),
|
||||
Point4DType(aRect.x, aRect.YMost(), 0.0f, 1.0f),
|
||||
Point4DType(aRect.X(), aRect.Y(), 0.0f, 1.0f),
|
||||
Point4DType(aRect.X(), aRect.YMost(), 0.0f, 1.0f),
|
||||
Point4DType(aRect.XMost(), aRect.YMost(), 0.0f, 1.0f),
|
||||
Point4DType(aRect.XMost(), aRect.y, 0.0f, 1.0f)
|
||||
Point4DType(aRect.XMost(), aRect.Y(), 0.0f, 1.0f)
|
||||
};
|
||||
|
||||
return PolygonTyped<Units>(Move(points));
|
||||
|
|
|
@ -1740,7 +1740,7 @@ RecordedFillRect::RecordedFillRect(S &aStream)
|
|||
inline void
|
||||
RecordedFillRect::OutputSimpleEventInfo(std::stringstream &aStringStream) const
|
||||
{
|
||||
aStringStream << "[" << mDT << "] FillRect (" << mRect.x << ", " << mRect.y << " - " << mRect.Width() << " x " << mRect.Height() << ") ";
|
||||
aStringStream << "[" << mDT << "] FillRect (" << mRect.X() << ", " << mRect.Y() << " - " << mRect.Width() << " x " << mRect.Height() << ") ";
|
||||
OutputSimplePatternInfo(mPattern, aStringStream);
|
||||
}
|
||||
|
||||
|
@ -1775,7 +1775,7 @@ RecordedStrokeRect::RecordedStrokeRect(S &aStream)
|
|||
inline void
|
||||
RecordedStrokeRect::OutputSimpleEventInfo(std::stringstream &aStringStream) const
|
||||
{
|
||||
aStringStream << "[" << mDT << "] StrokeRect (" << mRect.x << ", " << mRect.y << " - " << mRect.Width() << " x " << mRect.Height()
|
||||
aStringStream << "[" << mDT << "] StrokeRect (" << mRect.X() << ", " << mRect.Y() << " - " << mRect.Width() << " x " << mRect.Height()
|
||||
<< ") LineWidth: " << mStrokeOptions.mLineWidth << "px ";
|
||||
OutputSimplePatternInfo(mPattern, aStringStream);
|
||||
}
|
||||
|
@ -1993,7 +1993,7 @@ RecordedClearRect::RecordedClearRect(S &aStream)
|
|||
inline void
|
||||
RecordedClearRect::OutputSimpleEventInfo(std::stringstream &aStringStream) const
|
||||
{
|
||||
aStringStream << "[" << mDT<< "] ClearRect (" << mRect.x << ", " << mRect.y << " - " << mRect.Width() << " x " << mRect.Height() << ") ";
|
||||
aStringStream << "[" << mDT<< "] ClearRect (" << mRect.X() << ", " << mRect.Y() << " - " << mRect.Width() << " x " << mRect.Height() << ") ";
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
@ -2082,7 +2082,7 @@ RecordedPushClipRect::RecordedPushClipRect(S &aStream)
|
|||
inline void
|
||||
RecordedPushClipRect::OutputSimpleEventInfo(std::stringstream &aStringStream) const
|
||||
{
|
||||
aStringStream << "[" << mDT << "] PushClipRect (" << mRect.x << ", " << mRect.y << " - " << mRect.Width() << " x " << mRect.Height() << ") ";
|
||||
aStringStream << "[" << mDT << "] PushClipRect (" << mRect.X() << ", " << mRect.Y() << " - " << mRect.Width() << " x " << mRect.Height() << ") ";
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
|
|
@ -118,26 +118,26 @@ struct IntRectTyped :
|
|||
static IntRectTyped<units> RoundIn(const RectTyped<units, float>& aRect) {
|
||||
auto tmp(aRect);
|
||||
tmp.RoundIn();
|
||||
return IntRectTyped(int32_t(tmp.x), int32_t(tmp.y),
|
||||
return IntRectTyped(int32_t(tmp.X()), int32_t(tmp.Y()),
|
||||
int32_t(tmp.Width()), int32_t(tmp.Height()));
|
||||
}
|
||||
|
||||
static IntRectTyped<units> RoundOut(const RectTyped<units, float>& aRect) {
|
||||
auto tmp(aRect);
|
||||
tmp.RoundOut();
|
||||
return IntRectTyped(int32_t(tmp.x), int32_t(tmp.y),
|
||||
return IntRectTyped(int32_t(tmp.X()), int32_t(tmp.Y()),
|
||||
int32_t(tmp.Width()), int32_t(tmp.Height()));
|
||||
}
|
||||
|
||||
static IntRectTyped<units> Round(const RectTyped<units, float>& aRect) {
|
||||
auto tmp(aRect);
|
||||
tmp.Round();
|
||||
return IntRectTyped(int32_t(tmp.x), int32_t(tmp.y),
|
||||
return IntRectTyped(int32_t(tmp.X()), int32_t(tmp.Y()),
|
||||
int32_t(tmp.Width()), int32_t(tmp.Height()));
|
||||
}
|
||||
|
||||
static IntRectTyped<units> Truncate(const RectTyped<units, float>& aRect) {
|
||||
return IntRectTyped::Truncate(aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
return IntRectTyped::Truncate(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
}
|
||||
|
||||
// Rounding isn't meaningful on an integer rectangle.
|
||||
|
@ -149,17 +149,17 @@ struct IntRectTyped :
|
|||
// to and from unknown types should be removed.
|
||||
|
||||
static IntRectTyped<units> FromUnknownRect(const IntRectTyped<UnknownUnits>& rect) {
|
||||
return IntRectTyped<units>(rect.x, rect.y, rect.Width(), rect.Height());
|
||||
return IntRectTyped<units>(rect.X(), rect.Y(), rect.Width(), rect.Height());
|
||||
}
|
||||
|
||||
IntRectTyped<UnknownUnits> ToUnknownRect() const {
|
||||
return IntRectTyped<UnknownUnits>(this->x, this->y, this->Width(), this->Height());
|
||||
return IntRectTyped<UnknownUnits>(this->X(), this->Y(), this->Width(), this->Height());
|
||||
}
|
||||
|
||||
bool Overflows() const {
|
||||
CheckedInt<int32_t> xMost = this->x;
|
||||
CheckedInt<int32_t> xMost = this->X();
|
||||
xMost += this->Width();
|
||||
CheckedInt<int32_t> yMost = this->y;
|
||||
CheckedInt<int32_t> yMost = this->Y();
|
||||
yMost += this->Height();
|
||||
return !xMost.isValid() || !yMost.isValid();
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ struct RectTyped :
|
|||
RectTyped(F _x, F _y, F _width, F _height) :
|
||||
Super(_x, _y, _width, _height) {}
|
||||
explicit RectTyped(const IntRectTyped<units>& rect) :
|
||||
Super(F(rect.x), F(rect.y),
|
||||
Super(F(rect.X()), F(rect.Y()),
|
||||
F(rect.Width()), F(rect.Height())) {}
|
||||
|
||||
void NudgeToIntegers()
|
||||
|
@ -256,7 +256,7 @@ struct RectTyped :
|
|||
{
|
||||
*aOut = IntRectTyped<units>(int32_t(this->X()), int32_t(this->Y()),
|
||||
int32_t(this->Width()), int32_t(this->Height()));
|
||||
return RectTyped<units, F>(F(aOut->x), F(aOut->y),
|
||||
return RectTyped<units, F>(F(aOut->X()), F(aOut->Y()),
|
||||
F(aOut->Width()), F(aOut->Height()))
|
||||
.IsEqualEdges(*this);
|
||||
}
|
||||
|
@ -265,11 +265,11 @@ struct RectTyped :
|
|||
// unknown types should be removed.
|
||||
|
||||
static RectTyped<units, F> FromUnknownRect(const RectTyped<UnknownUnits, F>& rect) {
|
||||
return RectTyped<units, F>(rect.x, rect.y, rect.Width(), rect.Height());
|
||||
return RectTyped<units, F>(rect.X(), rect.Y(), rect.Width(), rect.Height());
|
||||
}
|
||||
|
||||
RectTyped<UnknownUnits, F> ToUnknownRect() const {
|
||||
return RectTyped<UnknownUnits, F>(this->x, this->y, this->Width(), this->Height());
|
||||
return RectTyped<UnknownUnits, F>(this->X(), this->Y(), this->Width(), this->Height());
|
||||
}
|
||||
|
||||
// This is here only to keep IPDL-generated code happy. DO NOT USE.
|
||||
|
@ -286,8 +286,8 @@ IntRectTyped<units> RoundedToInt(const RectTyped<units>& aRect)
|
|||
{
|
||||
RectTyped<units> copy(aRect);
|
||||
copy.Round();
|
||||
return IntRectTyped<units>(int32_t(copy.x),
|
||||
int32_t(copy.y),
|
||||
return IntRectTyped<units>(int32_t(copy.X()),
|
||||
int32_t(copy.Y()),
|
||||
int32_t(copy.Width()),
|
||||
int32_t(copy.Height()));
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ IntRectTyped<units> TruncatedToInt(const RectTyped<units>& aRect) {
|
|||
template<class units>
|
||||
RectTyped<units> IntRectToRect(const IntRectTyped<units>& aRect)
|
||||
{
|
||||
return RectTyped<units>(aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
return RectTyped<units>(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
}
|
||||
|
||||
// Convenience functions for intersecting and unioning two rectangles wrapped in Maybes.
|
||||
|
|
|
@ -179,8 +179,8 @@ SVGTurbulenceRenderer<Type,Stitch,f32x4_t,i32x4_t,u8x16_t>::CreateStitchInfo(con
|
|||
StitchInfo stitch;
|
||||
stitch.width = int32_t(floorf(aTileRect.Width() * mBaseFrequency.width + 0.5f));
|
||||
stitch.height = int32_t(floorf(aTileRect.Height() * mBaseFrequency.height + 0.5f));
|
||||
stitch.wrapX = int32_t(aTileRect.x * mBaseFrequency.width) + stitch.width;
|
||||
stitch.wrapY = int32_t(aTileRect.y * mBaseFrequency.height) + stitch.height;
|
||||
stitch.wrapX = int32_t(aTileRect.X() * mBaseFrequency.width) + stitch.width;
|
||||
stitch.wrapY = int32_t(aTileRect.Y() * mBaseFrequency.height) + stitch.height;
|
||||
return stitch;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,15 +52,15 @@ DecomposeIntoNoRepeatTriangles(const gfx::IntRect& aTexCoordRect,
|
|||
{
|
||||
// normalize this
|
||||
gfx::IntRect tcr(aTexCoordRect);
|
||||
while (tcr.x >= aTexSize.width)
|
||||
tcr.x -= aTexSize.width;
|
||||
while (tcr.y >= aTexSize.height)
|
||||
tcr.y -= aTexSize.height;
|
||||
while (tcr.X() >= aTexSize.width)
|
||||
tcr.MoveByX(-aTexSize.width);
|
||||
while (tcr.Y() >= aTexSize.height)
|
||||
tcr.MoveByY(-aTexSize.height);
|
||||
|
||||
// Compute top left and bottom right tex coordinates
|
||||
GLfloat tl[2] =
|
||||
{ GLfloat(tcr.x) / GLfloat(aTexSize.width),
|
||||
GLfloat(tcr.y) / GLfloat(aTexSize.height) };
|
||||
{ GLfloat(tcr.X()) / GLfloat(aTexSize.width),
|
||||
GLfloat(tcr.Y()) / GLfloat(aTexSize.height) };
|
||||
GLfloat br[2] =
|
||||
{ GLfloat(tcr.XMost()) / GLfloat(aTexSize.width),
|
||||
GLfloat(tcr.YMost()) / GLfloat(aTexSize.height) };
|
||||
|
@ -70,7 +70,7 @@ DecomposeIntoNoRepeatTriangles(const gfx::IntRect& aTexCoordRect,
|
|||
// texture coordinates.
|
||||
|
||||
bool xwrap = false, ywrap = false;
|
||||
if (tcr.x < 0 || tcr.x > aTexSize.width ||
|
||||
if (tcr.X() < 0 || tcr.X() > aTexSize.width ||
|
||||
tcr.XMost() < 0 || tcr.XMost() > aTexSize.width)
|
||||
{
|
||||
xwrap = true;
|
||||
|
@ -78,7 +78,7 @@ DecomposeIntoNoRepeatTriangles(const gfx::IntRect& aTexCoordRect,
|
|||
br[0] = WrapTexCoord(br[0]);
|
||||
}
|
||||
|
||||
if (tcr.y < 0 || tcr.y > aTexSize.height ||
|
||||
if (tcr.Y() < 0 || tcr.Y() > aTexSize.height ||
|
||||
tcr.YMost() < 0 || tcr.YMost() > aTexSize.height)
|
||||
{
|
||||
ywrap = true;
|
||||
|
|
|
@ -174,20 +174,20 @@ SubRectMat3(const float x, const float y, const float w, const float h)
|
|||
Mat3
|
||||
SubRectMat3(const gfx::IntRect& subrect, const gfx::IntSize& size)
|
||||
{
|
||||
return SubRectMat3(float(subrect.x) / size.width,
|
||||
float(subrect.y) / size.height,
|
||||
float(subrect.width) / size.width,
|
||||
float(subrect.height) / size.height);
|
||||
return SubRectMat3(float(subrect.X()) / size.width,
|
||||
float(subrect.Y()) / size.height,
|
||||
float(subrect.Width()) / size.width,
|
||||
float(subrect.Height()) / size.height);
|
||||
}
|
||||
|
||||
Mat3
|
||||
SubRectMat3(const gfx::IntRect& bigSubrect, const gfx::IntSize& smallSize,
|
||||
const gfx::IntSize& divisors)
|
||||
{
|
||||
const float x = float(bigSubrect.x) / divisors.width;
|
||||
const float y = float(bigSubrect.y) / divisors.height;
|
||||
const float w = float(bigSubrect.width) / divisors.width;
|
||||
const float h = float(bigSubrect.height) / divisors.height;
|
||||
const float x = float(bigSubrect.X()) / divisors.width;
|
||||
const float y = float(bigSubrect.Y()) / divisors.height;
|
||||
const float w = float(bigSubrect.Width()) / divisors.width;
|
||||
const float h = float(bigSubrect.Height()) / divisors.height;
|
||||
return SubRectMat3(x / smallSize.width,
|
||||
y / smallSize.height,
|
||||
w / smallSize.width,
|
||||
|
@ -425,10 +425,10 @@ DrawBlitProg::Draw(const BaseArgs& args, const YUVArgs* const argsYUV) const
|
|||
Mat3 destMatrix;
|
||||
if (args.destRect) {
|
||||
const auto& destRect = args.destRect.value();
|
||||
destMatrix = SubRectMat3(destRect.x / args.destSize.width,
|
||||
destRect.y / args.destSize.height,
|
||||
destRect.width / args.destSize.width,
|
||||
destRect.height / args.destSize.height);
|
||||
destMatrix = SubRectMat3(destRect.X() / args.destSize.width,
|
||||
destRect.Y() / args.destSize.height,
|
||||
destRect.Width() / args.destSize.width,
|
||||
destRect.Height() / args.destSize.height);
|
||||
} else {
|
||||
destMatrix = Mat3::I();
|
||||
}
|
||||
|
|
|
@ -285,8 +285,8 @@ TiledTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
|
|||
BeginBigImageIteration();
|
||||
do {
|
||||
IntRect tileRect = GetSrcTileRect();
|
||||
int xPos = tileRect.x;
|
||||
int yPos = tileRect.y;
|
||||
int xPos = tileRect.X();
|
||||
int yPos = tileRect.Y();
|
||||
|
||||
nsIntRegion tileRegion;
|
||||
tileRegion.And(region, tileRect); // intersect with tile
|
||||
|
@ -359,9 +359,9 @@ gfx::IntRect TiledTextureImage::GetSrcTileRect()
|
|||
{
|
||||
gfx::IntRect rect = GetTileRect();
|
||||
const bool needsYFlip = mFlags & OriginBottomLeft;
|
||||
unsigned int srcY = needsYFlip ? mSize.height - rect.Height() - rect.y
|
||||
: rect.y;
|
||||
return gfx::IntRect(rect.x, srcY, rect.Width(), rect.Height());
|
||||
unsigned int srcY = needsYFlip ? mSize.height - rect.Height() - rect.Y()
|
||||
: rect.Y();
|
||||
return gfx::IntRect(rect.X(), srcY, rect.Width(), rect.Height());
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -512,8 +512,8 @@ UploadImageDataToTexture(GLContext* gl,
|
|||
TexSubImage2DHelper(gl,
|
||||
aTextureTarget,
|
||||
0,
|
||||
rect.x,
|
||||
rect.y,
|
||||
rect.X(),
|
||||
rect.Y(),
|
||||
rect.Width(),
|
||||
rect.Height(),
|
||||
aStride,
|
||||
|
|
|
@ -175,18 +175,25 @@ struct ParamTraits<gfxRect>
|
|||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.x);
|
||||
WriteParam(aMsg, aParam.y);
|
||||
WriteParam(aMsg, aParam.width);
|
||||
WriteParam(aMsg, aParam.height);
|
||||
WriteParam(aMsg, aParam.X());
|
||||
WriteParam(aMsg, aParam.Y());
|
||||
WriteParam(aMsg, aParam.Width());
|
||||
WriteParam(aMsg, aParam.Height());
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->x) &&
|
||||
ReadParam(aMsg, aIter, &aResult->y) &&
|
||||
ReadParam(aMsg, aIter, &aResult->width) &&
|
||||
ReadParam(aMsg, aIter, &aResult->height);
|
||||
auto x = aResult->X();
|
||||
auto y = aResult->Y();
|
||||
auto w = aResult->Width();
|
||||
auto h = aResult->Height();
|
||||
|
||||
bool retVal = (ReadParam(aMsg, aIter, &x) &&
|
||||
ReadParam(aMsg, aIter, &y) &&
|
||||
ReadParam(aMsg, aIter, &w) &&
|
||||
ReadParam(aMsg, aIter, &h));
|
||||
aResult->SetRect(x, y, w, h);
|
||||
return retVal;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -569,18 +576,25 @@ struct ParamTraits< mozilla::gfx::RectTyped<T> >
|
|||
|
||||
static void Write(Message* msg, const paramType& param)
|
||||
{
|
||||
WriteParam(msg, param.x);
|
||||
WriteParam(msg, param.y);
|
||||
WriteParam(msg, param.width);
|
||||
WriteParam(msg, param.height);
|
||||
WriteParam(msg, param.X());
|
||||
WriteParam(msg, param.Y());
|
||||
WriteParam(msg, param.Width());
|
||||
WriteParam(msg, param.Height());
|
||||
}
|
||||
|
||||
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
||||
{
|
||||
return (ReadParam(msg, iter, &result->x) &&
|
||||
ReadParam(msg, iter, &result->y) &&
|
||||
ReadParam(msg, iter, &result->width) &&
|
||||
ReadParam(msg, iter, &result->height));
|
||||
auto x = result->X();
|
||||
auto y = result->Y();
|
||||
auto w = result->Width();
|
||||
auto h = result->Height();
|
||||
|
||||
bool retVal = (ReadParam(msg, iter, &x) &&
|
||||
ReadParam(msg, iter, &y) &&
|
||||
ReadParam(msg, iter, &w) &&
|
||||
ReadParam(msg, iter, &h));
|
||||
result->SetRect(x, y, w, h);
|
||||
return retVal;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -591,18 +605,25 @@ struct ParamTraits< mozilla::gfx::IntRectTyped<T> >
|
|||
|
||||
static void Write(Message* msg, const paramType& param)
|
||||
{
|
||||
WriteParam(msg, param.x);
|
||||
WriteParam(msg, param.y);
|
||||
WriteParam(msg, param.width);
|
||||
WriteParam(msg, param.height);
|
||||
WriteParam(msg, param.X());
|
||||
WriteParam(msg, param.Y());
|
||||
WriteParam(msg, param.Width());
|
||||
WriteParam(msg, param.Height());
|
||||
}
|
||||
|
||||
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
||||
{
|
||||
return (ReadParam(msg, iter, &result->x) &&
|
||||
ReadParam(msg, iter, &result->y) &&
|
||||
ReadParam(msg, iter, &result->width) &&
|
||||
ReadParam(msg, iter, &result->height));
|
||||
auto x = result->X();
|
||||
auto y = result->Y();
|
||||
auto w = result->Width();
|
||||
auto h = result->Height();
|
||||
|
||||
bool retVal = (ReadParam(msg, iter, &x) &&
|
||||
ReadParam(msg, iter, &y) &&
|
||||
ReadParam(msg, iter, &w) &&
|
||||
ReadParam(msg, iter, &h));
|
||||
result->SetRect(x, y, w, h);
|
||||
return retVal;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -657,18 +678,24 @@ struct ParamTraits<nsRect>
|
|||
|
||||
static void Write(Message* msg, const paramType& param)
|
||||
{
|
||||
WriteParam(msg, param.x);
|
||||
WriteParam(msg, param.y);
|
||||
WriteParam(msg, param.width);
|
||||
WriteParam(msg, param.height);
|
||||
WriteParam(msg, param.X());
|
||||
WriteParam(msg, param.Y());
|
||||
WriteParam(msg, param.Width());
|
||||
WriteParam(msg, param.Height());
|
||||
}
|
||||
|
||||
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
||||
{
|
||||
return (ReadParam(msg, iter, &result->x) &&
|
||||
ReadParam(msg, iter, &result->y) &&
|
||||
ReadParam(msg, iter, &result->width) &&
|
||||
ReadParam(msg, iter, &result->height));
|
||||
auto x = result->X();
|
||||
auto y = result->Y();
|
||||
auto w = result->Width();
|
||||
auto h = result->Height();
|
||||
bool retVal = (ReadParam(msg, iter, &x) &&
|
||||
ReadParam(msg, iter, &y) &&
|
||||
ReadParam(msg, iter, &w) &&
|
||||
ReadParam(msg, iter, &h));
|
||||
result->SetRect(x, y, w, h);
|
||||
return retVal;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -187,12 +187,12 @@ UpdateTextureCoordinates(gfx::TexturedTriangle& aTriangle,
|
|||
const gfx::Rect& aTextureCoords)
|
||||
{
|
||||
// Calculate the relative offset of the intersection within the layer.
|
||||
float dx = (aIntersection.x - aRect.x) / aRect.Width();
|
||||
float dy = (aIntersection.y - aRect.y) / aRect.Height();
|
||||
float dx = (aIntersection.X() - aRect.X()) / aRect.Width();
|
||||
float dy = (aIntersection.Y() - aRect.Y()) / aRect.Height();
|
||||
|
||||
// Update the texture offset.
|
||||
float x = aTextureCoords.x + dx * aTextureCoords.Width();
|
||||
float y = aTextureCoords.y + dy * aTextureCoords.Height();
|
||||
float x = aTextureCoords.X() + dx * aTextureCoords.Width();
|
||||
float y = aTextureCoords.Y() + dy * aTextureCoords.Height();
|
||||
|
||||
// Scale the texture width and height.
|
||||
float w = aTextureCoords.Width() * aIntersection.Width() / aRect.Width();
|
||||
|
@ -206,8 +206,8 @@ UpdateTextureCoordinates(gfx::TexturedTriangle& aTriangle,
|
|||
|
||||
auto UpdatePoint = [&](const gfx::Point& p, gfx::Point& t)
|
||||
{
|
||||
t.x = x + (p.x - aIntersection.x) / aIntersection.Width() * w;
|
||||
t.y = y + (p.y - aIntersection.y) / aIntersection.Height() * h;
|
||||
t.x = x + (p.x - aIntersection.X()) / aIntersection.Width() * w;
|
||||
t.y = y + (p.y - aIntersection.Y()) / aIntersection.Height() * h;
|
||||
|
||||
Clamp(t.x);
|
||||
Clamp(t.y);
|
||||
|
@ -372,22 +372,22 @@ Compositor::SlowDrawRect(const gfx::Rect& aRect, const gfx::Color& aColor,
|
|||
|
||||
effects.mPrimaryEffect = new EffectSolidColor(aColor);
|
||||
// left
|
||||
this->DrawQuad(gfx::Rect(aRect.x, aRect.y,
|
||||
this->DrawQuad(gfx::Rect(aRect.X(), aRect.Y(),
|
||||
aStrokeWidth, aRect.Height()),
|
||||
aClipRect, effects, opacity,
|
||||
aTransform);
|
||||
// top
|
||||
this->DrawQuad(gfx::Rect(aRect.x + aStrokeWidth, aRect.y,
|
||||
this->DrawQuad(gfx::Rect(aRect.X() + aStrokeWidth, aRect.Y(),
|
||||
aRect.Width() - 2 * aStrokeWidth, aStrokeWidth),
|
||||
aClipRect, effects, opacity,
|
||||
aTransform);
|
||||
// right
|
||||
this->DrawQuad(gfx::Rect(aRect.x + aRect.Width() - aStrokeWidth, aRect.y,
|
||||
this->DrawQuad(gfx::Rect(aRect.XMost() - aStrokeWidth, aRect.Y(),
|
||||
aStrokeWidth, aRect.Height()),
|
||||
aClipRect, effects, opacity,
|
||||
aTransform);
|
||||
// bottom
|
||||
this->DrawQuad(gfx::Rect(aRect.x + aStrokeWidth, aRect.y + aRect.Height() - aStrokeWidth,
|
||||
this->DrawQuad(gfx::Rect(aRect.X() + aStrokeWidth, aRect.YMost() - aStrokeWidth,
|
||||
aRect.Width() - 2 * aStrokeWidth, aStrokeWidth),
|
||||
aClipRect, effects, opacity,
|
||||
aTransform);
|
||||
|
@ -456,19 +456,19 @@ DecomposeIntoNoRepeatRects(const gfx::Rect& aRect,
|
|||
bool flipped = false;
|
||||
if (texCoordRect.Height() < 0) {
|
||||
flipped = true;
|
||||
texCoordRect.y += texCoordRect.Height();
|
||||
texCoordRect.MoveByY(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)),
|
||||
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)));
|
||||
|
||||
NS_ASSERTION(texCoordRect.x >= 0.0f && texCoordRect.x <= 1.0f &&
|
||||
texCoordRect.y >= 0.0f && texCoordRect.y <= 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.XMost() >= 0.0f && texCoordRect.XMost() <= 2.0f &&
|
||||
|
@ -499,7 +499,7 @@ DecomposeIntoNoRepeatRects(const gfx::Rect& aRect,
|
|||
// xmid/ymid values.
|
||||
if (!xwrap && !ywrap) {
|
||||
SetRects(0, aLayerRects, aTextureRects,
|
||||
aRect.x, aRect.y, aRect.XMost(), aRect.YMost(),
|
||||
aRect.X(), aRect.Y(), aRect.XMost(), aRect.YMost(),
|
||||
tl.x, tl.y, br.x, br.y,
|
||||
flipped);
|
||||
return 1;
|
||||
|
@ -514,30 +514,30 @@ DecomposeIntoNoRepeatRects(const gfx::Rect& aRect,
|
|||
// tl.x .. 1.0 and then from 0.0 .. br.x (which we just wrapped above).
|
||||
// The same applies for the Y axis. The midpoints we calculate here are
|
||||
// only valid if we actually wrap around.
|
||||
GLfloat xmid = aRect.x + (1.0f - tl.x) / texCoordRect.Width() * aRect.Width();
|
||||
GLfloat ymid = aRect.y + (1.0f - tl.y) / texCoordRect.Height() * aRect.Height();
|
||||
GLfloat xmid = aRect.X() + (1.0f - tl.x) / texCoordRect.Width() * aRect.Width();
|
||||
GLfloat ymid = aRect.Y() + (1.0f - tl.y) / texCoordRect.Height() * aRect.Height();
|
||||
|
||||
// Due to floating-point inaccuracy, we have to use XMost()-x and YMost()-y
|
||||
// to calculate width and height, respectively, to ensure that size will
|
||||
// remain consistent going from absolute to relative and back again.
|
||||
NS_ASSERTION(!xwrap ||
|
||||
(xmid >= aRect.x &&
|
||||
(xmid >= aRect.X() &&
|
||||
xmid <= aRect.XMost() &&
|
||||
FuzzyEqual((xmid - aRect.x) + (aRect.XMost() - xmid), aRect.XMost() - aRect.x)),
|
||||
FuzzyEqual((xmid - aRect.X()) + (aRect.XMost() - xmid), aRect.XMost() - aRect.X())),
|
||||
"xmid should be within [x,XMost()] and the wrapped rect should have the same width");
|
||||
NS_ASSERTION(!ywrap ||
|
||||
(ymid >= aRect.y &&
|
||||
(ymid >= aRect.Y() &&
|
||||
ymid <= aRect.YMost() &&
|
||||
FuzzyEqual((ymid - aRect.y) + (aRect.YMost() - ymid), aRect.YMost() - aRect.y)),
|
||||
FuzzyEqual((ymid - aRect.Y()) + (aRect.YMost() - ymid), aRect.YMost() - aRect.Y())),
|
||||
"ymid should be within [y,YMost()] and the wrapped rect should have the same height");
|
||||
|
||||
if (!xwrap && ywrap) {
|
||||
SetRects(0, aLayerRects, aTextureRects,
|
||||
aRect.x, aRect.y, aRect.XMost(), ymid,
|
||||
aRect.X(), aRect.Y(), aRect.XMost(), ymid,
|
||||
tl.x, tl.y, br.x, 1.0f,
|
||||
flipped);
|
||||
SetRects(1, aLayerRects, aTextureRects,
|
||||
aRect.x, ymid, aRect.XMost(), aRect.YMost(),
|
||||
aRect.X(), ymid, aRect.XMost(), aRect.YMost(),
|
||||
tl.x, 0.0f, br.x, br.y,
|
||||
flipped);
|
||||
return 2;
|
||||
|
@ -545,26 +545,26 @@ DecomposeIntoNoRepeatRects(const gfx::Rect& aRect,
|
|||
|
||||
if (xwrap && !ywrap) {
|
||||
SetRects(0, aLayerRects, aTextureRects,
|
||||
aRect.x, aRect.y, xmid, aRect.YMost(),
|
||||
aRect.X(), aRect.Y(), xmid, aRect.YMost(),
|
||||
tl.x, tl.y, 1.0f, br.y,
|
||||
flipped);
|
||||
SetRects(1, aLayerRects, aTextureRects,
|
||||
xmid, aRect.y, aRect.XMost(), aRect.YMost(),
|
||||
xmid, aRect.Y(), aRect.XMost(), aRect.YMost(),
|
||||
0.0f, tl.y, br.x, br.y,
|
||||
flipped);
|
||||
return 2;
|
||||
}
|
||||
|
||||
SetRects(0, aLayerRects, aTextureRects,
|
||||
aRect.x, aRect.y, xmid, ymid,
|
||||
aRect.X(), aRect.Y(), xmid, ymid,
|
||||
tl.x, tl.y, 1.0f, 1.0f,
|
||||
flipped);
|
||||
SetRects(1, aLayerRects, aTextureRects,
|
||||
xmid, aRect.y, aRect.XMost(), ymid,
|
||||
xmid, aRect.Y(), aRect.XMost(), ymid,
|
||||
0.0f, tl.y, br.x, 1.0f,
|
||||
flipped);
|
||||
SetRects(2, aLayerRects, aTextureRects,
|
||||
aRect.x, ymid, xmid, aRect.YMost(),
|
||||
aRect.X(), ymid, xmid, aRect.YMost(),
|
||||
tl.x, 0.0f, 1.0f, br.y,
|
||||
flipped);
|
||||
SetRects(3, aLayerRects, aTextureRects,
|
||||
|
|
|
@ -253,8 +253,8 @@ D3D11YCbCrImage::GetAsSourceSurface()
|
|||
|
||||
MOZ_ASSERT(mapCb.RowPitch == mapCr.RowPitch);
|
||||
|
||||
data.mPicX = mPictureRect.x;
|
||||
data.mPicY = mPictureRect.y;
|
||||
data.mPicX = mPictureRect.X();
|
||||
data.mPicY = mPictureRect.Y();
|
||||
data.mPicSize = mPictureRect.Size();
|
||||
data.mStereoMode = StereoMode::MONO;
|
||||
data.mYUVColorSpace = mColorSpace;
|
||||
|
|
|
@ -174,7 +174,7 @@ D3D9SurfaceImage::AllocateAndCopy(D3D9RecycleAllocator* aAllocator,
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
RECT src = { aRegion.x, aRegion.y, aRegion.x+aRegion.Width(), aRegion.y+aRegion.Height() };
|
||||
RECT src = { aRegion.X(), aRegion.Y(), aRegion.XMost(), aRegion.YMost() };
|
||||
hr = device->StretchRect(surface, &src, textureSurface, nullptr, D3DTEXF_NONE);
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
|
||||
|
||||
|
|
|
@ -16,27 +16,27 @@ namespace layers {
|
|||
template <typename PointOrRect>
|
||||
CoordOf<PointOrRect> GetAxisStart(ScrollDirection aDir, const PointOrRect& aValue) {
|
||||
if (aDir == ScrollDirection::eHorizontal) {
|
||||
return aValue.x;
|
||||
return aValue.X();
|
||||
} else {
|
||||
return aValue.y;
|
||||
return aValue.Y();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Rect>
|
||||
CoordOf<Rect> GetAxisEnd(ScrollDirection aDir, const Rect& aValue) {
|
||||
if (aDir == ScrollDirection::eHorizontal) {
|
||||
return aValue.x + aValue.width;
|
||||
return aValue.XMost();
|
||||
} else {
|
||||
return aValue.y + aValue.height;
|
||||
return aValue.YMost();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Rect>
|
||||
CoordOf<Rect> GetAxisLength(ScrollDirection aDir, const Rect& aValue) {
|
||||
if (aDir == ScrollDirection::eHorizontal) {
|
||||
return aValue.width;
|
||||
return aValue.Width();
|
||||
} else {
|
||||
return aValue.height;
|
||||
return aValue.Height();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -172,15 +172,15 @@ public:
|
|||
CSSRect scrollableRect = mScrollableRect;
|
||||
CSSSize compSize = CalculateCompositedSizeInCssPixels();
|
||||
if (scrollableRect.Width() < compSize.width) {
|
||||
scrollableRect.x = std::max(0.f,
|
||||
scrollableRect.x - (compSize.width - scrollableRect.Width()));
|
||||
scrollableRect.SetWidth(compSize.width);
|
||||
scrollableRect.SetRectX(std::max(0.f,
|
||||
scrollableRect.X() - (compSize.width - scrollableRect.Width())),
|
||||
compSize.width);
|
||||
}
|
||||
|
||||
if (scrollableRect.Height() < compSize.height) {
|
||||
scrollableRect.y = std::max(0.f,
|
||||
scrollableRect.y - (compSize.height - scrollableRect.Height()));
|
||||
scrollableRect.SetHeight(compSize.height);
|
||||
scrollableRect.SetRectY(std::max(0.f,
|
||||
scrollableRect.Y() - (compSize.height - scrollableRect.Height())),
|
||||
compSize.height);
|
||||
}
|
||||
|
||||
return scrollableRect;
|
||||
|
|
|
@ -44,8 +44,7 @@ void ImageLayer::ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSu
|
|||
SnapTransform(local, sourceRect, nullptr) *
|
||||
SnapTransformTranslation(aTransformToSurface, nullptr);
|
||||
|
||||
if (mScaleMode != ScaleMode::SCALE_NONE &&
|
||||
sourceRect.Width() != 0.0 && sourceRect.Height() != 0.0) {
|
||||
if (mScaleMode != ScaleMode::SCALE_NONE && !sourceRect.IsZero()) {
|
||||
NS_ASSERTION(mScaleMode == ScaleMode::STRETCH,
|
||||
"No other scalemodes than stretch and none supported yet.");
|
||||
local.PreScale(mScaleToSize.width / sourceRect.Width(),
|
||||
|
|
|
@ -373,8 +373,8 @@ LayerScopeManager gLayerScopeManager;
|
|||
template<typename T>
|
||||
static void DumpRect(T* aPacketRect, const Rect& aRect)
|
||||
{
|
||||
aPacketRect->set_x(aRect.x);
|
||||
aPacketRect->set_y(aRect.y);
|
||||
aPacketRect->set_x(aRect.X());
|
||||
aPacketRect->set_y(aRect.Y());
|
||||
aPacketRect->set_w(aRect.Width());
|
||||
aPacketRect->set_h(aRect.Height());
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ TransformRect(const IntRect& aRect, const Matrix4x4& aTransform)
|
|||
return IntRect();
|
||||
}
|
||||
|
||||
Rect rect(aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
Rect rect(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
rect = aTransform.TransformAndClipBounds(rect, Rect::MaxIntRect());
|
||||
rect.RoundOut();
|
||||
|
||||
|
|
|
@ -524,7 +524,7 @@ Layer::CalculateScissorRect(const RenderTargetIntRect& aCurrentScissorRect)
|
|||
// See DefaultComputeEffectiveTransforms below
|
||||
NS_ASSERTION(is2D && matrix.PreservesAxisAlignedRectangles(),
|
||||
"Non preserves axis aligned transform with clipped child should have forced intermediate surface");
|
||||
gfx::Rect r(scissor.x, scissor.y, scissor.Width(), scissor.Height());
|
||||
gfx::Rect r(scissor.X(), scissor.Y(), scissor.Width(), scissor.Height());
|
||||
gfxRect trScissor = gfx::ThebesRect(matrix.TransformBounds(r));
|
||||
trScissor.Round();
|
||||
IntRect tmp;
|
||||
|
@ -1834,12 +1834,12 @@ Layer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
|
|||
aStream << nsPrintfCString(" [isStickyPosition scrollId=%" PRIu64 " outer=(%.3f,%.3f)-(%.3f,%.3f) "
|
||||
"inner=(%.3f,%.3f)-(%.3f,%.3f)]",
|
||||
GetStickyScrollContainerId(),
|
||||
GetStickyScrollRangeOuter().x,
|
||||
GetStickyScrollRangeOuter().y,
|
||||
GetStickyScrollRangeOuter().X(),
|
||||
GetStickyScrollRangeOuter().Y(),
|
||||
GetStickyScrollRangeOuter().XMost(),
|
||||
GetStickyScrollRangeOuter().YMost(),
|
||||
GetStickyScrollRangeInner().x,
|
||||
GetStickyScrollRangeInner().y,
|
||||
GetStickyScrollRangeInner().X(),
|
||||
GetStickyScrollRangeInner().Y(),
|
||||
GetStickyScrollRangeInner().XMost(),
|
||||
GetStickyScrollRangeInner().YMost()).get();
|
||||
}
|
||||
|
@ -1890,8 +1890,8 @@ 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_x(aRect.X());
|
||||
aLayerRect->set_y(aRect.Y());
|
||||
aLayerRect->set_w(aRect.Width());
|
||||
aLayerRect->set_h(aRect.Height());
|
||||
}
|
||||
|
@ -2469,7 +2469,7 @@ SetAntialiasingFlags(Layer* aLayer, DrawTarget* aTarget)
|
|||
}
|
||||
|
||||
const IntRect& bounds = aLayer->GetVisibleRegion().ToUnknownRegion().GetBounds();
|
||||
gfx::Rect transformedBounds = aTarget->GetTransform().TransformBounds(gfx::Rect(Float(bounds.x), Float(bounds.y),
|
||||
gfx::Rect transformedBounds = aTarget->GetTransform().TransformBounds(gfx::Rect(Float(bounds.X()), Float(bounds.Y()),
|
||||
Float(bounds.Width()), Float(bounds.Height())));
|
||||
transformedBounds.RoundOut();
|
||||
IntRect intTransformedBounds;
|
||||
|
@ -2482,7 +2482,7 @@ SetAntialiasingFlags(Layer* aLayer, DrawTarget* aTarget)
|
|||
IntRect
|
||||
ToOutsideIntRect(const gfxRect &aRect)
|
||||
{
|
||||
return IntRect::RoundOut(aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
return IntRect::RoundOut(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
}
|
||||
|
||||
TextLayer::TextLayer(LayerManager* aManager, void* aImplData)
|
||||
|
|
|
@ -1081,14 +1081,14 @@ public:
|
|||
if (mClipRect) {
|
||||
if (!aRect) {
|
||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ClipRect was %d,%d,%d,%d is <none>", this,
|
||||
mClipRect->x, mClipRect->y, mClipRect->Width(), mClipRect->Height()));
|
||||
mClipRect->X(), mClipRect->Y(), mClipRect->Width(), mClipRect->Height()));
|
||||
mClipRect.reset();
|
||||
Mutated();
|
||||
} else {
|
||||
if (!aRect->IsEqualEdges(*mClipRect)) {
|
||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ClipRect was %d,%d,%d,%d is %d,%d,%d,%d", this,
|
||||
mClipRect->x, mClipRect->y, mClipRect->Width(), mClipRect->Height(),
|
||||
aRect->x, aRect->y, aRect->Width(), aRect->Height()));
|
||||
mClipRect->X(), mClipRect->Y(), mClipRect->Width(), mClipRect->Height(),
|
||||
aRect->X(), aRect->Y(), aRect->Width(), aRect->Height()));
|
||||
mClipRect = aRect;
|
||||
Mutated();
|
||||
}
|
||||
|
@ -1096,7 +1096,7 @@ public:
|
|||
} else {
|
||||
if (aRect) {
|
||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ClipRect was <none> is %d,%d,%d,%d", this,
|
||||
aRect->x, aRect->y, aRect->Width(), aRect->Height()));
|
||||
aRect->X(), aRect->Y(), aRect->Width(), aRect->Height()));
|
||||
mClipRect = aRect;
|
||||
Mutated();
|
||||
}
|
||||
|
|
|
@ -29,15 +29,15 @@ ComputeBackdropCopyRect(const gfx::Rect& aRect,
|
|||
|
||||
// Apply the layer transform.
|
||||
RectDouble dest = aTransform.TransformAndClipBounds(
|
||||
RectDouble(aRect.x, aRect.y, aRect.Width(), aRect.Height()),
|
||||
RectDouble(renderBounds.x, renderBounds.y, renderBounds.Width(), renderBounds.Height()));
|
||||
RectDouble(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height()),
|
||||
RectDouble(renderBounds.X(), renderBounds.Y(), renderBounds.Width(), renderBounds.Height()));
|
||||
dest -= rtOffset;
|
||||
|
||||
// Ensure we don't round out to -1, which trips up Direct3D.
|
||||
dest.IntersectRect(dest, RectDouble(0, 0, rtSize.width, rtSize.height));
|
||||
|
||||
if (aOutLayerQuad) {
|
||||
*aOutLayerQuad = Rect(dest.x, dest.y, dest.Width(), dest.Height());
|
||||
*aOutLayerQuad = Rect(dest.X(), dest.Y(), dest.Width(), dest.Height());
|
||||
}
|
||||
|
||||
// Round out to integer.
|
||||
|
@ -50,7 +50,7 @@ ComputeBackdropCopyRect(const gfx::Rect& aRect,
|
|||
// uv-space.
|
||||
Matrix4x4 transform;
|
||||
transform.PostScale(rtSize.width, rtSize.height, 1.0);
|
||||
transform.PostTranslate(-result.x, -result.y, 0.0);
|
||||
transform.PostTranslate(-result.X(), -result.Y(), 0.0);
|
||||
transform.PostScale(1 / float(result.Width()), 1 / float(result.Height()), 1.0);
|
||||
*aOutTransform = transform;
|
||||
return result;
|
||||
|
|
|
@ -35,10 +35,10 @@ static inline gfx::Rect
|
|||
TextureRectToCoords(const T& aRect, const gfx::IntSize& aSize)
|
||||
{
|
||||
return gfx::Rect(
|
||||
float(aRect.x) / aSize.width,
|
||||
float(aRect.y) / aSize.height,
|
||||
float(aRect.width) / aSize.width,
|
||||
float(aRect.height) / aSize.height);
|
||||
float(aRect.X()) / aSize.width,
|
||||
float(aRect.Y()) / aSize.height,
|
||||
float(aRect.Width()) / aSize.width,
|
||||
float(aRect.Height()) / aSize.height);
|
||||
}
|
||||
|
||||
// This is defined in Compositor.cpp.
|
||||
|
|
|
@ -64,7 +64,7 @@ AppendToString(std::stringstream& aStream, const nsRect& r,
|
|||
aStream << pfx;
|
||||
aStream << nsPrintfCString(
|
||||
"(x=%d, y=%d, w=%d, h=%d)",
|
||||
r.x, r.y, r.Width(), r.Height()).get();
|
||||
r.X(), r.Y(), r.Width(), r.Height()).get();
|
||||
aStream << sfx;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ AppendToString(std::stringstream& aStream, const mozilla::gfx::RectTyped<T>& r,
|
|||
aStream << pfx;
|
||||
aStream << nsPrintfCString(
|
||||
"(x=%f, y=%f, w=%f, h=%f)",
|
||||
r.x, r.y, r.Width(), r.Height()).get();
|
||||
r.X(), r.Y(), r.Width(), r.Height()).get();
|
||||
aStream << sfx;
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ AppendToString(std::stringstream& aStream, const mozilla::gfx::IntRectTyped<T>&
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,16 +77,16 @@ CapturedTiledPaintState::Clear::ClearBuffer()
|
|||
if (mTargetOnWhite) {
|
||||
mTargetOnWhite->SetTransform(Matrix());
|
||||
for (auto iter = mDirtyRegion.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const gfx::Rect drawRect(iter.Get().x, iter.Get().y,
|
||||
iter.Get().width, iter.Get().height);
|
||||
const gfx::Rect drawRect(iter.Get().X(), iter.Get().Y(),
|
||||
iter.Get().Width(), iter.Get().Height());
|
||||
mTarget->FillRect(drawRect, ColorPattern(Color(0.0, 0.0, 0.0, 1.0)));
|
||||
mTargetOnWhite->FillRect(drawRect, ColorPattern(Color(1.0, 1.0, 1.0, 1.0)));
|
||||
}
|
||||
mTargetOnWhite->SetTransform(oldTransform);
|
||||
} else {
|
||||
for (auto iter = mDirtyRegion.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const gfx::Rect drawRect(iter.Get().x, iter.Get().y,
|
||||
iter.Get().width, iter.Get().height);
|
||||
const gfx::Rect drawRect(iter.Get().X(), iter.Get().Y(),
|
||||
iter.Get().Width(), iter.Get().Height());
|
||||
mTarget->ClearRect(drawRect);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,18 +67,14 @@ RotatedBuffer::GetSourceRectangle(XSide aXSide, YSide aYSide) const
|
|||
{
|
||||
Rect result;
|
||||
if (aXSide == LEFT) {
|
||||
result.x = 0;
|
||||
result.SetWidth(mBufferRotation.x);
|
||||
result.SetBoxX(0, mBufferRotation.x);
|
||||
} else {
|
||||
result.x = mBufferRotation.x;
|
||||
result.SetWidth(mBufferRect.Width() - mBufferRotation.x);
|
||||
result.SetBoxX(mBufferRotation.x, mBufferRect.Width());
|
||||
}
|
||||
if (aYSide == TOP) {
|
||||
result.y = 0;
|
||||
result.SetHeight(mBufferRotation.y);
|
||||
result.SetBoxY(0, mBufferRotation.y);
|
||||
} else {
|
||||
result.y = mBufferRotation.y;
|
||||
result.SetHeight(mBufferRect.Height() - mBufferRotation.y);
|
||||
result.SetBoxY(mBufferRotation.y, mBufferRect.Height());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -111,7 +107,7 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
|
|||
if (!fillRect.IntersectRect(mBufferRect, quadrantRect))
|
||||
return;
|
||||
|
||||
gfx::Point quadrantTranslation(quadrantRect.x, quadrantRect.y);
|
||||
gfx::Point quadrantTranslation(quadrantRect.X(), quadrantRect.Y());
|
||||
|
||||
MOZ_ASSERT(aSource != BUFFER_BOTH);
|
||||
RefPtr<SourceSurface> snapshot = GetSourceSurface(aSource);
|
||||
|
@ -297,8 +293,8 @@ RotatedBuffer::Parameters::RectWrapsBuffer(const gfx::IntRect& aRect) const
|
|||
{
|
||||
int32_t xBoundary = mBufferRect.XMost() - mBufferRotation.x;
|
||||
int32_t yBoundary = mBufferRect.YMost() - mBufferRotation.y;
|
||||
return (aRect.x < xBoundary && xBoundary < aRect.XMost()) ||
|
||||
(aRect.y < yBoundary && yBoundary < aRect.YMost());
|
||||
return (aRect.X() < xBoundary && xBoundary < aRect.XMost()) ||
|
||||
(aRect.Y() < yBoundary && yBoundary < aRect.YMost());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -452,13 +448,13 @@ RotatedBuffer::BorrowDrawTargetForQuadrantUpdate(const IntRect& aBounds,
|
|||
if (aSetTransform) {
|
||||
mLoanedTransform = mLoanedDrawTarget->GetTransform();
|
||||
Matrix transform = Matrix(mLoanedTransform)
|
||||
.PreTranslate(-quadrantRect.x,
|
||||
-quadrantRect.y);
|
||||
.PreTranslate(-quadrantRect.X(),
|
||||
-quadrantRect.Y());
|
||||
mLoanedDrawTarget->SetTransform(transform);
|
||||
mSetTransform = true;
|
||||
} else {
|
||||
MOZ_ASSERT(aOutMatrix);
|
||||
*aOutMatrix = Matrix::Translation(-quadrantRect.x, -quadrantRect.y);
|
||||
*aOutMatrix = Matrix::Translation(-quadrantRect.X(), -quadrantRect.Y());
|
||||
mSetTransform = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1913,7 +1913,7 @@ AsyncPanZoomController::GetKeyboardDestination(const KeyboardScrollAction& aActi
|
|||
if (aAction.mForward) {
|
||||
scrollDestination.y = scrollRect.YMost();
|
||||
} else {
|
||||
scrollDestination.y = scrollRect.y;
|
||||
scrollDestination.y = scrollRect.Y();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -3251,8 +3251,8 @@ const ScreenMargin AsyncPanZoomController::CalculatePendingDisplayPort(
|
|||
ToString(aVelocity).c_str(), paintFactor);
|
||||
|
||||
CSSMargin cssMargins;
|
||||
cssMargins.left = -displayPort.x;
|
||||
cssMargins.top = -displayPort.y;
|
||||
cssMargins.left = -displayPort.X();
|
||||
cssMargins.top = -displayPort.Y();
|
||||
cssMargins.right = displayPort.Width() - compositionSize.width - cssMargins.left;
|
||||
cssMargins.bottom = displayPort.Height() - compositionSize.height - cssMargins.top;
|
||||
|
||||
|
@ -4135,21 +4135,19 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect, const uint32_t aFlags) {
|
|||
|
||||
// Vertically center the zoomed element in the screen.
|
||||
if (!zoomOut && (sizeAfterZoom.height > aRect.Height())) {
|
||||
aRect.y -= (sizeAfterZoom.height - aRect.Height()) * 0.5f;
|
||||
if (aRect.y < 0.0f) {
|
||||
aRect.y = 0.0f;
|
||||
aRect.MoveByY(-(sizeAfterZoom.height - aRect.Height()) * 0.5f);
|
||||
if (aRect.Y() < 0.0f) {
|
||||
aRect.MoveToY(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;
|
||||
aRect.y = aRect.y > 0 ? aRect.y : 0;
|
||||
if (aRect.Y() + sizeAfterZoom.height > cssPageRect.Height()) {
|
||||
aRect.MoveToY(std::max(0.f, cssPageRect.Height() - sizeAfterZoom.height));
|
||||
}
|
||||
if (aRect.x + sizeAfterZoom.width > cssPageRect.Width()) {
|
||||
aRect.x = cssPageRect.Width() - sizeAfterZoom.width;
|
||||
aRect.x = aRect.x > 0 ? aRect.x : 0;
|
||||
if (aRect.X() + sizeAfterZoom.width > cssPageRect.Width()) {
|
||||
aRect.MoveToX(std::max(0.f, cssPageRect.Width() - sizeAfterZoom.width));
|
||||
}
|
||||
|
||||
endZoomToMetrics.SetScrollOffset(aRect.TopLeft());
|
||||
|
|
|
@ -525,7 +525,7 @@ ParentLayerCoord AxisX::GetRectLength(const ParentLayerRect& aRect) const
|
|||
|
||||
ParentLayerCoord AxisX::GetRectOffset(const ParentLayerRect& aRect) const
|
||||
{
|
||||
return aRect.x;
|
||||
return aRect.X();
|
||||
}
|
||||
|
||||
CSSToParentLayerScale AxisX::GetScaleForAxis(const CSSToParentLayerScale2D& aScale) const
|
||||
|
@ -566,7 +566,7 @@ ParentLayerCoord AxisY::GetRectLength(const ParentLayerRect& aRect) const
|
|||
|
||||
ParentLayerCoord AxisY::GetRectOffset(const ParentLayerRect& aRect) const
|
||||
{
|
||||
return aRect.y;
|
||||
return aRect.Y();
|
||||
}
|
||||
|
||||
CSSToParentLayerScale AxisY::GetScaleForAxis(const CSSToParentLayerScale2D& aScale) const
|
||||
|
|
|
@ -112,8 +112,8 @@ CheckerboardEvent::LogInfo(RendertraceProperty aProperty,
|
|||
mRendertraceInfo << "RENDERTRACE "
|
||||
<< (aTimestamp - mOriginTime).ToMilliseconds() << " rect "
|
||||
<< sColors[aProperty] << " "
|
||||
<< aRect.x << " "
|
||||
<< aRect.y << " "
|
||||
<< aRect.X() << " "
|
||||
<< aRect.Y() << " "
|
||||
<< aRect.Width() << " "
|
||||
<< aRect.Height() << " "
|
||||
<< "// " << sDescriptions[aProperty]
|
||||
|
|
|
@ -134,21 +134,21 @@ CalculateRectToZoomTo(const nsCOMPtr<nsIDocument>& aRootContentDocument,
|
|||
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;
|
||||
} else if (newY > rect.y) {
|
||||
rect.y = newY;
|
||||
if ((newY + targetHeight) > rect.YMost()) {
|
||||
rect.MoveByY(rect.Height() - targetHeight);
|
||||
} else if (newY > rect.Y()) {
|
||||
rect.MoveToY(newY);
|
||||
}
|
||||
rect.SetHeight(targetHeight);
|
||||
}
|
||||
}
|
||||
|
||||
rect = CSSRect(std::max(metrics.GetScrollableRect().x, rect.x - margin),
|
||||
rect.y,
|
||||
rect = CSSRect(std::max(metrics.GetScrollableRect().X(), rect.X() - margin),
|
||||
rect.Y(),
|
||||
rect.Width() + 2 * margin,
|
||||
rect.Height());
|
||||
// Constrict the rect to the screen's right edge
|
||||
rect.SetWidth(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.
|
||||
|
@ -166,8 +166,8 @@ CalculateRectToZoomTo(const nsCOMPtr<nsIDocument>& aRootContentDocument,
|
|||
// to zoom in (bug 761721). The 1.2 multiplier is just a little fuzz to
|
||||
// compensate for 'rect' including horizontal margins but not vertical ones.
|
||||
CSSCoord cssTapY = metrics.GetScrollOffset().y + aPoint.y;
|
||||
if ((rect.Height() > rounded.Height()) && (cssTapY > rounded.y + (rounded.Height() * 1.2))) {
|
||||
rounded.y = cssTapY - (rounded.Height() / 2);
|
||||
if ((rect.Height() > rounded.Height()) && (cssTapY > rounded.Y() + (rounded.Height() * 1.2))) {
|
||||
rounded.MoveToY(cssTapY - (rounded.Height() / 2));
|
||||
}
|
||||
|
||||
return rounded;
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
Rect snapped(mBounds.x, mBounds.y, mBounds.Width(), mBounds.Height());
|
||||
Rect snapped(mBounds.X(), mBounds.Y(), mBounds.Width(), mBounds.Height());
|
||||
MaybeSnapToDevicePixels(snapped, *aDT, true);
|
||||
|
||||
// Clip drawing in case we're using (unbounded) operator source.
|
||||
|
|
|
@ -259,9 +259,9 @@ BasicCompositor::GetTextureFactoryIdentifier()
|
|||
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.IsZero(), "Trying to create a render target of invalid size");
|
||||
|
||||
if (aRect.Width() * aRect.Height() == 0) {
|
||||
if (aRect.IsZero()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -289,9 +289,9 @@ 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.IsZero(), "Trying to create a render target of invalid size");
|
||||
|
||||
if (aRect.Width() * aRect.Height() == 0) {
|
||||
if (aRect.IsZero()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -460,8 +460,8 @@ DrawSurfaceWithTextureCoords(gfx::DrawTarget* aDest,
|
|||
}
|
||||
|
||||
// Convert aTextureCoords into aSource's coordinate space
|
||||
gfxRect sourceRect(aTextureCoords.x * aSource->GetSize().width,
|
||||
aTextureCoords.y * aSource->GetSize().height,
|
||||
gfxRect sourceRect(aTextureCoords.X() * aSource->GetSize().width,
|
||||
aTextureCoords.Y() * aSource->GetSize().height,
|
||||
aTextureCoords.Width() * aSource->GetSize().width,
|
||||
aTextureCoords.Height() * aSource->GetSize().height);
|
||||
|
||||
|
@ -472,8 +472,8 @@ DrawSurfaceWithTextureCoords(gfx::DrawTarget* aDest,
|
|||
// Compute a transform that maps sourceRect to aDestRect.
|
||||
Matrix matrix =
|
||||
gfxUtils::TransformRectToRect(sourceRect,
|
||||
gfx::IntPoint::Truncate(aDestRect.x, aDestRect.y),
|
||||
gfx::IntPoint::Truncate(aDestRect.XMost(), aDestRect.y),
|
||||
gfx::IntPoint::Truncate(aDestRect.X(), aDestRect.Y()),
|
||||
gfx::IntPoint::Truncate(aDestRect.XMost(), aDestRect.Y()),
|
||||
gfx::IntPoint::Truncate(aDestRect.XMost(), aDestRect.YMost()));
|
||||
|
||||
// Only use REPEAT if aTextureCoords is outside (0, 0, 1, 1).
|
||||
|
@ -559,7 +559,7 @@ AttemptVideoScale(TextureSourceBasic* aSource, const SourceSurface* aSourceMask,
|
|||
|
||||
ssse3_scale_data((uint32_t*)mapSrc.GetData(), srcSource->GetSize().width, srcSource->GetSize().height,
|
||||
mapSrc.GetStride()/4,
|
||||
((uint32_t*)dstData) + fillRect.x + (dstStride / 4) * fillRect.y, dstRect.Width(), dstRect.Height(),
|
||||
((uint32_t*)dstData) + fillRect.X() + (dstStride / 4) * fillRect.Y(), dstRect.Width(), dstRect.Height(),
|
||||
dstStride / 4,
|
||||
offset.x, offset.y,
|
||||
fillRect.Width(), fillRect.Height());
|
||||
|
@ -624,7 +624,7 @@ AttemptVideoConvertAndScale(TextureSource* aSource, const SourceSurface* aSource
|
|||
if (aDest->LockBits(&dstData, &dstSize, &dstStride, &dstFormat)) {
|
||||
wrappingSource->ConvertAndScale(dstFormat,
|
||||
dstRect.Size(),
|
||||
dstData + ptrdiff_t(dstRect.x) * BytesPerPixel(dstFormat) + ptrdiff_t(dstRect.y) * dstStride,
|
||||
dstData + ptrdiff_t(dstRect.X()) * BytesPerPixel(dstFormat) + ptrdiff_t(dstRect.Y()) * dstStride,
|
||||
dstStride);
|
||||
aDest->ReleaseBits(dstData);
|
||||
return true;
|
||||
|
@ -692,7 +692,7 @@ BasicCompositor::DrawGeometry(const Geometry& aGeometry,
|
|||
return;
|
||||
}
|
||||
|
||||
dest->SetTransform(Matrix::Translation(-aRect.x, -aRect.y));
|
||||
dest->SetTransform(Matrix::Translation(-aRect.X(), -aRect.Y()));
|
||||
|
||||
// Get the bounds post-transform.
|
||||
transformBounds = aTransform.TransformAndClipBounds(aRect, Rect(offset.x, offset.y, buffer->GetSize().width, buffer->GetSize().height));
|
||||
|
@ -707,7 +707,7 @@ BasicCompositor::DrawGeometry(const Geometry& aGeometry,
|
|||
// When we apply the 3D transformation, we do it against a temporary
|
||||
// surface, so undo the coordinate offset.
|
||||
new3DTransform = aTransform;
|
||||
new3DTransform.PreTranslate(aRect.x, aRect.y, 0);
|
||||
new3DTransform.PreTranslate(aRect.X(), aRect.Y(), 0);
|
||||
}
|
||||
|
||||
// XXX the transform is probably just an integer offset so this whole
|
||||
|
@ -845,7 +845,7 @@ BasicCompositor::DrawGeometry(const Geometry& aGeometry,
|
|||
RefPtr<DrawTarget> transformDT =
|
||||
dest->CreateSimilarDrawTarget(IntSize::Truncate(transformBounds.Width(), transformBounds.Height()),
|
||||
SurfaceFormat::B8G8R8A8);
|
||||
new3DTransform.PostTranslate(-transformBounds.x, -transformBounds.y, 0);
|
||||
new3DTransform.PostTranslate(-transformBounds.X(), -transformBounds.Y(), 0);
|
||||
if (transformDT &&
|
||||
transformDT->Draw3DTransformedSurface(destSnapshot, new3DTransform)) {
|
||||
RefPtr<SourceSurface> transformSnapshot = transformDT->Snapshot();
|
||||
|
@ -1054,8 +1054,8 @@ BasicCompositor::TryToEndRemoteDrawing(bool aForceToEnd)
|
|||
for (auto iter = mInvalidRegion.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const LayoutDeviceIntRect& r = iter.Get();
|
||||
dest->CopySurface(source,
|
||||
IntRect(r.x, r.y, r.Width(), r.Height()) - mRenderTarget->GetOrigin(),
|
||||
IntPoint(r.x, r.y) - offset);
|
||||
IntRect(r.X(), r.Y(), r.Width(), r.Height()) - mRenderTarget->GetOrigin(),
|
||||
IntPoint(r.X(), r.Y()) - offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ using namespace mozilla::gfx;
|
|||
static bool
|
||||
ClipToContain(gfxContext* aContext, const IntRect& aRect)
|
||||
{
|
||||
gfxRect userRect(aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
gfxRect userRect(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
gfxRect deviceRect = aContext->UserToDevice(userRect);
|
||||
deviceRect.RoundOut();
|
||||
|
||||
|
@ -268,7 +268,7 @@ public:
|
|||
!mTransform.HasNonAxisAlignedTransform()) {
|
||||
|
||||
gfx::Rect opaqueRect = dt->GetTransform().TransformBounds(
|
||||
gfx::Rect(bounds.x, bounds.y, bounds.Width(), bounds.Height()));
|
||||
gfx::Rect(bounds.X(), bounds.Y(), bounds.Width(), bounds.Height()));
|
||||
opaqueRect.RoundIn();
|
||||
IntRect intOpaqueRect;
|
||||
if (opaqueRect.ToIntRect(&intOpaqueRect)) {
|
||||
|
@ -372,7 +372,7 @@ static void
|
|||
TransformIntRect(IntRect& aRect, const Matrix& aMatrix,
|
||||
IntRect (*aRoundMethod)(const gfxRect&))
|
||||
{
|
||||
Rect gr = Rect(aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
Rect gr = Rect(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
gr = aMatrix.TransformBounds(gr);
|
||||
aRect = (*aRoundMethod)(ThebesRect(gr));
|
||||
}
|
||||
|
@ -617,7 +617,7 @@ BasicLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback,
|
|||
if (!mRegionToClear.IsEmpty()) {
|
||||
for (auto iter = mRegionToClear.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const IntRect& r = iter.Get();
|
||||
mTarget->GetDrawTarget()->ClearRect(Rect(r.x, r.y, r.Width(), r.Height()));
|
||||
mTarget->GetDrawTarget()->ClearRect(Rect(r.X(), r.Y(), r.Width(), r.Height()));
|
||||
}
|
||||
}
|
||||
if (mWidget) {
|
||||
|
@ -793,7 +793,7 @@ InstallLayerClipPreserves3D(gfxContext* aTarget, Layer* aLayer)
|
|||
aTarget->SetMatrix(transform);
|
||||
|
||||
aTarget->NewPath();
|
||||
aTarget->SnappedRectangle(gfxRect(clipRect->x, clipRect->y,
|
||||
aTarget->SnappedRectangle(gfxRect(clipRect->X(), clipRect->Y(),
|
||||
clipRect->Width(), clipRect->Height()));
|
||||
aTarget->Clip();
|
||||
|
||||
|
@ -904,7 +904,7 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget,
|
|||
if (!untransformedDT || !untransformedDT->IsValid()) {
|
||||
return;
|
||||
}
|
||||
untransformedDT->SetTransform(Matrix::Translation(-Point(bounds.x, bounds.y)));
|
||||
untransformedDT->SetTransform(Matrix::Translation(-Point(bounds.X(), bounds.Y())));
|
||||
|
||||
RefPtr<gfxContext> groupTarget =
|
||||
gfxContext::CreatePreservingTransformOrNull(untransformedDT);
|
||||
|
@ -927,8 +927,8 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget,
|
|||
effectiveTransform.TransformAndClipBounds(Rect(bounds),
|
||||
ToRect(aTarget->GetClipExtents()));
|
||||
xformBounds.RoundOut();
|
||||
effectiveTransform.PostTranslate(-xformBounds.x, -xformBounds.y, 0);
|
||||
effectiveTransform.PreTranslate(bounds.x, bounds.y, 0);
|
||||
effectiveTransform.PostTranslate(-xformBounds.X(), -xformBounds.Y(), 0);
|
||||
effectiveTransform.PreTranslate(bounds.X(), bounds.Y(), 0);
|
||||
|
||||
RefPtr<SourceSurface> untransformedSurf = untransformedDT->Snapshot();
|
||||
RefPtr<DrawTarget> xformDT =
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
Rect snapped(mBounds.x, mBounds.y, mBounds.Width(), mBounds.Height());
|
||||
Rect snapped(mBounds.X(), mBounds.Y(), mBounds.Width(), mBounds.Height());
|
||||
MaybeSnapToDevicePixels(snapped, *aDT, true);
|
||||
|
||||
// We don't currently support subpixel-AA in TextLayers since we
|
||||
|
|
|
@ -261,7 +261,7 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
|
|||
orientation = currentConfig.orientation();
|
||||
}
|
||||
LayoutDeviceIntRect targetBounds = mWidget->GetNaturalBounds();
|
||||
targetBounds.x = targetBounds.y = 0;
|
||||
targetBounds.MoveTo(0, 0);
|
||||
mForwarder->BeginTransaction(targetBounds.ToUnknownRect(), mTargetRotation,
|
||||
orientation);
|
||||
|
||||
|
@ -625,7 +625,7 @@ ClientLayerManager::MakeSnapshotIfRequired()
|
|||
RefPtr<DataSourceSurface> surf = GetSurfaceForDescriptor(outSnapshot);
|
||||
DrawTarget* dt = mShadowTarget->GetDrawTarget();
|
||||
|
||||
Rect dstRect(bounds.x, bounds.y, 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 =
|
||||
|
|
|
@ -249,8 +249,8 @@ ContentClient::BeginPaint(PaintedLayer* aLayer,
|
|||
|
||||
if (!newBuffer) {
|
||||
gfxCriticalNote << "Failed buffer for "
|
||||
<< dest.mBufferRect.x << ", "
|
||||
<< dest.mBufferRect.y << ", "
|
||||
<< dest.mBufferRect.X() << ", "
|
||||
<< dest.mBufferRect.Y() << ", "
|
||||
<< dest.mBufferRect.Width() << ", "
|
||||
<< dest.mBufferRect.Height();
|
||||
}
|
||||
|
@ -408,9 +408,9 @@ ContentClient::PrepareDrawTargetForPainting(CapturedPaintState* aState)
|
|||
}
|
||||
for (auto iter = aState->mRegionToDraw.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const IntRect& rect = iter.Get();
|
||||
target->FillRect(Rect(rect.x, rect.y, rect.Width(), rect.Height()),
|
||||
target->FillRect(Rect(rect.X(), rect.Y(), rect.Width(), rect.Height()),
|
||||
ColorPattern(Color(0.0, 0.0, 0.0, 1.0)));
|
||||
whiteTarget->FillRect(Rect(rect.x, rect.y, rect.Width(), rect.Height()),
|
||||
whiteTarget->FillRect(Rect(rect.X(), rect.Y(), rect.Width(), rect.Height()),
|
||||
ColorPattern(Color(1.0, 1.0, 1.0, 1.0)));
|
||||
}
|
||||
} else if (aState->mContentType == gfxContentType::COLOR_ALPHA &&
|
||||
|
@ -418,7 +418,7 @@ ContentClient::PrepareDrawTargetForPainting(CapturedPaintState* aState)
|
|||
// HaveBuffer() => we have an existing buffer that we must clear
|
||||
for (auto iter = aState->mRegionToDraw.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const IntRect& rect = iter.Get();
|
||||
target->ClearRect(Rect(rect.x, rect.y, rect.Width(), rect.Height()));
|
||||
target->ClearRect(Rect(rect.X(), rect.Y(), rect.Width(), rect.Height()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -946,8 +946,8 @@ ContentClientDoubleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
|
|||
|
||||
MOZ_LAYERS_LOG(("BasicShadowableThebes(%p): reading back <x=%d,y=%d,w=%d,h=%d>",
|
||||
this,
|
||||
mFrontUpdatedRegion.GetBounds().x,
|
||||
mFrontUpdatedRegion.GetBounds().y,
|
||||
mFrontUpdatedRegion.GetBounds().X(),
|
||||
mFrontUpdatedRegion.GetBounds().Y(),
|
||||
mFrontUpdatedRegion.GetBounds().Width(),
|
||||
mFrontUpdatedRegion.GetBounds().Height()));
|
||||
|
||||
|
|
|
@ -206,8 +206,8 @@ SharedFrameMetricsHelper::UpdateFromCompositorFrameMetrics(
|
|||
// 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().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) {
|
||||
return false;
|
||||
|
@ -552,7 +552,7 @@ TileClient::ValidateBackBufferFromFront(const nsIntRegion& aDirtyRegion,
|
|||
// is unlikely that we'd save much by copying each individual rect of the
|
||||
// region, but we can reevaluate this if it becomes an issue.
|
||||
const IntRect rectToCopy = regionToCopy.GetBounds();
|
||||
gfx::IntRect gfxRectToCopy(rectToCopy.x, rectToCopy.y, rectToCopy.Width(), rectToCopy.Height());
|
||||
gfx::IntRect gfxRectToCopy(rectToCopy.X(), rectToCopy.Y(), rectToCopy.Width(), rectToCopy.Height());
|
||||
if (CopyFrontToBack(mFrontBuffer, mBackBuffer, gfxRectToCopy, aFlags, aCopies, aClients)) {
|
||||
if (mBackBufferOnWhite) {
|
||||
MOZ_ASSERT(mFrontBufferOnWhite);
|
||||
|
@ -957,11 +957,11 @@ void ClientMultiTiledLayerBuffer::Update(const nsIntRegion& newValidRegion,
|
|||
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)
|
||||
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,
|
||||
floor_div(GetTileStart(newBounds.y, scaledTileSize.height)
|
||||
floor_div(GetTileStart(newBounds.Y(), scaledTileSize.height)
|
||||
+ newBounds.Height(), scaledTileSize.height) + 1);
|
||||
|
||||
const size_t oldTileCount = mRetainedTiles.Length();
|
||||
|
@ -1372,7 +1372,7 @@ ClientMultiTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& a
|
|||
int startX, incX, startY, incY;
|
||||
gfx::IntSize scaledTileSize = GetScaledTileSize();
|
||||
if (aPaintData->mScrollOffset.x >= aPaintData->mLastScrollOffset.x) {
|
||||
startX = RoundDownToTileEdge(paintBounds.x, scaledTileSize.width);
|
||||
startX = RoundDownToTileEdge(paintBounds.X(), scaledTileSize.width);
|
||||
incX = scaledTileSize.width;
|
||||
} else {
|
||||
startX = RoundDownToTileEdge(paintBounds.XMost() - 1, scaledTileSize.width);
|
||||
|
@ -1380,7 +1380,7 @@ ClientMultiTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& a
|
|||
}
|
||||
|
||||
if (aPaintData->mScrollOffset.y >= aPaintData->mLastScrollOffset.y) {
|
||||
startY = RoundDownToTileEdge(paintBounds.y, scaledTileSize.height);
|
||||
startY = RoundDownToTileEdge(paintBounds.Y(), scaledTileSize.height);
|
||||
incY = scaledTileSize.height;
|
||||
} else {
|
||||
startY = RoundDownToTileEdge(paintBounds.YMost() - 1, scaledTileSize.height);
|
||||
|
@ -1405,9 +1405,9 @@ ClientMultiTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& a
|
|||
break;
|
||||
}
|
||||
if (Abs(scrollDiffY) >= Abs(scrollDiffX)) {
|
||||
tileBounds.x += incX;
|
||||
tileBounds.MoveByX(incX);
|
||||
} else {
|
||||
tileBounds.y += incY;
|
||||
tileBounds.MoveByY(incY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -535,10 +535,10 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aTransformedSubtreeRoo
|
|||
const LayerRect& stickyInner = layer->GetStickyScrollRangeInner();
|
||||
|
||||
LayerPoint originalTranslation = translation;
|
||||
translation.y = IntervalOverlap(translation.y, stickyOuter.y, stickyOuter.YMost()) -
|
||||
IntervalOverlap(translation.y, stickyInner.y, stickyInner.YMost());
|
||||
translation.x = IntervalOverlap(translation.x, stickyOuter.x, stickyOuter.XMost()) -
|
||||
IntervalOverlap(translation.x, stickyInner.x, stickyInner.XMost());
|
||||
translation.y = IntervalOverlap(translation.y, stickyOuter.Y(), stickyOuter.YMost()) -
|
||||
IntervalOverlap(translation.y, stickyInner.Y(), stickyInner.YMost());
|
||||
translation.x = IntervalOverlap(translation.x, stickyOuter.X(), stickyOuter.XMost()) -
|
||||
IntervalOverlap(translation.x, stickyInner.X(), stickyInner.XMost());
|
||||
unconsumedTranslation = translation - originalTranslation;
|
||||
}
|
||||
|
||||
|
@ -756,7 +756,7 @@ AdjustForClip(const AsyncTransformComponentMatrix& asyncTransform, Layer* aLayer
|
|||
// apply the tree transform, and translate back.
|
||||
if (const Maybe<ParentLayerIntRect>& shadowClipRect = aLayer->AsHostLayer()->GetShadowClipRect()) {
|
||||
if (shadowClipRect->TopLeft() != ParentLayerIntPoint()) { // avoid a gratuitous change of basis
|
||||
result.ChangeBasis(shadowClipRect->x, shadowClipRect->y, 0);
|
||||
result.ChangeBasis(shadowClipRect->X(), shadowClipRect->Y(), 0);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -45,8 +45,8 @@
|
|||
// #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 XY(k) (k).x, (k).y
|
||||
#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()
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -326,7 +326,7 @@ RenderMinimap(ContainerT* aContainer, LayerManagerComposite* aManager,
|
|||
}
|
||||
|
||||
// Don't render trivial minimap. They can show up from textboxes and other tiny frames.
|
||||
if (viewRect.width < 64 && viewRect.height < 64) {
|
||||
if (viewRect.Width() < 64 && viewRect.Height() < 64) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -342,15 +342,15 @@ RenderMinimap(ContainerT* aContainer, LayerManagerComposite* aManager,
|
|||
dest = aContainer->GetEffectiveTransform().Inverse().TransformBounds(dest);
|
||||
}
|
||||
dest = dest.Intersect(compositionBounds.ToUnknownRect());
|
||||
scaleFactorX = std::min(100.f, dest.width - (2 * horizontalPadding)) / scrollRect.width;
|
||||
scaleFactorY = (dest.height - (2 * verticalPadding)) / scrollRect.height;
|
||||
scaleFactorX = std::min(100.f, dest.Width() - (2 * horizontalPadding)) / scrollRect.Width();
|
||||
scaleFactorY = (dest.Height() - (2 * verticalPadding)) / scrollRect.Height();
|
||||
scaleFactor = std::min(scaleFactorX, scaleFactorY);
|
||||
if (scaleFactor <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Matrix4x4 transform = Matrix4x4::Scaling(scaleFactor, scaleFactor, 1);
|
||||
transform.PostTranslate(horizontalPadding + dest.x, verticalPadding + dest.y, 0);
|
||||
transform.PostTranslate(horizontalPadding + dest.X(), verticalPadding + dest.Y(), 0);
|
||||
|
||||
Rect transformedScrollRect = transform.TransformBounds(scrollRect.ToUnknownRect());
|
||||
|
||||
|
@ -440,7 +440,7 @@ RenderLayers(ContainerT* aContainer, LayerManagerComposite* aManager,
|
|||
gfx::IntRect clearRect = layerToRender->GetClearRect();
|
||||
if (!clearRect.IsEmpty()) {
|
||||
// Clear layer's visible rect on FrameBuffer with transparent pixels
|
||||
gfx::Rect fbRect(clearRect.x, clearRect.y, clearRect.Width(), clearRect.Height());
|
||||
gfx::Rect fbRect(clearRect.X(), clearRect.Y(), clearRect.Width(), clearRect.Height());
|
||||
compositor->ClearRect(fbRect);
|
||||
layerToRender->SetClearRect(gfx::IntRect(0, 0, 0, 0));
|
||||
}
|
||||
|
@ -539,10 +539,10 @@ CreateTemporaryTargetAndCopyFromBackground(ContainerT* aContainer,
|
|||
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,
|
||||
gfx::IntRect surfaceRect = gfx::IntRect(visibleRect.X(), visibleRect.Y(),
|
||||
visibleRect.Width(), visibleRect.Height());
|
||||
|
||||
gfx::IntPoint sourcePoint = gfx::IntPoint(visibleRect.x, visibleRect.y);
|
||||
gfx::IntPoint sourcePoint = gfx::IntPoint(visibleRect.X(), visibleRect.Y());
|
||||
|
||||
gfx::Matrix4x4 transform = aContainer->GetEffectiveTransform();
|
||||
DebugOnly<gfx::Matrix> transform2d;
|
||||
|
@ -737,7 +737,7 @@ TransformRect(const LayerIntRect& aRect, const Matrix4x4& aTransform)
|
|||
return LayerIntRect();
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
|
|
|
@ -175,11 +175,11 @@ ContentHostTexture::Composite(Compositor* aCompositor,
|
|||
tileRegionRect = regionRect.Intersect(currentTileRect);
|
||||
tileRegionRect.MoveBy(-currentTileRect.TopLeft());
|
||||
}
|
||||
gfx::Rect rect(tileScreenRect.x, tileScreenRect.y,
|
||||
gfx::Rect rect(tileScreenRect.X(), tileScreenRect.Y(),
|
||||
tileScreenRect.Width(), tileScreenRect.Height());
|
||||
|
||||
effect->mTextureCoords = Rect(Float(tileRegionRect.x) / texRect.Width(),
|
||||
Float(tileRegionRect.y) / 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());
|
||||
|
||||
|
|
|
@ -264,15 +264,15 @@ ImageHost::Composite(Compositor* aCompositor,
|
|||
it->BeginBigImageIteration();
|
||||
do {
|
||||
IntRect tileRect = it->GetTileRect();
|
||||
gfx::Rect rect(tileRect.x, tileRect.y, tileRect.Width(), tileRect.Height());
|
||||
gfx::Rect rect(tileRect.X(), tileRect.Y(), tileRect.Width(), tileRect.Height());
|
||||
rect = rect.Intersect(pictureRect);
|
||||
effect->mTextureCoords = Rect(Float(rect.x - tileRect.x) / tileRect.Width(),
|
||||
Float(rect.y - tileRect.y) / tileRect.Height(),
|
||||
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.SetHeight(-effect->mTextureCoords.Height());
|
||||
effect->mTextureCoords.SetRectY(effect->mTextureCoords.YMost(),
|
||||
-effect->mTextureCoords.Height());
|
||||
}
|
||||
aCompositor->DrawGeometry(rect, aClipRect, aEffectChain,
|
||||
aOpacity, aTransform, aGeometry);
|
||||
|
@ -285,14 +285,14 @@ ImageHost::Composite(Compositor* aCompositor,
|
|||
aClipRect, aTransform, mFlashCounter);
|
||||
} else {
|
||||
IntSize textureSize = mCurrentTextureSource->GetSize();
|
||||
effect->mTextureCoords = Rect(Float(img->mPictureRect.x) / textureSize.width,
|
||||
Float(img->mPictureRect.y) / textureSize.height,
|
||||
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);
|
||||
|
||||
if (img->mTextureHost->GetFlags() & TextureFlags::ORIGIN_BOTTOM_LEFT) {
|
||||
effect->mTextureCoords.y = effect->mTextureCoords.YMost();
|
||||
effect->mTextureCoords.SetHeight(-effect->mTextureCoords.Height());
|
||||
effect->mTextureCoords.SetRectY(effect->mTextureCoords.YMost(),
|
||||
-effect->mTextureCoords.Height());
|
||||
}
|
||||
|
||||
aCompositor->DrawGeometry(pictureRect, aClipRect, aEffectChain,
|
||||
|
|
|
@ -132,12 +132,11 @@ ImageLayerComposite::ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransform
|
|||
SnapTransform(local, sourceRect, nullptr) *
|
||||
SnapTransformTranslation(aTransformToSurface, nullptr);
|
||||
|
||||
if (mScaleMode != ScaleMode::SCALE_NONE &&
|
||||
sourceRect.width != 0.0 && sourceRect.height != 0.0) {
|
||||
if (mScaleMode != ScaleMode::SCALE_NONE && !sourceRect.IsZero()) {
|
||||
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) *
|
||||
|
|
|
@ -723,7 +723,7 @@ LayerManagerComposite::PushGroupForLayerEffects()
|
|||
// so that we don't have to change size if the drawing area changes.
|
||||
IntRect rect(previousTarget->GetOrigin(), previousTarget->GetSize());
|
||||
// XXX: I'm not sure if this is true or not...
|
||||
MOZ_ASSERT(rect.x == 0 && rect.y == 0);
|
||||
MOZ_ASSERT(rect.IsEqualXY(0, 0));
|
||||
if (!mTwoPassTmpTarget ||
|
||||
mTwoPassTmpTarget->GetSize() != previousTarget->GetSize() ||
|
||||
mTwoPassTmpTarget->GetOrigin() != previousTarget->GetOrigin()) {
|
||||
|
@ -894,7 +894,7 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi
|
|||
}
|
||||
|
||||
ParentLayerIntRect clipRect;
|
||||
IntRect bounds(mRenderBounds.x, mRenderBounds.y, mRenderBounds.Width(), mRenderBounds.Height());
|
||||
IntRect bounds(mRenderBounds.X(), mRenderBounds.Y(), mRenderBounds.Width(), mRenderBounds.Height());
|
||||
IntRect actualBounds;
|
||||
|
||||
CompositorBench(mCompositor, bounds);
|
||||
|
@ -910,12 +910,12 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi
|
|||
#endif
|
||||
if (mRoot->GetClipRect()) {
|
||||
clipRect = *mRoot->GetClipRect();
|
||||
IntRect rect(clipRect.x, clipRect.y, clipRect.Width(), clipRect.Height());
|
||||
IntRect rect(clipRect.X(), clipRect.Y(), clipRect.Width(), clipRect.Height());
|
||||
mCompositor->BeginFrame(aInvalidRegion, &rect, bounds, aOpaqueRegion, nullptr, &actualBounds);
|
||||
} else {
|
||||
gfx::IntRect rect;
|
||||
mCompositor->BeginFrame(aInvalidRegion, nullptr, bounds, aOpaqueRegion, &rect, &actualBounds);
|
||||
clipRect = ParentLayerIntRect(rect.x, rect.y, rect.Width(), rect.Height());
|
||||
clipRect = ParentLayerIntRect(rect.X(), rect.Y(), rect.Width(), rect.Height());
|
||||
}
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
ScreenCoord offset = GetContentShiftForToolbar();
|
||||
|
@ -959,7 +959,7 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi
|
|||
if (!mRegionToClear.IsEmpty()) {
|
||||
for (auto iter = mRegionToClear.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const IntRect& r = iter.Get();
|
||||
mCompositor->ClearRect(Rect(r.x, r.y, r.Width(), r.Height()));
|
||||
mCompositor->ClearRect(Rect(r.X(), r.Y(), r.Width(), r.Height()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ PaintCounter::Draw(Compositor* aCompositor, TimeDuration aPaintTime, TimeDuratio
|
|||
effectChain.mPrimaryEffect = mTexturedEffect;
|
||||
|
||||
gfx::Matrix4x4 identity;
|
||||
Rect rect(mRect.x, mRect.y, mRect.Width(), mRect.Height());
|
||||
Rect rect(mRect.X(), mRect.Y(), mRect.Width(), mRect.Height());
|
||||
aCompositor->DrawQuad(rect, mRect, effectChain, 1.0, identity);
|
||||
}
|
||||
|
||||
|
|
|
@ -515,14 +515,14 @@ TiledContentHost::RenderTile(TileHost& aTile,
|
|||
|
||||
for (auto iter = aScreenRegion.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const IntRect& rect = iter.Get();
|
||||
Rect graphicsRect(rect.x, rect.y, rect.Width(), rect.Height());
|
||||
Rect textureRect(rect.x - aTextureOffset.x, rect.y - aTextureOffset.y,
|
||||
Rect graphicsRect(rect.X(), rect.Y(), rect.Width(), rect.Height());
|
||||
Rect textureRect(rect.X() - aTextureOffset.x, rect.Y() - aTextureOffset.y,
|
||||
rect.Width(), rect.Height());
|
||||
|
||||
effect->mTextureCoords = Rect(textureRect.x / aTextureBounds.width,
|
||||
textureRect.y / aTextureBounds.height,
|
||||
textureRect.Width() / aTextureBounds.width,
|
||||
textureRect.Height() / aTextureBounds.height);
|
||||
effect->mTextureCoords.SetRect(textureRect.X() / aTextureBounds.width,
|
||||
textureRect.Y() / aTextureBounds.height,
|
||||
textureRect.Width() / aTextureBounds.width,
|
||||
textureRect.Height() / aTextureBounds.height);
|
||||
|
||||
aCompositor->DrawGeometry(graphicsRect, aClipRect, aEffectChain, opacity,
|
||||
aTransform, aVisibleRect, aGeometry);
|
||||
|
@ -597,7 +597,7 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
|
|||
effect.mPrimaryEffect = new EffectSolidColor(*aBackgroundColor);
|
||||
for (auto iter = backgroundRegion.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const IntRect& rect = iter.Get();
|
||||
Rect graphicsRect(rect.x, rect.y, rect.Width(), rect.Height());
|
||||
Rect graphicsRect(rect.X(), rect.Y(), rect.Width(), rect.Height());
|
||||
aCompositor->DrawGeometry(graphicsRect, aClipRect, effect,
|
||||
1.0, aTransform, aGeometry);
|
||||
}
|
||||
|
@ -625,7 +625,7 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
|
|||
RenderTile(tile, aCompositor, aEffectChain, aOpacity,
|
||||
aTransform, aSamplingFilter, aClipRect, tileDrawRegion,
|
||||
tileOffset * resolution, aLayerBuffer.GetTileSize(),
|
||||
gfx::Rect(visibleRect.x, visibleRect.y,
|
||||
gfx::Rect(visibleRect.X(), visibleRect.Y(),
|
||||
visibleRect.Width(), visibleRect.Height()),
|
||||
aGeometry);
|
||||
|
||||
|
@ -634,7 +634,7 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
|
|||
}
|
||||
}
|
||||
|
||||
gfx::Rect rect(visibleRect.x, visibleRect.y,
|
||||
gfx::Rect rect(visibleRect.X(), visibleRect.Y(),
|
||||
visibleRect.Width(), visibleRect.Height());
|
||||
aCompositor->DrawDiagnostics(DiagnosticFlags::CONTENT | componentAlphaDiagnostic,
|
||||
rect, aClipRect, aTransform, mFlashCounter);
|
||||
|
|
|
@ -327,9 +327,9 @@ already_AddRefed<CompositingRenderTarget>
|
|||
CompositorD3D11::CreateRenderTarget(const gfx::IntRect& aRect,
|
||||
SurfaceInitMode aInit)
|
||||
{
|
||||
MOZ_ASSERT(aRect.Width() != 0 && aRect.Height() != 0);
|
||||
MOZ_ASSERT(!aRect.IsZero());
|
||||
|
||||
if (aRect.Width() * aRect.Height() == 0) {
|
||||
if (aRect.IsZero()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -359,9 +359,9 @@ CompositorD3D11::CreateTexture(const gfx::IntRect& aRect,
|
|||
const CompositingRenderTarget* aSource,
|
||||
const gfx::IntPoint& aSourcePoint)
|
||||
{
|
||||
MOZ_ASSERT(aRect.Width() != 0 && aRect.Height() != 0);
|
||||
MOZ_ASSERT(!aRect.IsZero());
|
||||
|
||||
if (aRect.Width() * aRect.Height() == 0) {
|
||||
if (aRect.IsZero()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -398,8 +398,8 @@ CompositorD3D11::CreateTexture(const gfx::IntRect& aRect,
|
|||
D3D11_BOX copyBox;
|
||||
copyBox.front = 0;
|
||||
copyBox.back = 1;
|
||||
copyBox.left = copyRect.x;
|
||||
copyBox.top = copyRect.y;
|
||||
copyBox.left = copyRect.X();
|
||||
copyBox.top = copyRect.Y();
|
||||
copyBox.right = copyRect.XMost();
|
||||
copyBox.bottom = copyRect.YMost();
|
||||
|
||||
|
@ -525,9 +525,9 @@ CompositorD3D11::ClearRect(const gfx::Rect& aRect)
|
|||
mPSConstants.layerOpacity[0] = 1.0f;
|
||||
|
||||
D3D11_RECT scissor;
|
||||
scissor.left = aRect.x;
|
||||
scissor.left = aRect.X();
|
||||
scissor.right = aRect.XMost();
|
||||
scissor.top = aRect.y;
|
||||
scissor.top = aRect.Y();
|
||||
scissor.bottom = aRect.YMost();
|
||||
mContext->RSSetScissorRects(1, &scissor);
|
||||
mContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
|
||||
|
@ -741,14 +741,14 @@ CompositorD3D11::DrawGeometry(const Geometry& aGeometry,
|
|||
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._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);
|
||||
}
|
||||
|
@ -757,9 +757,9 @@ CompositorD3D11::DrawGeometry(const Geometry& aGeometry,
|
|||
return;
|
||||
}
|
||||
|
||||
scissor.left = clipRect.x;
|
||||
scissor.left = clipRect.X();
|
||||
scissor.right = clipRect.XMost();
|
||||
scissor.top = clipRect.y;
|
||||
scissor.top = clipRect.Y();
|
||||
scissor.bottom = clipRect.YMost();
|
||||
|
||||
bool useBlendShaders = false;
|
||||
|
@ -1015,7 +1015,7 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion,
|
|||
|
||||
IntRect clipRect = invalidRect;
|
||||
if (aClipRectIn) {
|
||||
clipRect.IntersectRect(clipRect, IntRect(aClipRectIn->x, aClipRectIn->y, aClipRectIn->Width(), aClipRectIn->Height()));
|
||||
clipRect.IntersectRect(clipRect, IntRect(aClipRectIn->X(), aClipRectIn->Y(), aClipRectIn->Width(), aClipRectIn->Height()));
|
||||
}
|
||||
|
||||
if (clipRect.IsEmpty()) {
|
||||
|
@ -1179,8 +1179,8 @@ CompositorD3D11::Present()
|
|||
uint32_t i = 0;
|
||||
for (auto iter = mBackBufferInvalid.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const IntRect& r = iter.Get();
|
||||
rects[i].left = r.x;
|
||||
rects[i].top = r.y;
|
||||
rects[i].left = r.X();
|
||||
rects[i].top = r.Y();
|
||||
rects[i].bottom = r.YMost();
|
||||
rects[i].right = r.XMost();
|
||||
i++;
|
||||
|
@ -1414,11 +1414,11 @@ CompositorD3D11::UpdateRenderTarget()
|
|||
D3D11_BOX box;
|
||||
box.back = 1;
|
||||
box.front = 0;
|
||||
box.left = rect.x;
|
||||
box.left = rect.X();
|
||||
box.right = rect.XMost();
|
||||
box.top = rect.y;
|
||||
box.top = rect.Y();
|
||||
box.bottom = rect.YMost();
|
||||
mContext->CopySubresourceRegion(backBuf, 0, rect.x, rect.y, 0, frontBuf, 0, &box);
|
||||
mContext->CopySubresourceRegion(backBuf, 0, rect.X(), rect.Y(), 0, frontBuf, 0, &box);
|
||||
}
|
||||
mBackBufferInvalid = mFrontBufferInvalid;
|
||||
}
|
||||
|
@ -1528,7 +1528,7 @@ CompositorD3D11::PaintToTarget()
|
|||
SurfaceFormat::B8G8R8A8);
|
||||
mTarget->CopySurface(sourceSurface,
|
||||
IntRect(0, 0, bbDesc.Width, bbDesc.Height),
|
||||
IntPoint(-mTargetBounds.x, -mTargetBounds.y));
|
||||
IntPoint(-mTargetBounds.X(), -mTargetBounds.Y()));
|
||||
|
||||
mTarget->Flush();
|
||||
mContext->Unmap(readTexture, 0);
|
||||
|
|
|
@ -398,7 +398,7 @@ MLGSwapChainD3D11::UpdateBackBufferContents(ID3D11Texture2D* aBack)
|
|||
for (auto iter = frontValid.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const IntRect& rect = iter.Get();
|
||||
D3D11_BOX box = RectToBox(rect);
|
||||
context->CopySubresourceRegion(aBack, 0, rect.x, rect.y, 0, front, 0, &box);
|
||||
context->CopySubresourceRegion(aBack, 0, rect.X(), rect.Y(), 0, front, 0, &box);
|
||||
}
|
||||
|
||||
// The back and front buffers are now in sync.
|
||||
|
@ -454,8 +454,8 @@ MLGSwapChainD3D11::Present()
|
|||
size_t i = 0;
|
||||
for (auto iter = mBackBufferInvalid.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const IntRect& rect = iter.Get();
|
||||
rects[i].left = rect.x;
|
||||
rects[i].top = rect.y;
|
||||
rects[i].left = rect.X();
|
||||
rects[i].top = rect.Y();
|
||||
rects[i].bottom = rect.YMost();
|
||||
rects[i].right = rect.XMost();
|
||||
i++;
|
||||
|
@ -576,7 +576,7 @@ MLGSwapChainD3D11::CopyBackbuffer(gfx::DrawTarget* aTarget, const gfx::IntRect&
|
|||
aTarget->CopySurface(
|
||||
source,
|
||||
IntRect(0, 0, bbDesc.Width, bbDesc.Height),
|
||||
IntPoint(-aBounds.x, -aBounds.y));
|
||||
IntPoint(-aBounds.X(), -aBounds.Y()));
|
||||
aTarget->Flush();
|
||||
|
||||
context->Unmap(temp, 0);
|
||||
|
@ -1417,8 +1417,8 @@ 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.TopLeftX = aViewport.X();
|
||||
vp.TopLeftY = aViewport.Y();
|
||||
vp.Width = aViewport.Width();
|
||||
vp.Height = aViewport.Height();
|
||||
mCtx->RSSetViewports(1, &vp);
|
||||
|
@ -1428,8 +1428,8 @@ static inline D3D11_RECT
|
|||
ToD3D11Rect(const gfx::IntRect& aRect)
|
||||
{
|
||||
D3D11_RECT rect;
|
||||
rect.left = aRect.x;
|
||||
rect.top = aRect.y;
|
||||
rect.left = aRect.X();
|
||||
rect.top = aRect.Y();
|
||||
rect.right = aRect.XMost();
|
||||
rect.bottom = aRect.YMost();
|
||||
return rect;
|
||||
|
@ -2122,8 +2122,8 @@ RectToBox(const gfx::IntRect& aRect)
|
|||
D3D11_BOX box;
|
||||
box.front = 0;
|
||||
box.back = 1;
|
||||
box.left = aRect.x;
|
||||
box.top = aRect.y;
|
||||
box.left = aRect.X();
|
||||
box.top = aRect.Y();
|
||||
box.right = aRect.XMost();
|
||||
box.bottom = aRect.YMost();
|
||||
return box;
|
||||
|
|
|
@ -1464,12 +1464,12 @@ DataTextureSourceD3D11::Update(DataSourceSurface* aSurface,
|
|||
D3D11_BOX box;
|
||||
box.front = 0;
|
||||
box.back = 1;
|
||||
box.left = rect.x;
|
||||
box.top = rect.y;
|
||||
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;
|
||||
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());
|
||||
}
|
||||
|
@ -1504,8 +1504,8 @@ DataTextureSourceD3D11::Update(DataSourceSurface* aSurface,
|
|||
|
||||
D3D11_SUBRESOURCE_DATA initData;
|
||||
initData.pSysMem = map.GetData() +
|
||||
tileRect.y * map.GetStride() +
|
||||
tileRect.x * bpp;
|
||||
tileRect.Y() * map.GetStride() +
|
||||
tileRect.X() * bpp;
|
||||
initData.SysMemPitch = map.GetStride();
|
||||
|
||||
hr = mDevice->CreateTexture2D(&desc, &initData, getter_AddRefs(mTileTextures[i]));
|
||||
|
@ -1576,7 +1576,7 @@ IntRect
|
|||
DataTextureSourceD3D11::GetTileRect()
|
||||
{
|
||||
IntRect rect = GetTileRect(mCurrentTile);
|
||||
return IntRect(rect.x, rect.y, rect.Width(), rect.Height());
|
||||
return IntRect(rect.X(), rect.Y(), rect.Width(), rect.Height());
|
||||
}
|
||||
|
||||
CompositingRenderTargetD3D11::CompositingRenderTargetD3D11(ID3D11Texture2D* aTexture,
|
||||
|
|
|
@ -366,7 +366,7 @@ static void CalculatePluginClip(const LayoutDeviceIntRect& aBounds,
|
|||
for (uint32_t idx = 0; idx < aPluginClipRects.Length(); idx++) {
|
||||
LayoutDeviceIntRect rect = aPluginClipRects[idx];
|
||||
// shift to content origin
|
||||
rect.MoveBy(aBounds.x, aBounds.y);
|
||||
rect.MoveBy(aBounds.X(), aBounds.Y());
|
||||
// accumulate visible rects
|
||||
contentVisibleRegion.OrWith(rect);
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ static void CalculatePluginClip(const LayoutDeviceIntRect& aBounds,
|
|||
return;
|
||||
}
|
||||
// shift to plugin widget origin
|
||||
contentVisibleRegion.MoveBy(-aBounds.x, -aBounds.y);
|
||||
contentVisibleRegion.MoveBy(-aBounds.X(), -aBounds.Y());
|
||||
for (auto iter = contentVisibleRegion.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const LayoutDeviceIntRect& rect = iter.Get();
|
||||
aResult.AppendElement(rect);
|
||||
|
@ -438,8 +438,8 @@ CompositorBridgeChild::RecvUpdatePluginConfigurations(const LayoutDeviceIntPoint
|
|||
// 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,
|
||||
widget->Resize(aContentOffset.x + bounds.X(),
|
||||
aContentOffset.y + bounds.Y(),
|
||||
bounds.Width(), bounds.Height(), true);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ ImageLayerMLGPU::SetRenderRegion(LayerIntRegion&& aRegion)
|
|||
default:
|
||||
// Clamp the visible region to the texture size. (see bug 1396507)
|
||||
MOZ_ASSERT(mScaleMode == ScaleMode::SCALE_NONE);
|
||||
aRegion.AndWith(LayerIntRect(0, 0, mPictureRect.width, mPictureRect.height));
|
||||
aRegion.AndWith(LayerIntRect(0, 0, mPictureRect.Width(), mPictureRect.Height()));
|
||||
break;
|
||||
}
|
||||
LayerMLGPU::SetRenderRegion(Move(aRegion));
|
||||
|
|
|
@ -55,16 +55,16 @@ MaskOperation::ComputeMaskRect(Layer* aLayer) const
|
|||
bool
|
||||
MaskTexture::operator <(const MaskTexture& aOther) const
|
||||
{
|
||||
if (mRect.x != aOther.mRect.x) {
|
||||
return mRect.x < aOther.mRect.x;
|
||||
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.Y() != aOther.mRect.Y()) {
|
||||
return mRect.Y() < aOther.mRect.Y();
|
||||
}
|
||||
if (mRect.width != aOther.mRect.width) {
|
||||
if (mRect.Width() != aOther.mRect.Width()) {
|
||||
return mRect.Width() < aOther.mRect.Width();
|
||||
}
|
||||
if (mRect.height != aOther.mRect.height) {
|
||||
if (mRect.Height() != aOther.mRect.Height()) {
|
||||
return mRect.Height() < aOther.mRect.Height();
|
||||
}
|
||||
return mSource < aOther.mSource;
|
||||
|
|
|
@ -540,7 +540,7 @@ TexturedRenderPass::AddClippedItem(Txn& aTxn,
|
|||
|
||||
Rect textureCoords = TextureRectToCoords(textureRect, aInfo.textureSize);
|
||||
if (mTextureFlags & TextureFlags::ORIGIN_BOTTOM_LEFT) {
|
||||
textureCoords.y = 1.0 - textureCoords.y;
|
||||
textureCoords.MoveToY(1.0 - textureCoords.Y());
|
||||
textureCoords.SetHeight(-textureCoords.Height());
|
||||
}
|
||||
|
||||
|
|
|
@ -520,9 +520,9 @@ CompositorOGL::PrepareViewport(CompositingRenderTargetOGL* aRenderTarget)
|
|||
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.IsZero(), "Trying to create a render target of invalid size");
|
||||
|
||||
if (aRect.Width() * aRect.Height() == 0) {
|
||||
if (aRect.IsZero()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -547,9 +547,9 @@ CompositorOGL::CreateRenderTargetFromSource(const IntRect &aRect,
|
|||
const CompositingRenderTarget *aSource,
|
||||
const IntPoint &aSourcePoint)
|
||||
{
|
||||
MOZ_ASSERT(aRect.Width() != 0 && aRect.Height() != 0, "Trying to create a render target of invalid size");
|
||||
MOZ_ASSERT(!aRect.IsZero(), "Trying to create a render target of invalid size");
|
||||
|
||||
if (aRect.Width() * aRect.Height() == 0) {
|
||||
if (aRect.IsZero()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -614,10 +614,10 @@ void
|
|||
CompositorOGL::ClearRect(const gfx::Rect& aRect)
|
||||
{
|
||||
// Map aRect to OGL coordinates, origin:bottom-left
|
||||
GLint y = mViewportSize.height - (aRect.y + aRect.Height());
|
||||
GLint y = mViewportSize.height - aRect.YMost();
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -638,15 +638,15 @@ CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
|
|||
if (mUseExternalSurfaceSize) {
|
||||
rect = gfx::IntRect(0, 0, mSurfaceSize.width, mSurfaceSize.height);
|
||||
} else {
|
||||
rect = gfx::IntRect(aRenderBounds.x, aRenderBounds.y, aRenderBounds.Width(), aRenderBounds.Height());
|
||||
rect = gfx::IntRect(aRenderBounds.X(), aRenderBounds.Y(), aRenderBounds.Width(), aRenderBounds.Height());
|
||||
}
|
||||
|
||||
if (aRenderBoundsOut) {
|
||||
*aRenderBoundsOut = rect;
|
||||
}
|
||||
|
||||
GLint width = rect.Width();
|
||||
GLint height = rect.Height();
|
||||
auto width = rect.Width();
|
||||
auto height = rect.Height();
|
||||
|
||||
// We can't draw anything to something with no area
|
||||
// so just return
|
||||
|
@ -725,6 +725,9 @@ CompositorOGL::CreateTexture(const IntRect& aRect, bool aCopyFromSource,
|
|||
clampedRect.SetWidth(std::min(clampedRect.Width(), maxTexSize));
|
||||
clampedRect.SetHeight(std::min(clampedRect.Height(), maxTexSize));
|
||||
|
||||
auto clampedRectWidth = clampedRect.Width();
|
||||
auto clampedRectHeight = clampedRect.Height();
|
||||
|
||||
GLuint tex;
|
||||
|
||||
mGLContext->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||
|
@ -753,25 +756,25 @@ CompositorOGL::CreateTexture(const IntRect& aRect, bool aCopyFromSource,
|
|||
mGLContext->fCopyTexImage2D(mFBOTextureTarget,
|
||||
0,
|
||||
LOCAL_GL_RGBA,
|
||||
clampedRect.x, FlipY(clampedRect.y + clampedRect.Height()),
|
||||
clampedRect.Width(), clampedRect.Height(),
|
||||
clampedRect.X(), FlipY(clampedRect.YMost()),
|
||||
clampedRectWidth, clampedRectHeight,
|
||||
0);
|
||||
} else {
|
||||
// Curses, incompatible formats. Take a slow path.
|
||||
|
||||
// RGBA
|
||||
size_t bufferSize = clampedRect.Width() * clampedRect.Height() * 4;
|
||||
size_t bufferSize = clampedRectWidth * clampedRectHeight * 4;
|
||||
auto buf = MakeUnique<uint8_t[]>(bufferSize);
|
||||
|
||||
mGLContext->fReadPixels(clampedRect.x, clampedRect.y,
|
||||
clampedRect.Width(), clampedRect.Height(),
|
||||
mGLContext->fReadPixels(clampedRect.X(), clampedRect.Y(),
|
||||
clampedRectWidth, clampedRectHeight,
|
||||
LOCAL_GL_RGBA,
|
||||
LOCAL_GL_UNSIGNED_BYTE,
|
||||
buf.get());
|
||||
mGLContext->fTexImage2D(mFBOTextureTarget,
|
||||
0,
|
||||
LOCAL_GL_RGBA,
|
||||
clampedRect.Width(), clampedRect.Height(),
|
||||
clampedRectWidth, clampedRectHeight,
|
||||
0,
|
||||
LOCAL_GL_RGBA,
|
||||
LOCAL_GL_UNSIGNED_BYTE,
|
||||
|
@ -789,7 +792,7 @@ CompositorOGL::CreateTexture(const IntRect& aRect, bool aCopyFromSource,
|
|||
mGLContext->fTexImage2D(mFBOTextureTarget,
|
||||
0,
|
||||
LOCAL_GL_RGBA,
|
||||
clampedRect.Width(), clampedRect.Height(),
|
||||
clampedRectWidth, clampedRectHeight,
|
||||
0,
|
||||
LOCAL_GL_RGBA,
|
||||
LOCAL_GL_UNSIGNED_BYTE,
|
||||
|
@ -806,8 +809,8 @@ CompositorOGL::CreateTexture(const IntRect& aRect, bool aCopyFromSource,
|
|||
mGLContext->fBindTexture(mFBOTextureTarget, 0);
|
||||
|
||||
if (aAllocSize) {
|
||||
aAllocSize->width = clampedRect.Width();
|
||||
aAllocSize->height = clampedRect.Height();
|
||||
aAllocSize->width = clampedRectWidth;
|
||||
aAllocSize->height = clampedRectHeight;
|
||||
}
|
||||
|
||||
return tex;
|
||||
|
@ -1046,7 +1049,7 @@ CompositorOGL::DrawGeometry(const Geometry& aGeometry,
|
|||
|
||||
// XXX: This doesn't handle 3D transforms. It also doesn't handled rotated
|
||||
// quads. Fix me.
|
||||
mPixelsFilled += destRect.width * destRect.height;
|
||||
mPixelsFilled += destRect.Width() * destRect.Height();
|
||||
|
||||
// Do a simple culling if this rect is out of target buffer.
|
||||
// Inflate a small size to avoid some numerical imprecision issue.
|
||||
|
@ -1069,8 +1072,8 @@ CompositorOGL::DrawGeometry(const Geometry& aGeometry,
|
|||
}
|
||||
|
||||
ScopedGLState scopedScissorTestState(mGLContext, LOCAL_GL_SCISSOR_TEST, true);
|
||||
ScopedScissorRect autoScissorRect(mGLContext, clipRect.x, FlipY(clipRect.y + clipRect.height),
|
||||
clipRect.width, clipRect.height);
|
||||
ScopedScissorRect autoScissorRect(mGLContext, clipRect.X(), FlipY(clipRect.Y() + clipRect.Height()),
|
||||
clipRect.Width(), clipRect.Height());
|
||||
|
||||
MaskType maskType;
|
||||
EffectMask* effectMask;
|
||||
|
@ -1093,10 +1096,10 @@ CompositorOGL::DrawGeometry(const Geometry& aGeometry,
|
|||
Rect bounds = Rect(Point(), Size(maskSize));
|
||||
bounds = maskTransform.As2D().TransformBounds(bounds);
|
||||
|
||||
maskQuadTransform._11 = 1.0f/bounds.width;
|
||||
maskQuadTransform._22 = 1.0f/bounds.height;
|
||||
maskQuadTransform._41 = float(-bounds.x)/bounds.width;
|
||||
maskQuadTransform._42 = float(-bounds.y)/bounds.height;
|
||||
maskQuadTransform._11 = 1.0f/bounds.Width();
|
||||
maskQuadTransform._22 = 1.0f/bounds.Height();
|
||||
maskQuadTransform._41 = float(-bounds.X())/bounds.Width();
|
||||
maskQuadTransform._42 = float(-bounds.Y())/bounds.Height();
|
||||
|
||||
maskType = MaskType::Mask;
|
||||
} else {
|
||||
|
@ -1481,7 +1484,7 @@ CompositorOGL::DrawGeometry(const Geometry& aGeometry,
|
|||
MakeCurrent();
|
||||
|
||||
LayerScope::DrawEnd(mGLContext, aEffectChain,
|
||||
aRect.width, aRect.height);
|
||||
aRect.Width(), aRect.Height());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1687,7 +1690,7 @@ CompositorOGL::CopyToTarget(DrawTarget* aTarget, const nsIntPoint& aTopLeft, con
|
|||
|
||||
Matrix oldMatrix = aTarget->GetTransform();
|
||||
aTarget->SetTransform(glToCairoTransform);
|
||||
Rect floatRect = Rect(rect.x, rect.y, rect.Width(), rect.Height());
|
||||
Rect floatRect = Rect(rect.X(), rect.Y(), width, height);
|
||||
aTarget->DrawSurface(source, floatRect, floatRect, DrawSurfaceOptions(), DrawOptions(1.0f, CompositionOp::OP_SOURCE));
|
||||
aTarget->SetTransform(oldMatrix);
|
||||
aTarget->Flush();
|
||||
|
|
|
@ -111,13 +111,13 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const gfx::IntRec
|
|||
// 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);
|
||||
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 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.XMost()) / float(dstSize.width) - 1.0f;
|
||||
float dy1 = 2.0f * float(srcSubInDstRect.YMost()) / float(dstSize.height) - 1.0f;
|
||||
ScopedViewportRect autoViewportRect(gl, 0, 0, dstSize.width, dstSize.height);
|
||||
|
||||
RectTriangles rects;
|
||||
|
@ -132,8 +132,8 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const gfx::IntRec
|
|||
rects.addRect(/* dest rectangle */
|
||||
dx0, dy0, dx1, dy1,
|
||||
/* tex coords */
|
||||
srcSubRect.x / float(realTexSize.width),
|
||||
srcSubRect.y / float(realTexSize.height),
|
||||
srcSubRect.X() / float(realTexSize.width),
|
||||
srcSubRect.Y() / float(realTexSize.height),
|
||||
srcSubRect.XMost() / float(realTexSize.width),
|
||||
srcSubRect.YMost() / float(realTexSize.height));
|
||||
} else {
|
||||
|
|
|
@ -389,10 +389,10 @@ public:
|
|||
}
|
||||
|
||||
void SetLayerRects(const gfx::Rect* aRects) {
|
||||
float vals[16] = { aRects[0].x, aRects[0].y, aRects[0].Width(), aRects[0].Height(),
|
||||
aRects[1].x, aRects[1].y, aRects[1].Width(), aRects[1].Height(),
|
||||
aRects[2].x, aRects[2].y, aRects[2].Width(), aRects[2].Height(),
|
||||
aRects[3].x, aRects[3].y, aRects[3].Width(), aRects[3].Height() };
|
||||
float vals[16] = { aRects[0].X(), aRects[0].Y(), aRects[0].Width(), aRects[0].Height(),
|
||||
aRects[1].X(), aRects[1].Y(), aRects[1].Width(), aRects[1].Height(),
|
||||
aRects[2].X(), aRects[2].Y(), aRects[2].Width(), aRects[2].Height(),
|
||||
aRects[3].X(), aRects[3].Y(), aRects[3].Width(), aRects[3].Height() };
|
||||
SetUniform(KnownUniform::LayerRects, 16, vals);
|
||||
}
|
||||
|
||||
|
@ -406,10 +406,10 @@ public:
|
|||
}
|
||||
|
||||
void SetTextureRects(const gfx::Rect* aRects) {
|
||||
float vals[16] = { aRects[0].x, aRects[0].y, aRects[0].Width(), aRects[0].Height(),
|
||||
aRects[1].x, aRects[1].y, aRects[1].Width(), aRects[1].Height(),
|
||||
aRects[2].x, aRects[2].y, aRects[2].Width(), aRects[2].Height(),
|
||||
aRects[3].x, aRects[3].y, aRects[3].Width(), aRects[3].Height() };
|
||||
float vals[16] = { aRects[0].X(), aRects[0].Y(), aRects[0].Width(), aRects[0].Height(),
|
||||
aRects[1].X(), aRects[1].Y(), aRects[1].Width(), aRects[1].Height(),
|
||||
aRects[2].X(), aRects[2].Y(), aRects[2].Width(), aRects[2].Height(),
|
||||
aRects[3].X(), aRects[3].Y(), aRects[3].Width(), aRects[3].Height() };
|
||||
SetUniform(KnownUniform::TextureRects, 16, vals);
|
||||
}
|
||||
|
||||
|
|
|
@ -522,7 +522,7 @@ WebRenderCommandBuilder::GenerateFallbackData(nsDisplayItem* aItem,
|
|||
|
||||
// XXX not sure if paintSize should be in layer or layoutdevice pixels, it
|
||||
// has some sort of scaling applied.
|
||||
LayerIntSize paintSize = RoundedToInt(LayerSize(bounds.width * scale.width, bounds.height * scale.height));
|
||||
LayerIntSize paintSize = RoundedToInt(LayerSize(bounds.Width() * scale.width, bounds.Height() * scale.height));
|
||||
if (paintSize.width == 0 || paintSize.height == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -390,7 +390,7 @@ WebRenderLayerManager::MakeSnapshotIfRequired(LayoutDeviceIntSize aSize)
|
|||
gfxUtils::WriteAsPNG(snapshot, filename);
|
||||
*/
|
||||
|
||||
Rect dst(bounds.x, bounds.y, 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.
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
{}
|
||||
|
||||
void OrWith(const RectType& aRect) {
|
||||
pixman_box32_t box = { aRect.x, aRect.y, aRect.XMost(), aRect.YMost() };
|
||||
pixman_box32_t box = { aRect.X(), aRect.Y(), aRect.XMost(), aRect.YMost() };
|
||||
mRects.AppendElement(box);
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ private:
|
|||
{
|
||||
MOZ_ASSERT(!aRect.IsEmpty());
|
||||
MOZ_ASSERT(!aRect.Overflows());
|
||||
return { aRect.x, aRect.y, aRect.XMost(), aRect.YMost() };
|
||||
return { aRect.X(), aRect.Y(), aRect.XMost(), aRect.YMost() };
|
||||
}
|
||||
|
||||
RectT mBounds;
|
||||
|
|
|
@ -465,10 +465,7 @@ nsresult
|
|||
nsDeviceContext::GetRect(nsRect &aRect)
|
||||
{
|
||||
if (IsPrinterContext()) {
|
||||
aRect.x = 0;
|
||||
aRect.y = 0;
|
||||
aRect.SetWidth(mWidth);
|
||||
aRect.SetHeight(mHeight);
|
||||
aRect.SetRect(0, 0, mWidth, mHeight);
|
||||
} else
|
||||
ComputeFullAreaUsingScreen ( &aRect );
|
||||
|
||||
|
@ -479,10 +476,7 @@ nsresult
|
|||
nsDeviceContext::GetClientRect(nsRect &aRect)
|
||||
{
|
||||
if (IsPrinterContext()) {
|
||||
aRect.x = 0;
|
||||
aRect.y = 0;
|
||||
aRect.SetWidth(mWidth);
|
||||
aRect.SetHeight(mHeight);
|
||||
aRect.SetRect(0, 0, mWidth, mHeight);
|
||||
}
|
||||
else
|
||||
ComputeClientRectUsingScreen(&aRect);
|
||||
|
@ -621,10 +615,10 @@ nsDeviceContext::ComputeClientRectUsingScreen(nsRect* outRect)
|
|||
screen->GetAvailRect(&x, &y, &width, &height);
|
||||
|
||||
// convert to device units
|
||||
outRect->y = NSIntPixelsToAppUnits(y, AppUnitsPerDevPixel());
|
||||
outRect->x = NSIntPixelsToAppUnits(x, AppUnitsPerDevPixel());
|
||||
outRect->SetWidth(NSIntPixelsToAppUnits(width, AppUnitsPerDevPixel()));
|
||||
outRect->SetHeight(NSIntPixelsToAppUnits(height, AppUnitsPerDevPixel()));
|
||||
outRect->SetRect(NSIntPixelsToAppUnits(x, AppUnitsPerDevPixel()),
|
||||
NSIntPixelsToAppUnits(y, AppUnitsPerDevPixel()),
|
||||
NSIntPixelsToAppUnits(width, AppUnitsPerDevPixel()),
|
||||
NSIntPixelsToAppUnits(height, AppUnitsPerDevPixel()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -642,11 +636,10 @@ nsDeviceContext::ComputeFullAreaUsingScreen(nsRect* outRect)
|
|||
screen->GetRect ( &x, &y, &width, &height );
|
||||
|
||||
// convert to device units
|
||||
outRect->y = NSIntPixelsToAppUnits(y, AppUnitsPerDevPixel());
|
||||
outRect->x = NSIntPixelsToAppUnits(x, AppUnitsPerDevPixel());
|
||||
outRect->SetWidth(NSIntPixelsToAppUnits(width, AppUnitsPerDevPixel()));
|
||||
outRect->SetHeight(NSIntPixelsToAppUnits(height, AppUnitsPerDevPixel()));
|
||||
|
||||
outRect->SetRect(NSIntPixelsToAppUnits(x, AppUnitsPerDevPixel()),
|
||||
NSIntPixelsToAppUnits(y, AppUnitsPerDevPixel()),
|
||||
NSIntPixelsToAppUnits(width, AppUnitsPerDevPixel()),
|
||||
NSIntPixelsToAppUnits(height, AppUnitsPerDevPixel()));
|
||||
mWidth = outRect->Width();
|
||||
mHeight = outRect->Height();
|
||||
}
|
||||
|
|
|
@ -44,10 +44,10 @@ FILE* operator<<(FILE* out, const nsRect& rect)
|
|||
|
||||
// Output the coordinates in fractional pixels so they're easier to read
|
||||
tmp.Append('{');
|
||||
tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.x,
|
||||
tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.X(),
|
||||
nsDeviceContext::AppUnitsPerCSSPixel()));
|
||||
tmp.AppendLiteral(", ");
|
||||
tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.y,
|
||||
tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.Y(),
|
||||
nsDeviceContext::AppUnitsPerCSSPixel()));
|
||||
tmp.AppendLiteral(", ");
|
||||
tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.Width(),
|
||||
|
|
103
gfx/src/nsRect.h
103
gfx/src/nsRect.h
|
@ -73,31 +73,28 @@ struct nsRect :
|
|||
#ifdef NS_COORD_IS_FLOAT
|
||||
return UnionEdges(aRect);
|
||||
#else
|
||||
nsRect result;
|
||||
result.x = std::min(aRect.x, x);
|
||||
int64_t w = std::max(int64_t(aRect.x) + aRect.Width(), int64_t(x) + width) - result.x;
|
||||
nscoord resultX = std::min(aRect.X(), x);
|
||||
int64_t w = std::max(int64_t(aRect.X()) + aRect.Width(), int64_t(x) + width) - resultX;
|
||||
if (MOZ_UNLIKELY(w > nscoord_MAX)) {
|
||||
// Clamp huge negative x to nscoord_MIN / 2 and try again.
|
||||
result.x = std::max(result.x, nscoord_MIN / 2);
|
||||
w = std::max(int64_t(aRect.x) + aRect.Width(), int64_t(x) + width) - result.x;
|
||||
resultX = std::max(resultX, nscoord_MIN / 2);
|
||||
w = std::max(int64_t(aRect.X()) + aRect.Width(), int64_t(x) + width) - resultX;
|
||||
if (MOZ_UNLIKELY(w > nscoord_MAX)) {
|
||||
w = nscoord_MAX;
|
||||
}
|
||||
}
|
||||
result.SetWidth(nscoord(w));
|
||||
|
||||
result.y = std::min(aRect.y, y);
|
||||
int64_t h = std::max(int64_t(aRect.y) + aRect.Height(), int64_t(y) + height) - result.y;
|
||||
nscoord resultY = std::min(aRect.y, y);
|
||||
int64_t h = std::max(int64_t(aRect.Y()) + aRect.Height(), int64_t(y) + height) - resultY;
|
||||
if (MOZ_UNLIKELY(h > nscoord_MAX)) {
|
||||
// Clamp huge negative y to nscoord_MIN / 2 and try again.
|
||||
result.y = std::max(result.y, nscoord_MIN / 2);
|
||||
h = std::max(int64_t(aRect.y) + aRect.Height(), int64_t(y) + height) - result.y;
|
||||
resultY = std::max(resultY, nscoord_MIN / 2);
|
||||
h = std::max(int64_t(aRect.Y()) + aRect.Height(), int64_t(y) + height) - resultY;
|
||||
if (MOZ_UNLIKELY(h > nscoord_MAX)) {
|
||||
h = nscoord_MAX;
|
||||
}
|
||||
}
|
||||
result.SetHeight(nscoord(h));
|
||||
return result;
|
||||
return nsRect(resultX, resultY, nscoord(w), nscoord(h));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -191,13 +188,10 @@ nsRect::ScaleToOtherAppUnitsRoundOut(int32_t aFromAPP, int32_t aToAPP) const
|
|||
}
|
||||
|
||||
nsRect rect;
|
||||
nscoord right = NSToCoordCeil(NSCoordScale(XMost(), aFromAPP, aToAPP));
|
||||
nscoord bottom = NSToCoordCeil(NSCoordScale(YMost(), aFromAPP, aToAPP));
|
||||
rect.x = NSToCoordFloor(NSCoordScale(x, aFromAPP, aToAPP));
|
||||
rect.y = NSToCoordFloor(NSCoordScale(y, aFromAPP, aToAPP));
|
||||
rect.SetWidth(right - rect.x);
|
||||
rect.SetHeight(bottom - rect.y);
|
||||
|
||||
rect.SetBox(NSToCoordFloor(NSCoordScale(x, aFromAPP, aToAPP)),
|
||||
NSToCoordFloor(NSCoordScale(y, aFromAPP, aToAPP)),
|
||||
NSToCoordCeil(NSCoordScale(XMost(), aFromAPP, aToAPP)),
|
||||
NSToCoordCeil(NSCoordScale(YMost(), aFromAPP, aToAPP)));
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
@ -209,13 +203,10 @@ nsRect::ScaleToOtherAppUnitsRoundIn(int32_t aFromAPP, int32_t aToAPP) const
|
|||
}
|
||||
|
||||
nsRect rect;
|
||||
nscoord right = NSToCoordFloor(NSCoordScale(XMost(), aFromAPP, aToAPP));
|
||||
nscoord bottom = NSToCoordFloor(NSCoordScale(YMost(), aFromAPP, aToAPP));
|
||||
rect.x = NSToCoordCeil(NSCoordScale(x, aFromAPP, aToAPP));
|
||||
rect.y = NSToCoordCeil(NSCoordScale(y, aFromAPP, aToAPP));
|
||||
rect.SetWidth(right - rect.x);
|
||||
rect.SetHeight(bottom - rect.y);
|
||||
|
||||
rect.SetBox(NSToCoordCeil(NSCoordScale(x, aFromAPP, aToAPP)),
|
||||
NSToCoordCeil(NSCoordScale(y, aFromAPP, aToAPP)),
|
||||
NSToCoordFloor(NSCoordScale(XMost(), aFromAPP, aToAPP)),
|
||||
NSToCoordFloor(NSCoordScale(YMost(), aFromAPP, aToAPP)));
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
@ -225,13 +216,14 @@ nsRect::ScaleToNearestPixels(float aXScale, float aYScale,
|
|||
nscoord aAppUnitsPerPixel) const
|
||||
{
|
||||
mozilla::gfx::IntRect rect;
|
||||
rect.x = NSToIntRoundUp(NSAppUnitsToDoublePixels(x, aAppUnitsPerPixel) * aXScale);
|
||||
rect.y = NSToIntRoundUp(NSAppUnitsToDoublePixels(y, aAppUnitsPerPixel) * aYScale);
|
||||
// Avoid negative widths and heights due to overflow
|
||||
rect.SetWidth(std::max(0, NSToIntRoundUp(NSAppUnitsToDoublePixels(XMost(),
|
||||
aAppUnitsPerPixel) * aXScale) - rect.x));
|
||||
rect.SetHeight(std::max(0, NSToIntRoundUp(NSAppUnitsToDoublePixels(YMost(),
|
||||
aAppUnitsPerPixel) * aYScale) - rect.y));
|
||||
rect.SetNonEmptyBox(NSToIntRoundUp(NSAppUnitsToDoublePixels(x,
|
||||
aAppUnitsPerPixel) * aXScale),
|
||||
NSToIntRoundUp(NSAppUnitsToDoublePixels(y,
|
||||
aAppUnitsPerPixel) * aYScale),
|
||||
NSToIntRoundUp(NSAppUnitsToDoublePixels(XMost(),
|
||||
aAppUnitsPerPixel) * aXScale),
|
||||
NSToIntRoundUp(NSAppUnitsToDoublePixels(YMost(),
|
||||
aAppUnitsPerPixel) * aYScale));
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
@ -241,13 +233,14 @@ nsRect::ScaleToOutsidePixels(float aXScale, float aYScale,
|
|||
nscoord aAppUnitsPerPixel) const
|
||||
{
|
||||
mozilla::gfx::IntRect rect;
|
||||
rect.x = NSToIntFloor(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel)) * aXScale);
|
||||
rect.y = NSToIntFloor(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel)) * aYScale);
|
||||
// Avoid negative widths and heights due to overflow
|
||||
rect.SetWidth(std::max(0, NSToIntCeil(NSAppUnitsToFloatPixels(XMost(),
|
||||
float(aAppUnitsPerPixel)) * aXScale) - rect.x));
|
||||
rect.SetHeight(std::max(0, NSToIntCeil(NSAppUnitsToFloatPixels(YMost(),
|
||||
float(aAppUnitsPerPixel)) * aYScale) - rect.y));
|
||||
rect.SetNonEmptyBox(NSToIntFloor(NSAppUnitsToFloatPixels(x,
|
||||
float(aAppUnitsPerPixel)) * aXScale),
|
||||
NSToIntFloor(NSAppUnitsToFloatPixels(y,
|
||||
float(aAppUnitsPerPixel)) * aYScale),
|
||||
NSToIntCeil(NSAppUnitsToFloatPixels(XMost(),
|
||||
float(aAppUnitsPerPixel)) * aXScale),
|
||||
NSToIntCeil(NSAppUnitsToFloatPixels(YMost(),
|
||||
float(aAppUnitsPerPixel)) * aYScale));
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
@ -257,13 +250,14 @@ nsRect::ScaleToInsidePixels(float aXScale, float aYScale,
|
|||
nscoord aAppUnitsPerPixel) const
|
||||
{
|
||||
mozilla::gfx::IntRect rect;
|
||||
rect.x = NSToIntCeil(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel)) * aXScale);
|
||||
rect.y = NSToIntCeil(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel)) * aYScale);
|
||||
// Avoid negative widths and heights due to overflow
|
||||
rect.SetWidth(std::max(0, NSToIntFloor(NSAppUnitsToFloatPixels(XMost(),
|
||||
float(aAppUnitsPerPixel)) * aXScale) - rect.x));
|
||||
rect.SetHeight(std::max(0, NSToIntFloor(NSAppUnitsToFloatPixels(YMost(),
|
||||
float(aAppUnitsPerPixel)) * aYScale) - rect.y));
|
||||
rect.SetNonEmptyBox(NSToIntCeil(NSAppUnitsToFloatPixels(x,
|
||||
float(aAppUnitsPerPixel)) * aXScale),
|
||||
NSToIntCeil(NSAppUnitsToFloatPixels(y,
|
||||
float(aAppUnitsPerPixel)) * aYScale),
|
||||
NSToIntFloor(NSAppUnitsToFloatPixels(XMost(),
|
||||
float(aAppUnitsPerPixel)) * aXScale),
|
||||
NSToIntFloor(NSAppUnitsToFloatPixels(YMost(),
|
||||
float(aAppUnitsPerPixel)) * aYScale));
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
@ -290,16 +284,15 @@ nsRect::RemoveResolution(const float aResolution) const
|
|||
{
|
||||
MOZ_ASSERT(aResolution > 0.0f);
|
||||
nsRect rect;
|
||||
rect.x = NSToCoordRound(NSCoordToFloat(x) / aResolution);
|
||||
rect.y = NSToCoordRound(NSCoordToFloat(y) / aResolution);
|
||||
rect.MoveTo(NSToCoordRound(NSCoordToFloat(x) / aResolution),
|
||||
NSToCoordRound(NSCoordToFloat(y) / aResolution));
|
||||
// A 1x1 rect indicates we are just hit testing a point, so pass down a 1x1
|
||||
// rect as well instead of possibly rounding the width or height to zero.
|
||||
if (width == 1 && height == 1) {
|
||||
rect.SetWidth(1);
|
||||
rect.SetHeight(1);
|
||||
rect.SizeTo(1, 1);
|
||||
} else {
|
||||
rect.SetWidth(NSToCoordCeil(NSCoordToFloat(width) / aResolution));
|
||||
rect.SetHeight(NSToCoordCeil(NSCoordToFloat(height) / aResolution));
|
||||
rect.SizeTo(NSToCoordCeil(NSCoordToFloat(width) / aResolution),
|
||||
NSToCoordCeil(NSCoordToFloat(height) / aResolution));
|
||||
}
|
||||
|
||||
return rect;
|
||||
|
@ -312,8 +305,8 @@ template<class units>
|
|||
nsRect
|
||||
ToAppUnits(const mozilla::gfx::IntRectTyped<units>& aRect, nscoord aAppUnitsPerPixel)
|
||||
{
|
||||
return nsRect(NSIntPixelsToAppUnits(aRect.x, aAppUnitsPerPixel),
|
||||
NSIntPixelsToAppUnits(aRect.y, aAppUnitsPerPixel),
|
||||
return nsRect(NSIntPixelsToAppUnits(aRect.X(), aAppUnitsPerPixel),
|
||||
NSIntPixelsToAppUnits(aRect.Y(), aAppUnitsPerPixel),
|
||||
NSIntPixelsToAppUnits(aRect.Width(), aAppUnitsPerPixel),
|
||||
NSIntPixelsToAppUnits(aRect.Height(), aAppUnitsPerPixel));
|
||||
}
|
||||
|
|
|
@ -612,7 +612,7 @@ TransformRect(const mozilla::gfx::IntRect& aRect, const mozilla::gfx::Matrix4x4&
|
|||
return mozilla::gfx::IntRect();
|
||||
}
|
||||
|
||||
mozilla::gfx::RectDouble rect(aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
mozilla::gfx::RectDouble rect(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
rect = aTransform.TransformAndClipBounds(rect, mozilla::gfx::RectDouble::MaxIntRect());
|
||||
rect.RoundOut();
|
||||
|
||||
|
@ -794,22 +794,22 @@ nsIntRegion nsRegion::ScaleToInsidePixels (float aScaleX, float aScaleY,
|
|||
mozilla::gfx::IntRect deviceRect =
|
||||
rect.ScaleToInsidePixels(aScaleX, aScaleY, aAppUnitsPerPixel);
|
||||
|
||||
if (rect.y <= first.YMost()) {
|
||||
if (rect.XMost() == first.x && rect.YMost() <= first.YMost()) {
|
||||
if (rect.Y() <= first.YMost()) {
|
||||
if (rect.XMost() == first.X() && rect.YMost() <= first.YMost()) {
|
||||
// rect is touching on the left edge of the first rect and contained within
|
||||
// the length of its left edge
|
||||
deviceRect.SetRightEdge(firstDeviceRect.x);
|
||||
} else if (rect.x == first.XMost() && rect.YMost() <= first.YMost()) {
|
||||
deviceRect.SetRightEdge(firstDeviceRect.X());
|
||||
} else if (rect.X() == first.XMost() && rect.YMost() <= first.YMost()) {
|
||||
// rect is touching on the right edge of the first rect and contained within
|
||||
// the length of its right edge
|
||||
deviceRect.SetLeftEdge(firstDeviceRect.XMost());
|
||||
} else if (rect.y == first.YMost()) {
|
||||
} else if (rect.Y() == first.YMost()) {
|
||||
// The bottom of the first rect is on the same line as the top of rect, but
|
||||
// they aren't necessarily contained.
|
||||
if (rect.x <= first.x && rect.XMost() >= first.XMost()) {
|
||||
if (rect.X() <= first.X() && rect.XMost() >= first.XMost()) {
|
||||
// The top of rect contains the bottom of the first rect
|
||||
firstDeviceRect.SetBottomEdge(deviceRect.y);
|
||||
} else if (rect.x >= first.x && rect.XMost() <= first.XMost()) {
|
||||
firstDeviceRect.SetBottomEdge(deviceRect.Y());
|
||||
} else if (rect.X() >= first.X() && rect.XMost() <= first.XMost()) {
|
||||
// The bottom of the first contains the top of rect
|
||||
deviceRect.SetTopEdge(firstDeviceRect.YMost());
|
||||
}
|
||||
|
@ -1030,15 +1030,15 @@ nsRect nsRegion::GetLargestRectangle (const nsRect& aContainingRect) const {
|
|||
// Step 1: Calculate the grid lines
|
||||
for (auto iter = RectIter(); !iter.Done(); iter.Next()) {
|
||||
const nsRect& rect = iter.Get();
|
||||
xaxis.InsertCoord(rect.x);
|
||||
xaxis.InsertCoord(rect.X());
|
||||
xaxis.InsertCoord(rect.XMost());
|
||||
yaxis.InsertCoord(rect.y);
|
||||
yaxis.InsertCoord(rect.Y());
|
||||
yaxis.InsertCoord(rect.YMost());
|
||||
}
|
||||
if (!aContainingRect.IsEmpty()) {
|
||||
xaxis.InsertCoord(aContainingRect.x);
|
||||
xaxis.InsertCoord(aContainingRect.X());
|
||||
xaxis.InsertCoord(aContainingRect.XMost());
|
||||
yaxis.InsertCoord(aContainingRect.y);
|
||||
yaxis.InsertCoord(aContainingRect.Y());
|
||||
yaxis.InsertCoord(aContainingRect.YMost());
|
||||
}
|
||||
|
||||
|
@ -1053,9 +1053,9 @@ nsRect nsRegion::GetLargestRectangle (const nsRect& aContainingRect) const {
|
|||
|
||||
for (auto iter = RectIter(); !iter.Done(); iter.Next()) {
|
||||
const nsRect& rect = iter.Get();
|
||||
int32_t xstart = xaxis.IndexOf(rect.x);
|
||||
int32_t xstart = xaxis.IndexOf(rect.X());
|
||||
int32_t xend = xaxis.IndexOf(rect.XMost());
|
||||
int32_t y = yaxis.IndexOf(rect.y);
|
||||
int32_t y = yaxis.IndexOf(rect.Y());
|
||||
int32_t yend = yaxis.IndexOf(rect.YMost());
|
||||
|
||||
for (; y < yend; y++) {
|
||||
|
@ -1119,8 +1119,8 @@ nsRect nsRegion::GetLargestRectangle (const nsRect& aContainingRect) const {
|
|||
|
||||
bestRect.MoveTo(xaxis.StopAt(bestRectIndices.left),
|
||||
yaxis.StopAt(bestRectIndices.top));
|
||||
bestRect.SizeTo(xaxis.StopAt(bestRectIndices.right) - bestRect.x,
|
||||
yaxis.StopAt(bestRectIndices.bottom) - bestRect.y);
|
||||
bestRect.SizeTo(xaxis.StopAt(bestRectIndices.right) - bestRect.X(),
|
||||
yaxis.StopAt(bestRectIndices.bottom) - bestRect.Y());
|
||||
}
|
||||
|
||||
return bestRect;
|
||||
|
|
|
@ -56,8 +56,8 @@ public:
|
|||
|
||||
nsRegion () { pixman_region32_init(&mImpl); }
|
||||
MOZ_IMPLICIT nsRegion (const nsRect& aRect) { pixman_region32_init_rect(&mImpl,
|
||||
aRect.x,
|
||||
aRect.y,
|
||||
aRect.X(),
|
||||
aRect.Y(),
|
||||
aRect.Width(),
|
||||
aRect.Height()); }
|
||||
explicit nsRegion (mozilla::gfx::ArrayView<pixman_box32_t> aRects)
|
||||
|
@ -121,7 +121,7 @@ public:
|
|||
}
|
||||
nsRegion& And(const nsRegion& aRegion, const nsRect& aRect)
|
||||
{
|
||||
pixman_region32_intersect_rect(&mImpl, aRegion.Impl(), aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
pixman_region32_intersect_rect(&mImpl, aRegion.Impl(), aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
return *this;
|
||||
}
|
||||
nsRegion& And(const nsRect& aRect1, const nsRect& aRect2)
|
||||
|
@ -147,7 +147,7 @@ public:
|
|||
}
|
||||
nsRegion& Or(const nsRegion& aRegion, const nsRect& aRect)
|
||||
{
|
||||
pixman_region32_union_rect(&mImpl, aRegion.Impl(), aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
pixman_region32_union_rect(&mImpl, aRegion.Impl(), aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
return *this;
|
||||
}
|
||||
nsRegion& Or(const nsRect& aRect, const nsRegion& aRegion)
|
||||
|
@ -794,11 +794,11 @@ private:
|
|||
|
||||
static nsRect ToRect(const Rect& aRect)
|
||||
{
|
||||
return nsRect (aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
return nsRect (aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
}
|
||||
static Rect FromRect(const nsRect& aRect)
|
||||
{
|
||||
return Rect (aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
return Rect (aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
}
|
||||
|
||||
Derived& This()
|
||||
|
|
|
@ -101,10 +101,7 @@ NS_IMETHODIMP nsScriptableRegion::IsEqualRegion(nsIScriptableRegion *aRegion, bo
|
|||
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();
|
||||
boundRect.GetRect(aX, aY, aWidth, aHeight);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -146,8 +143,8 @@ NS_IMETHODIMP nsScriptableRegion::GetRects(JSContext* aCx, JS::MutableHandle<JS:
|
|||
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) ||
|
||||
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)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -28,10 +28,10 @@ struct RoundedRect {
|
|||
|
||||
void Deflate(gfxFloat aTopWidth, gfxFloat aBottomWidth, gfxFloat aLeftWidth, gfxFloat aRightWidth) {
|
||||
// deflate the internal rect
|
||||
rect.x += aLeftWidth;
|
||||
rect.y += aTopWidth;
|
||||
rect.SetWidth(std::max(0., rect.Width() - aLeftWidth - aRightWidth));
|
||||
rect.SetHeight(std::max(0., rect.Height() - aTopWidth - aBottomWidth));
|
||||
rect.SetRect(rect.X() + aLeftWidth,
|
||||
rect.Y() + aTopWidth,
|
||||
std::max(0., rect.Width() - aLeftWidth - aRightWidth),
|
||||
std::max(0., rect.Height() - aTopWidth - aBottomWidth));
|
||||
|
||||
corners.radii[mozilla::eCornerTopLeft].width =
|
||||
std::max(0., corners.radii[mozilla::eCornerTopLeft].width - aLeftWidth);
|
||||
|
|
|
@ -20,13 +20,13 @@ namespace gfx {
|
|||
|
||||
inline Rect ToRect(const gfxRect &aRect)
|
||||
{
|
||||
return Rect(Float(aRect.x), Float(aRect.y),
|
||||
return Rect(Float(aRect.X()), Float(aRect.Y()),
|
||||
Float(aRect.Width()), Float(aRect.Height()));
|
||||
}
|
||||
|
||||
inline RectDouble ToRectDouble(const gfxRect &aRect)
|
||||
{
|
||||
return RectDouble(aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
return RectDouble(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
}
|
||||
|
||||
inline Matrix ToMatrix(const gfxMatrix &aMatrix)
|
||||
|
@ -63,17 +63,17 @@ inline gfxSize ThebesSize(const Size &aSize)
|
|||
|
||||
inline gfxRect ThebesRect(const Rect &aRect)
|
||||
{
|
||||
return gfxRect(aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
return gfxRect(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
}
|
||||
|
||||
inline gfxRect ThebesRect(const IntRect &aRect)
|
||||
{
|
||||
return gfxRect(aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
return gfxRect(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
}
|
||||
|
||||
inline gfxRect ThebesRect(const RectDouble &aRect)
|
||||
{
|
||||
return gfxRect(aRect.x, aRect.y, aRect.Width(), aRect.Height());
|
||||
return gfxRect(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
|
||||
}
|
||||
|
||||
inline gfxImageFormat SurfaceFormatToImageFormat(SurfaceFormat aFormat)
|
||||
|
|
|
@ -194,7 +194,7 @@ gfxAlphaRecovery::AlignRectForSubimageRecovery(const mozilla::gfx::IntRect& aRec
|
|||
return aRect;
|
||||
}
|
||||
|
||||
const int32_t x = aRect.x, y = aRect.y, w = aRect.width, h = aRect.height;
|
||||
const int32_t x = aRect.X(), y = aRect.Y(), w = aRect.Width(), h = aRect.Height();
|
||||
const int32_t r = x + w;
|
||||
const int32_t sw = surfaceSize.width;
|
||||
const int32_t strideAlign = ByteAlignment(kByteAlignLog2, stride);
|
||||
|
|
|
@ -527,7 +527,7 @@ CreateBoxShadow(DrawTarget* aDestDrawTarget,
|
|||
// Use ceil to preserve the remaining 1x1 middle area for minimized box
|
||||
// shadows.
|
||||
if (aMirrorCorners) {
|
||||
blurRect.SizeTo(ceil(blurRect.width * 0.5f), ceil(blurRect.height * 0.5f));
|
||||
blurRect.SizeTo(ceil(blurRect.Width() * 0.5f), ceil(blurRect.Height() * 0.5f));
|
||||
}
|
||||
IntSize zeroSpread(0, 0);
|
||||
RefPtr<DrawTarget> blurDT =
|
||||
|
@ -767,8 +767,8 @@ DrawMirroredRect(DrawTarget* aDT,
|
|||
Matrix::Scaling(aScaleX, aScaleY)
|
||||
.PreTranslate(-aSrc)
|
||||
.PostTranslate(
|
||||
aScaleX < 0 ? aDest.XMost() : aDest.x,
|
||||
aScaleY < 0 ? aDest.YMost() : aDest.y));
|
||||
aScaleX < 0 ? aDest.XMost() : aDest.X(),
|
||||
aScaleY < 0 ? aDest.YMost() : aDest.Y()));
|
||||
aDT->FillRect(aDest, pattern);
|
||||
}
|
||||
|
||||
|
@ -777,14 +777,14 @@ DrawMirroredBoxShadow(DrawTarget* aDT,
|
|||
SourceSurface* aSurface,
|
||||
const Rect& aDestRect)
|
||||
{
|
||||
Point center(ceil(aDestRect.x + aDestRect.width / 2),
|
||||
ceil(aDestRect.y + aDestRect.height / 2));
|
||||
Rect topLeft(aDestRect.x, aDestRect.y,
|
||||
center.x - aDestRect.x,
|
||||
center.y - aDestRect.y);
|
||||
Point center(ceil(aDestRect.X() + aDestRect.Width() / 2),
|
||||
ceil(aDestRect.Y() + aDestRect.Height() / 2));
|
||||
Rect topLeft(aDestRect.X(), aDestRect.Y(),
|
||||
center.x - aDestRect.X(),
|
||||
center.y - aDestRect.Y());
|
||||
Rect bottomRight(topLeft.BottomRight(), aDestRect.Size() - topLeft.Size());
|
||||
Rect topRight(bottomRight.x, topLeft.y, bottomRight.width, topLeft.height);
|
||||
Rect bottomLeft(topLeft.x, bottomRight.y, topLeft.width, bottomRight.height);
|
||||
Rect topRight(bottomRight.X(), topLeft.Y(), bottomRight.Width(), topLeft.Height());
|
||||
Rect bottomLeft(topLeft.X(), bottomRight.Y(), topLeft.Width(), bottomRight.Height());
|
||||
DrawMirroredRect(aDT, aSurface, topLeft, Point(), 1, 1);
|
||||
DrawMirroredRect(aDT, aSurface, topRight, Point(), -1, 1);
|
||||
DrawMirroredRect(aDT, aSurface, bottomLeft, Point(), 1, -1);
|
||||
|
@ -813,8 +813,8 @@ RepeatOrStretchMirroredSurface(DrawTarget* aDT, SourceSurface* aSurface,
|
|||
}
|
||||
|
||||
if (ShouldStretchSurface(aDT, aSurface)) {
|
||||
aScaleX *= aDest.width / aSrc.width;
|
||||
aScaleY *= aDest.height / aSrc.height;
|
||||
aScaleX *= aDest.Width() / aSrc.Width();
|
||||
aScaleY *= aDest.Height() / aSrc.Height();
|
||||
DrawMirroredRect(aDT, aSurface, aDest, aSrc.TopLeft(), aScaleX, aScaleY);
|
||||
return;
|
||||
}
|
||||
|
@ -823,8 +823,8 @@ RepeatOrStretchMirroredSurface(DrawTarget* aDT, SourceSurface* aSurface,
|
|||
Matrix::Scaling(aScaleX, aScaleY)
|
||||
.PreTranslate(-aSrc.TopLeft())
|
||||
.PostTranslate(
|
||||
aScaleX < 0 ? aDest.XMost() : aDest.x,
|
||||
aScaleY < 0 ? aDest.YMost() : aDest.y),
|
||||
aScaleX < 0 ? aDest.XMost() : aDest.X(),
|
||||
aScaleY < 0 ? aDest.YMost() : aDest.Y()),
|
||||
SamplingFilter::GOOD, RoundedToInt(aSrc));
|
||||
aDT->FillRect(aDest, pattern);
|
||||
}
|
||||
|
@ -838,26 +838,26 @@ DrawMirroredMinBoxShadow(DrawTarget* aDestDrawTarget, SourceSurface* aSourceBlur
|
|||
// Corners: top left, top right, bottom left, bottom right
|
||||
// Compute quadrant bounds and then clip them to corners along
|
||||
// dimensions where we need to stretch from min size.
|
||||
Point center(ceil(aDstOuter.x + aDstOuter.width / 2),
|
||||
ceil(aDstOuter.y + aDstOuter.height / 2));
|
||||
Rect topLeft(aDstOuter.x, aDstOuter.y,
|
||||
center.x - aDstOuter.x,
|
||||
center.y - aDstOuter.y);
|
||||
Point center(ceil(aDstOuter.X() + aDstOuter.Width() / 2),
|
||||
ceil(aDstOuter.Y() + aDstOuter.Height() / 2));
|
||||
Rect topLeft(aDstOuter.X(), aDstOuter.Y(),
|
||||
center.x - aDstOuter.X(),
|
||||
center.y - aDstOuter.Y());
|
||||
Rect bottomRight(topLeft.BottomRight(), aDstOuter.Size() - topLeft.Size());
|
||||
Rect topRight(bottomRight.x, topLeft.y, bottomRight.width, topLeft.height);
|
||||
Rect bottomLeft(topLeft.x, bottomRight.y, topLeft.width, bottomRight.height);
|
||||
Rect topRight(bottomRight.X(), topLeft.Y(), bottomRight.Width(), topLeft.Height());
|
||||
Rect bottomLeft(topLeft.X(), bottomRight.Y(), topLeft.Width(), bottomRight.Height());
|
||||
|
||||
// Check if the middle part has been minimized along each dimension.
|
||||
// If so, those will be strecthed/drawn separately and need to be clipped out.
|
||||
if (aSrcInner.width == 1) {
|
||||
topLeft.SetRightEdge(aDstInner.x);
|
||||
if (aSrcInner.Width() == 1) {
|
||||
topLeft.SetRightEdge(aDstInner.X());
|
||||
topRight.SetLeftEdge(aDstInner.XMost());
|
||||
bottomLeft.SetRightEdge(aDstInner.x);
|
||||
bottomLeft.SetRightEdge(aDstInner.X());
|
||||
bottomRight.SetLeftEdge(aDstInner.XMost());
|
||||
}
|
||||
if (aSrcInner.height == 1) {
|
||||
topLeft.SetBottomEdge(aDstInner.y);
|
||||
topRight.SetBottomEdge(aDstInner.y);
|
||||
if (aSrcInner.Height() == 1) {
|
||||
topLeft.SetBottomEdge(aDstInner.Y());
|
||||
topRight.SetBottomEdge(aDstInner.Y());
|
||||
bottomLeft.SetTopEdge(aDstInner.YMost());
|
||||
bottomRight.SetTopEdge(aDstInner.YMost());
|
||||
}
|
||||
|
@ -875,7 +875,7 @@ DrawMirroredMinBoxShadow(DrawTarget* aDestDrawTarget, SourceSurface* aSourceBlur
|
|||
// Draw middle edges where they need to be stretched. The top and left
|
||||
// sections that are part of the top-left quadrant will be mirrored to
|
||||
// the bottom and right sections, respectively.
|
||||
if (aSrcInner.width == 1) {
|
||||
if (aSrcInner.Width() == 1) {
|
||||
Rect dstTop = RectWithEdgesTRBL(aDstOuter.Y(), aDstInner.XMost(),
|
||||
aDstInner.Y(), aDstInner.X());
|
||||
Rect srcTop = RectWithEdgesTRBL(aSrcOuter.Y(), aSrcInner.XMost(),
|
||||
|
@ -887,11 +887,11 @@ DrawMirroredMinBoxShadow(DrawTarget* aDestDrawTarget, SourceSurface* aSourceBlur
|
|||
// If we only need to stretch along the X axis and we're drawing
|
||||
// the middle section, just sample all the way to the center of the
|
||||
// source on the Y axis to avoid extra draw calls.
|
||||
if (aMiddle && aSrcInner.height != 1) {
|
||||
if (aMiddle && aSrcInner.Height() != 1) {
|
||||
dstTop.SetBottomEdge(center.y);
|
||||
srcTop.height = dstTop.height;
|
||||
srcTop.SetHeight(dstTop.Height());
|
||||
dstBottom.SetTopEdge(dstTop.YMost());
|
||||
srcBottom.height = dstBottom.height;
|
||||
srcBottom.SetHeight(dstBottom.Height());
|
||||
}
|
||||
RepeatOrStretchMirroredSurface(aDestDrawTarget, aSourceBlur,
|
||||
dstTop, srcTop, aSkipRect, 1, 1);
|
||||
|
@ -899,7 +899,7 @@ DrawMirroredMinBoxShadow(DrawTarget* aDestDrawTarget, SourceSurface* aSourceBlur
|
|||
dstBottom, srcBottom, aSkipRect, 1, -1);
|
||||
}
|
||||
|
||||
if (aSrcInner.height == 1) {
|
||||
if (aSrcInner.Height() == 1) {
|
||||
Rect dstLeft = RectWithEdgesTRBL(aDstInner.Y(), aDstInner.X(),
|
||||
aDstInner.YMost(), aDstOuter.X());
|
||||
Rect srcLeft = RectWithEdgesTRBL(aSrcInner.Y(), aSrcInner.X(),
|
||||
|
@ -909,11 +909,11 @@ DrawMirroredMinBoxShadow(DrawTarget* aDestDrawTarget, SourceSurface* aSourceBlur
|
|||
Rect srcRight = RectWithEdgesTRBL(aSrcInner.Y(), aSrcInner.X(),
|
||||
aSrcInner.YMost(), aSrcOuter.X());
|
||||
// Only stretching on Y axis, so sample source to the center of the X axis.
|
||||
if (aMiddle && aSrcInner.width != 1) {
|
||||
if (aMiddle && aSrcInner.Width() != 1) {
|
||||
dstLeft.SetRightEdge(center.x);
|
||||
srcLeft.width = dstLeft.width;
|
||||
srcLeft.SetWidth(dstLeft.Width());
|
||||
dstRight.SetLeftEdge(dstLeft.XMost());
|
||||
srcRight.width = dstRight.width;
|
||||
srcRight.SetWidth(dstRight.Width());
|
||||
}
|
||||
RepeatOrStretchMirroredSurface(aDestDrawTarget, aSourceBlur,
|
||||
dstLeft, srcLeft, aSkipRect, 1, 1);
|
||||
|
@ -923,7 +923,7 @@ DrawMirroredMinBoxShadow(DrawTarget* aDestDrawTarget, SourceSurface* aSourceBlur
|
|||
|
||||
// If we need to stretch along both dimensions, then the middle part
|
||||
// must be drawn separately.
|
||||
if (aMiddle && aSrcInner.width == 1 && aSrcInner.height == 1) {
|
||||
if (aMiddle && aSrcInner.Width() == 1 && aSrcInner.Height() == 1) {
|
||||
RepeatOrStretchSurface(aDestDrawTarget, aSourceBlur,
|
||||
RectWithEdgesTRBL(aDstInner.Y(), aDstInner.XMost(),
|
||||
aDstInner.YMost(), aDstInner.X()),
|
||||
|
@ -1127,7 +1127,7 @@ gfxAlphaBoxBlur::GetInsetBlur(const Rect& aOuterRect,
|
|||
// Use ceil to preserve the remaining 1x1 middle area for minimized box
|
||||
// shadows.
|
||||
if (aMirrorCorners) {
|
||||
blurRect.SizeTo(ceil(blurRect.width * 0.5f), ceil(blurRect.height * 0.5f));
|
||||
blurRect.SizeTo(ceil(blurRect.Width() * 0.5f), ceil(blurRect.Height() * 0.5f));
|
||||
}
|
||||
IntSize zeroSpread(0, 0);
|
||||
RefPtr<DrawTarget> minDrawTarget =
|
||||
|
@ -1244,8 +1244,8 @@ GetInsetBoxShadowRects(const Margin& aBlurMargin,
|
|||
// If the inner white space rect is larger than the shadow clip rect
|
||||
// our approach does not work as we'll just copy one corner
|
||||
// and cover the destination. In those cases, fallback to the destination rect
|
||||
bool useDestRect = (aShadowClipRect.width <= aInnerMargin.LeftRight()) ||
|
||||
(aShadowClipRect.height <= aInnerMargin.TopBottom());
|
||||
bool useDestRect = (aShadowClipRect.Width() <= aInnerMargin.LeftRight()) ||
|
||||
(aShadowClipRect.Height() <= aInnerMargin.TopBottom());
|
||||
|
||||
if (useDestRect) {
|
||||
aOutWhitespaceRect = aShadowClipRect;
|
||||
|
|
|
@ -603,7 +603,7 @@ gfxContext::GetClipExtents(ClipExtentsSpace aSpace) const
|
|||
{
|
||||
Rect rect = GetAzureDeviceSpaceClipBounds();
|
||||
|
||||
if (rect.width == 0 || rect.height == 0) {
|
||||
if (rect.IsZero()) {
|
||||
return gfxRect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -768,7 +768,7 @@ gfxContext::PushGroupAndCopyBackground(gfxContentType content, Float aOpacity, S
|
|||
if (mDT->GetFormat() != SurfaceFormat::B8G8R8X8) {
|
||||
gfxRect clipRect = GetClipExtents(gfxContext::eDeviceSpace);
|
||||
clipRect.RoundOut();
|
||||
clipExtents = IntRect::Truncate(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
|
||||
clipExtents = IntRect::Truncate(clipRect.X(), clipRect.Y(), clipRect.Width(), clipRect.Height());
|
||||
}
|
||||
bool pushOpaqueWithCopiedBG = (mDT->GetFormat() == SurfaceFormat::B8G8R8X8 ||
|
||||
mDT->GetOpaqueRect().Contains(clipExtents)) &&
|
||||
|
|
|
@ -561,9 +561,9 @@ gfxDWriteFont::Measure(const gfxTextRun* aTextRun,
|
|||
if (aBoundingBoxType == LOOSE_INK_EXTENTS &&
|
||||
mAntialiasOption != kAntialiasNone &&
|
||||
GetMeasuringMode() == DWRITE_MEASURING_MODE_GDI_CLASSIC &&
|
||||
metrics.mBoundingBox.width > 0) {
|
||||
metrics.mBoundingBox.x -= aTextRun->GetAppUnitsPerDevUnit();
|
||||
metrics.mBoundingBox.width += aTextRun->GetAppUnitsPerDevUnit() * 3;
|
||||
metrics.mBoundingBox.Width() > 0) {
|
||||
metrics.mBoundingBox.MoveByX(-aTextRun->GetAppUnitsPerDevUnit());
|
||||
metrics.mBoundingBox.SetWidth(metrics.mBoundingBox.Width() + aTextRun->GetAppUnitsPerDevUnit() * 3);
|
||||
}
|
||||
|
||||
return metrics;
|
||||
|
|
|
@ -45,8 +45,8 @@ gfxSurfaceDrawable::DrawWithSamplingRect(DrawTarget* aDrawTarget,
|
|||
|
||||
// When drawing with CLAMP we can expand the sampling rect to the nearest pixel
|
||||
// without changing the result.
|
||||
IntRect intRect = IntRect::RoundOut(aSamplingRect.x, aSamplingRect.y,
|
||||
aSamplingRect.width, aSamplingRect.height);
|
||||
IntRect intRect = IntRect::RoundOut(aSamplingRect.X(), aSamplingRect.Y(),
|
||||
aSamplingRect.Width(), aSamplingRect.Height());
|
||||
|
||||
IntSize size = mSourceSurface->GetSize();
|
||||
if (!IntRect(IntPoint(), size).Contains(intRect)) {
|
||||
|
|
|
@ -2493,9 +2493,9 @@ gfxFont::Measure(const gfxTextRun *aTextRun,
|
|||
advance, metrics.mBoundingBox.Height());
|
||||
}
|
||||
if (isRTL) {
|
||||
glyphRect.x -= advance;
|
||||
glyphRect.MoveByX(-advance);
|
||||
}
|
||||
glyphRect.x += x;
|
||||
glyphRect.MoveByX(x);
|
||||
metrics.mBoundingBox = metrics.mBoundingBox.Union(glyphRect);
|
||||
}
|
||||
}
|
||||
|
@ -2522,10 +2522,10 @@ gfxFont::Measure(const gfxTextRun *aTextRun,
|
|||
advance, metrics.mAscent + metrics.mDescent);
|
||||
}
|
||||
if (isRTL) {
|
||||
glyphRect.x -= advance;
|
||||
glyphRect.MoveByX(-advance);
|
||||
}
|
||||
glyphRect.x += x + details->mOffset.x;
|
||||
glyphRect.y += details->mOffset.y;
|
||||
glyphRect.MoveByX(x + details->mOffset.x);
|
||||
glyphRect.MoveByY(details->mOffset.y);
|
||||
metrics.mBoundingBox = metrics.mBoundingBox.Union(glyphRect);
|
||||
x += direction*advance;
|
||||
}
|
||||
|
@ -2564,15 +2564,15 @@ gfxFont::Measure(const gfxTextRun *aTextRun,
|
|||
gfxFloat extendLeftEdge =
|
||||
ceil(OBLIQUE_SKEW_FACTOR * metrics.mBoundingBox.YMost());
|
||||
gfxFloat extendRightEdge =
|
||||
ceil(OBLIQUE_SKEW_FACTOR * -metrics.mBoundingBox.y);
|
||||
metrics.mBoundingBox.width += extendLeftEdge + extendRightEdge;
|
||||
metrics.mBoundingBox.x -= extendLeftEdge;
|
||||
ceil(OBLIQUE_SKEW_FACTOR * -metrics.mBoundingBox.Y());
|
||||
metrics.mBoundingBox.SetWidth(metrics.mBoundingBox.Width() + extendLeftEdge + extendRightEdge);
|
||||
metrics.mBoundingBox.MoveByX(-extendLeftEdge);
|
||||
}
|
||||
|
||||
if (baselineOffset != 0) {
|
||||
metrics.mAscent -= baselineOffset;
|
||||
metrics.mDescent += baselineOffset;
|
||||
metrics.mBoundingBox.y += baselineOffset;
|
||||
metrics.mBoundingBox.MoveByY(baselineOffset);
|
||||
}
|
||||
|
||||
metrics.mAdvanceWidth = x*direction;
|
||||
|
@ -3476,10 +3476,10 @@ gfxFont::SetupGlyphExtents(DrawTarget* aDrawTarget, uint32_t aGlyphID,
|
|||
GetAdjustedSize(), &svgBounds)) {
|
||||
gfxFloat d2a = aExtents->GetAppUnitsPerDevUnit();
|
||||
aExtents->SetTightGlyphExtents(aGlyphID,
|
||||
gfxRect(svgBounds.x * d2a,
|
||||
svgBounds.y * d2a,
|
||||
svgBounds.width * d2a,
|
||||
svgBounds.height * d2a));
|
||||
gfxRect(svgBounds.X() * d2a,
|
||||
svgBounds.Y() * d2a,
|
||||
svgBounds.Width() * d2a,
|
||||
svgBounds.Height() * d2a));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -176,9 +176,9 @@ gfxGDIFont::Measure(const gfxTextRun *aTextRun,
|
|||
// (see bugs 475968, 439831, compare also bug 445087)
|
||||
if (aBoundingBoxType == LOOSE_INK_EXTENTS &&
|
||||
mAntialiasOption != kAntialiasNone &&
|
||||
metrics.mBoundingBox.width > 0) {
|
||||
metrics.mBoundingBox.x -= aTextRun->GetAppUnitsPerDevUnit();
|
||||
metrics.mBoundingBox.width += aTextRun->GetAppUnitsPerDevUnit() * 3;
|
||||
metrics.mBoundingBox.Width() > 0) {
|
||||
metrics.mBoundingBox.MoveByX(-aTextRun->GetAppUnitsPerDevUnit());
|
||||
metrics.mBoundingBox.SetWidth(metrics.mBoundingBox.Width() + aTextRun->GetAppUnitsPerDevUnit() * 3);
|
||||
}
|
||||
|
||||
return metrics;
|
||||
|
|
|
@ -162,7 +162,7 @@ gfxSVGGlyphsDocument::SetupPresentation()
|
|||
|
||||
if (!presShell->DidInitialize()) {
|
||||
nsRect rect = presContext->GetVisibleArea();
|
||||
rv = presShell->Initialize(rect.width, rect.height);
|
||||
rv = presShell->Initialize(rect.Width(), rect.Height());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
|
|
@ -812,14 +812,11 @@ gfxTextRun::AccumulatePartialLigatureMetrics(gfxFont *aFont, Range aRange,
|
|||
// Where we are going to start "drawing" relative to our left baseline origin
|
||||
gfxFloat origin = IsRightToLeft() ? metrics.mAdvanceWidth - data.mPartAdvance : 0;
|
||||
ClipPartialLigature(this, &bboxLeft, &bboxRight, origin, &data);
|
||||
metrics.mBoundingBox.x = bboxLeft;
|
||||
metrics.mBoundingBox.width = bboxRight - bboxLeft;
|
||||
metrics.mBoundingBox.SetBoxX(bboxLeft, bboxRight);
|
||||
|
||||
// mBoundingBox is now relative to the left baseline origin for the entire
|
||||
// ligature. Shift it left.
|
||||
metrics.mBoundingBox.x -=
|
||||
IsRightToLeft() ? metrics.mAdvanceWidth - (data.mPartAdvance + data.mPartWidth)
|
||||
: data.mPartAdvance;
|
||||
metrics.mBoundingBox.MoveByX(-(IsRightToLeft() ? metrics.mAdvanceWidth - (data.mPartAdvance + data.mPartWidth) : data.mPartAdvance));
|
||||
metrics.mAdvanceWidth = data.mPartWidth;
|
||||
|
||||
aMetrics->CombineWith(metrics, IsRightToLeft());
|
||||
|
|
|
@ -607,7 +607,7 @@ gfxUtils::ClipToRegion(gfxContext* aContext, const nsIntRegion& aRegion)
|
|||
aContext->NewPath();
|
||||
for (auto iter = aRegion.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const IntRect& r = iter.Get();
|
||||
aContext->Rectangle(gfxRect(r.x, r.y, r.width, r.height));
|
||||
aContext->Rectangle(gfxRect(r.X(), r.Y(), r.Width(), r.Height()));
|
||||
}
|
||||
aContext->Clip();
|
||||
}
|
||||
|
@ -706,18 +706,18 @@ gfxUtils::TransformRectToRect(const gfxRect& aFrom, const gfxPoint& aToTopLeft,
|
|||
if (aToTopRight.y == aToTopLeft.y && aToTopRight.x == aToBottomRight.x) {
|
||||
// Not a rotation, so xy and yx are zero
|
||||
m._21 = m._12 = 0.0;
|
||||
m._11 = (aToBottomRight.x - aToTopLeft.x)/aFrom.width;
|
||||
m._22 = (aToBottomRight.y - aToTopLeft.y)/aFrom.height;
|
||||
m._31 = aToTopLeft.x - m._11*aFrom.x;
|
||||
m._32 = aToTopLeft.y - m._22*aFrom.y;
|
||||
m._11 = (aToBottomRight.x - aToTopLeft.x)/aFrom.Width();
|
||||
m._22 = (aToBottomRight.y - aToTopLeft.y)/aFrom.Height();
|
||||
m._31 = aToTopLeft.x - m._11*aFrom.X();
|
||||
m._32 = aToTopLeft.y - m._22*aFrom.Y();
|
||||
} else {
|
||||
NS_ASSERTION(aToTopRight.y == aToBottomRight.y && aToTopRight.x == aToTopLeft.x,
|
||||
"Destination rectangle not axis-aligned");
|
||||
m._11 = m._22 = 0.0;
|
||||
m._21 = (aToBottomRight.x - aToTopLeft.x)/aFrom.height;
|
||||
m._12 = (aToBottomRight.y - aToTopLeft.y)/aFrom.width;
|
||||
m._31 = aToTopLeft.x - m._21*aFrom.y;
|
||||
m._32 = aToTopLeft.y - m._12*aFrom.x;
|
||||
m._21 = (aToBottomRight.x - aToTopLeft.x)/aFrom.Height();
|
||||
m._12 = (aToBottomRight.y - aToTopLeft.y)/aFrom.Width();
|
||||
m._31 = aToTopLeft.x - m._21*aFrom.Y();
|
||||
m._32 = aToTopLeft.y - m._12*aFrom.X();
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
@ -730,18 +730,18 @@ gfxUtils::TransformRectToRect(const gfxRect& aFrom, const IntPoint& aToTopLeft,
|
|||
if (aToTopRight.y == aToTopLeft.y && aToTopRight.x == aToBottomRight.x) {
|
||||
// Not a rotation, so xy and yx are zero
|
||||
m._12 = m._21 = 0.0;
|
||||
m._11 = (aToBottomRight.x - aToTopLeft.x)/aFrom.width;
|
||||
m._22 = (aToBottomRight.y - aToTopLeft.y)/aFrom.height;
|
||||
m._31 = aToTopLeft.x - m._11*aFrom.x;
|
||||
m._32 = aToTopLeft.y - m._22*aFrom.y;
|
||||
m._11 = (aToBottomRight.x - aToTopLeft.x)/aFrom.Width();
|
||||
m._22 = (aToBottomRight.y - aToTopLeft.y)/aFrom.Height();
|
||||
m._31 = aToTopLeft.x - m._11*aFrom.X();
|
||||
m._32 = aToTopLeft.y - m._22*aFrom.Y();
|
||||
} else {
|
||||
NS_ASSERTION(aToTopRight.y == aToBottomRight.y && aToTopRight.x == aToTopLeft.x,
|
||||
"Destination rectangle not axis-aligned");
|
||||
m._11 = m._22 = 0.0;
|
||||
m._21 = (aToBottomRight.x - aToTopLeft.x)/aFrom.height;
|
||||
m._12 = (aToBottomRight.y - aToTopLeft.y)/aFrom.width;
|
||||
m._31 = aToTopLeft.x - m._21*aFrom.y;
|
||||
m._32 = aToTopLeft.y - m._12*aFrom.x;
|
||||
m._21 = (aToBottomRight.x - aToTopLeft.x)/aFrom.Height();
|
||||
m._12 = (aToBottomRight.y - aToTopLeft.y)/aFrom.Width();
|
||||
m._31 = aToTopLeft.x - m._21*aFrom.Y();
|
||||
m._32 = aToTopLeft.y - m._12*aFrom.X();
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
@ -754,7 +754,7 @@ gfxUtils::GfxRectToIntRect(const gfxRect& aIn, IntRect* aOut)
|
|||
{
|
||||
*aOut = IntRect(int32_t(aIn.X()), int32_t(aIn.Y()),
|
||||
int32_t(aIn.Width()), int32_t(aIn.Height()));
|
||||
return gfxRect(aOut->x, aOut->y, aOut->width, aOut->height).IsEqualEdges(aIn);
|
||||
return gfxRect(aOut->X(), aOut->Y(), aOut->Width(), aOut->Height()).IsEqualEdges(aIn);
|
||||
}
|
||||
|
||||
/* Clamp r to CAIRO_COORD_MIN .. CAIRO_COORD_MAX
|
||||
|
@ -770,38 +770,36 @@ gfxUtils::ConditionRect(gfxRect& aRect)
|
|||
#define CAIRO_COORD_MIN (-16777216.0)
|
||||
// if either x or y is way out of bounds;
|
||||
// note that we don't handle negative w/h here
|
||||
if (aRect.x > CAIRO_COORD_MAX) {
|
||||
aRect.x = CAIRO_COORD_MAX;
|
||||
aRect.width = 0.0;
|
||||
if (aRect.X() > CAIRO_COORD_MAX) {
|
||||
aRect.SetRectX(CAIRO_COORD_MAX, 0.0);
|
||||
}
|
||||
|
||||
if (aRect.y > CAIRO_COORD_MAX) {
|
||||
aRect.y = CAIRO_COORD_MAX;
|
||||
aRect.height = 0.0;
|
||||
if (aRect.Y() > CAIRO_COORD_MAX) {
|
||||
aRect.SetRectY(CAIRO_COORD_MAX, 0.0);
|
||||
}
|
||||
|
||||
if (aRect.x < CAIRO_COORD_MIN) {
|
||||
aRect.width += aRect.x - CAIRO_COORD_MIN;
|
||||
if (aRect.width < 0.0) {
|
||||
aRect.width = 0.0;
|
||||
if (aRect.X() < CAIRO_COORD_MIN) {
|
||||
aRect.SetWidth(aRect.XMost() - CAIRO_COORD_MIN);
|
||||
if (aRect.Width() < 0.0) {
|
||||
aRect.SetWidth(0.0);
|
||||
}
|
||||
aRect.x = CAIRO_COORD_MIN;
|
||||
aRect.MoveToX(CAIRO_COORD_MIN);
|
||||
}
|
||||
|
||||
if (aRect.y < CAIRO_COORD_MIN) {
|
||||
aRect.height += aRect.y - CAIRO_COORD_MIN;
|
||||
if (aRect.height < 0.0) {
|
||||
aRect.height = 0.0;
|
||||
if (aRect.Y() < CAIRO_COORD_MIN) {
|
||||
aRect.SetHeight(aRect.YMost() - CAIRO_COORD_MIN);
|
||||
if (aRect.Height() < 0.0) {
|
||||
aRect.SetHeight(0.0);
|
||||
}
|
||||
aRect.y = CAIRO_COORD_MIN;
|
||||
aRect.MoveToY(CAIRO_COORD_MIN);
|
||||
}
|
||||
|
||||
if (aRect.x + aRect.width > CAIRO_COORD_MAX) {
|
||||
aRect.width = CAIRO_COORD_MAX - aRect.x;
|
||||
if (aRect.XMost() > CAIRO_COORD_MAX) {
|
||||
aRect.SetRightEdge(CAIRO_COORD_MAX);
|
||||
}
|
||||
|
||||
if (aRect.y + aRect.height > CAIRO_COORD_MAX) {
|
||||
aRect.height = CAIRO_COORD_MAX - aRect.y;
|
||||
if (aRect.YMost() > CAIRO_COORD_MAX) {
|
||||
aRect.SetBottomEdge(CAIRO_COORD_MAX);
|
||||
}
|
||||
#undef CAIRO_COORD_MAX
|
||||
#undef CAIRO_COORD_MIN
|
||||
|
@ -835,7 +833,7 @@ gfxUtils::TransformToQuad(const gfxRect& aRect,
|
|||
cairo_set_source_rgba(ctx, 0.0, 0.0, 0.0, 0.0);
|
||||
cairo_set_operator(ctx, CAIRO_OPERATOR_SOURCE);
|
||||
IntRect bounds(nsIntPoint(0, 0), aSurface->GetSize());
|
||||
cairo_rectangle(ctx, bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
cairo_rectangle(ctx, bounds.X(), bounds.Y(), bounds.Width(), bounds.Height());
|
||||
cairo_fill(ctx);
|
||||
cairo_destroy(ctx);
|
||||
}
|
||||
|
|
|
@ -58,10 +58,10 @@ VRDisplayPresentation::CreateLayers()
|
|||
|
||||
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.SetWidth(layer.mLeftBounds[2]);
|
||||
leftBounds.SetHeight(layer.mLeftBounds[3]);
|
||||
leftBounds.SetRect(layer.mLeftBounds[0],
|
||||
layer.mLeftBounds[1],
|
||||
layer.mLeftBounds[2],
|
||||
layer.mLeftBounds[3]);
|
||||
} else if (layer.mLeftBounds.Length() != 0) {
|
||||
/**
|
||||
* We ignore layers with an incorrect number of values.
|
||||
|
@ -73,10 +73,10 @@ VRDisplayPresentation::CreateLayers()
|
|||
|
||||
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.SetWidth(layer.mRightBounds[2]);
|
||||
rightBounds.SetHeight(layer.mRightBounds[3]);
|
||||
rightBounds.SetRect(layer.mRightBounds[0],
|
||||
layer.mRightBounds[1],
|
||||
layer.mRightBounds[2],
|
||||
layer.mRightBounds[3]);
|
||||
} else if (layer.mRightBounds.Length() != 0) {
|
||||
/**
|
||||
* We ignore layers with an incorrect number of values.
|
||||
|
|
|
@ -1245,12 +1245,12 @@ VRDisplayOculus::SubmitFrame(ID3D11Texture2D* aSource,
|
|||
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].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[1].Pos.x = aSize.width * aRightEyeRect.x;
|
||||
layer.Viewport[1].Pos.y = aSize.height * aRightEyeRect.y;
|
||||
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();
|
||||
|
||||
|
|
|
@ -364,10 +364,10 @@ VRDisplayOpenVR::SubmitFrame(void* aTextureHandle,
|
|||
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.uMin = aLeftEyeRect.X();
|
||||
bounds.vMin = 1.0 - aLeftEyeRect.Y();
|
||||
bounds.uMax = aLeftEyeRect.XMost();
|
||||
bounds.vMax = 1.0 - aLeftEyeRect.YMost();
|
||||
|
||||
::vr::EVRCompositorError err;
|
||||
err = mVRCompositor->Submit(::vr::EVREye::Eye_Left, &tex, &bounds);
|
||||
|
@ -375,10 +375,10 @@ VRDisplayOpenVR::SubmitFrame(void* aTextureHandle,
|
|||
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.uMin = aRightEyeRect.X();
|
||||
bounds.vMin = 1.0 - aRightEyeRect.Y();
|
||||
bounds.uMax = aRightEyeRect.XMost();
|
||||
bounds.vMax = 1.0 - aRightEyeRect.YMost();
|
||||
|
||||
err = mVRCompositor->Submit(::vr::EVREye::Eye_Right, &tex, &bounds);
|
||||
if (err != ::vr::EVRCompositorError::VRCompositorError_None) {
|
||||
|
@ -1255,4 +1255,4 @@ VRSystemManagerOpenVR::GetControllerDeviceId(::vr::ETrackedDeviceClass aDeviceTy
|
|||
MOZ_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -313,8 +313,8 @@ static inline wr::LayoutVector2D ToLayoutVector2D(const mozilla::LayoutDeviceInt
|
|||
static inline wr::LayoutRect ToLayoutRect(const mozilla::LayoutDeviceRect& rect)
|
||||
{
|
||||
wr::LayoutRect r;
|
||||
r.origin.x = rect.x;
|
||||
r.origin.y = rect.y;
|
||||
r.origin.x = rect.X();
|
||||
r.origin.y = rect.Y();
|
||||
r.size.width = rect.Width();
|
||||
r.size.height = rect.Height();
|
||||
return r;
|
||||
|
@ -323,8 +323,8 @@ static inline wr::LayoutRect ToLayoutRect(const mozilla::LayoutDeviceRect& rect)
|
|||
static inline wr::LayoutRect ToLayoutRect(const gfxRect& rect)
|
||||
{
|
||||
wr::LayoutRect r;
|
||||
r.origin.x = rect.x;
|
||||
r.origin.y = rect.y;
|
||||
r.origin.x = rect.X();
|
||||
r.origin.y = rect.Y();
|
||||
r.size.width = rect.Width();
|
||||
r.size.height = rect.Height();
|
||||
return r;
|
||||
|
@ -333,10 +333,10 @@ static inline wr::LayoutRect ToLayoutRect(const gfxRect& rect)
|
|||
static inline wr::DeviceUintRect ToDeviceUintRect(const mozilla::ImageIntRect& rect)
|
||||
{
|
||||
wr::DeviceUintRect r;
|
||||
r.origin.x = rect.x;
|
||||
r.origin.y = rect.y;
|
||||
r.size.width = rect.width;
|
||||
r.size.height = rect.height;
|
||||
r.origin.x = rect.X();
|
||||
r.origin.y = rect.Y();
|
||||
r.size.width = rect.Width();
|
||||
r.size.height = rect.Height();
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче