--- a/image/ClippedImage.cpp
+++ b/image/ClippedImage.cpp
@@ -454,17 +454,17 @@ ClippedImage::DrawSingleTile(gfxContext*
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags,
float aOpacity)
{
MOZ_ASSERT(!MustCreateSurface(aContext, aSize, aRegion, aFlags),
"Shouldn't need to create a surface");
- gfxRect clip(mClip.x, mClip.y, mClip.Width(), mClip.Height());
+ gfxRect clip(mClip.X(), mClip.Y(), mClip.Width(), mClip.Height());
nsIntSize size(aSize), innerSize(aSize);
bool needScale = false;
if (mSVGViewportSize && !mSVGViewportSize->IsEmpty()) {
innerSize = *mSVGViewportSize;
needScale = true;
} else if (NS_SUCCEEDED(InnerImage()->GetWidth(&innerSize.width)) &&
NS_SUCCEEDED(InnerImage()->GetHeight(&innerSize.height))) {
needScale = true;
@@ -481,21 +481,21 @@ ClippedImage::DrawSingleTile(gfxContext*
clip.Scale(scaleX, scaleY);
size = innerSize;
size.Scale(scaleX, scaleY);
}
// We restrict our drawing to only the clipping region, and translate so that
// the clipping region is placed at the position the caller expects.
ImageRegion region(aRegion);
- region.MoveBy(clip.x, clip.y);
+ region.MoveBy(clip.X(), clip.Y());
region = region.Intersect(clip);
gfxContextMatrixAutoSaveRestore saveMatrix(aContext);
- aContext->Multiply(gfxMatrix::Translation(-clip.x, -clip.y));
+ aContext->Multiply(gfxMatrix::Translation(-clip.X(), -clip.Y()));
auto unclipViewport = [&](const SVGImageContext& aOldContext) {
// Map the viewport to the inner image. Note that we don't take the aSize
// parameter of imgIContainer::Draw into account, just the clipping region.
// The size in pixels at which the output will ultimately be drawn is
// irrelevant here since the purpose of the SVG viewport size is to
// determine what *region* of the SVG document will be drawn.
SVGImageContext context(aOldContext);
@@ -596,14 +596,14 @@ NS_IMETHODIMP_(nsIntRect)
ClippedImage::GetImageSpaceInvalidationRect(const nsIntRect& aRect)
{
if (!ShouldClip()) {
return InnerImage()->GetImageSpaceInvalidationRect(aRect);
}
nsIntRect rect(InnerImage()->GetImageSpaceInvalidationRect(aRect));
rect = rect.Intersect(mClip);
- rect.MoveBy(-mClip.x, -mClip.y);
+ rect.MoveBy(-mClip.X(), -mClip.Y());
return rect;
}
} // namespace image
} // namespace mozilla
--- a/image/Downscaler.cpp
+++ b/image/Downscaler.cpp
@@ -73,17 +73,17 @@ Downscaler::BeginFrame(const nsIntSize&
// Only downscale from reasonable sizes to avoid using too much memory/cpu
// downscaling and decoding. 1 << 20 == 1,048,576 seems a reasonable limit.
if (aOriginalSize.width > (1 << 20) || aOriginalSize.height > (1 << 20)) {
NS_WARNING("Trying to downscale image frame that is too large");
return NS_ERROR_INVALID_ARG;
}
mFrameRect = aFrameRect.valueOr(nsIntRect(nsIntPoint(), aOriginalSize));
- MOZ_ASSERT(mFrameRect.x >= 0 && mFrameRect.y >= 0 &&
+ MOZ_ASSERT(mFrameRect.X() >= 0 && mFrameRect.Y() >= 0 &&
mFrameRect.Width() >= 0 && mFrameRect.Height() >= 0,
"Frame rect must have non-negative components");
MOZ_ASSERT(nsIntRect(0, 0, aOriginalSize.width, aOriginalSize.height)
.Contains(mFrameRect),
"Frame rect must fit inside image");
MOZ_ASSERT_IF(!nsIntRect(0, 0, aOriginalSize.width, aOriginalSize.height)
.IsEqualEdges(mFrameRect),
aHasAlpha);
@@ -163,17 +163,17 @@ Downscaler::ResetForNextProgressivePass(
mCurrentInLine = 0;
mLinesInBuffer = 0;
if (mFrameRect.IsEmpty()) {
// Our frame rect is zero size; commit rows until the end of the image.
SkipToRow(mOriginalSize.height - 1);
} else {
// If we have a vertical offset, commit rows to shift us past it.
- SkipToRow(mFrameRect.y);
+ SkipToRow(mFrameRect.Y());
}
}
void
Downscaler::ClearRestOfRow(uint32_t aStartingAtCol)
{
MOZ_ASSERT(int64_t(aStartingAtCol) <= int64_t(mOriginalSize.width));
uint32_t bytesToClear = (mOriginalSize.width - aStartingAtCol)
@@ -214,17 +214,17 @@ Downscaler::CommitRow()
&filterOffset, &filterLength);
}
}
mCurrentInLine += 1;
// If we're at the end of the part of the original image that has data, commit
// rows to shift us to the end.
- if (mCurrentInLine == (mFrameRect.y + mFrameRect.Height())) {
+ if (mCurrentInLine == (mFrameRect.Y() + mFrameRect.Height())) {
SkipToRow(mOriginalSize.height - 1);
}
}
bool
Downscaler::HasInvalidation() const
{
return mCurrentOutLine > mPrevInvalidatedLine;
--- a/image/Downscaler.h
+++ b/image/Downscaler.h
@@ -84,17 +84,17 @@ public:
bool aHasAlpha,
bool aFlipVertically = false);
bool IsFrameComplete() const { return mCurrentInLine >= mOriginalSize.height; }
/// Retrieves the buffer into which the Decoder should write each row.
uint8_t* RowBuffer()
{
- return mRowBuffer.get() + mFrameRect.x * sizeof(uint32_t);
+ return mRowBuffer.get() + mFrameRect.X() * sizeof(uint32_t);
}
/// Clears the current row buffer.
void ClearRow() { ClearRestOfRow(0); }
/// Clears the current row buffer starting at @aStartingAtCol.
void ClearRestOfRow(uint32_t aStartingAtCol);
--- a/image/FrameAnimator.cpp
+++ b/image/FrameAnimator.cpp
@@ -597,36 +597,32 @@ FrameAnimator::DoBlend(DrawableSurface&
!mCompositingPrevFrame) {
prevFrameData.mDisposalMethod = DisposalMethod::CLEAR;
}
IntRect prevRect = prevFrameData.mBlendRect
? prevFrameData.mRect.Intersect(*prevFrameData.mBlendRect)
: prevFrameData.mRect;
- bool isFullPrevFrame = prevRect.x == 0 && prevRect.y == 0 &&
- prevRect.Width() == mSize.width &&
- prevRect.Height() == mSize.height;
+ bool isFullPrevFrame = prevRect.IsEqualRect(0, 0, mSize.width, mSize.height);
// Optimization: DisposeClearAll if the previous frame is the same size as
// container and it's clearing itself
if (isFullPrevFrame &&
(prevFrameData.mDisposalMethod == DisposalMethod::CLEAR)) {
prevFrameData.mDisposalMethod = DisposalMethod::CLEAR_ALL;
}
AnimationData nextFrameData = nextFrame->GetAnimationData();
IntRect nextRect = nextFrameData.mBlendRect
? nextFrameData.mRect.Intersect(*nextFrameData.mBlendRect)
: nextFrameData.mRect;
- bool isFullNextFrame = nextRect.x == 0 && nextRect.y == 0 &&
- nextRect.Width() == mSize.width &&
- nextRect.Height() == mSize.height;
+ bool isFullNextFrame = nextRect.IsEqualRect(0, 0, mSize.width, mSize.height);
if (!nextFrame->GetIsPaletted()) {
// Optimization: Skip compositing if the previous frame wants to clear the
// whole image
if (prevFrameData.mDisposalMethod == DisposalMethod::CLEAR_ALL) {
aDirtyRect->SetRect(0, 0, mSize.width, mSize.height);
return true;
}
@@ -714,17 +710,17 @@ FrameAnimator::DoBlend(DrawableSurface&
nextFrameData.mDisposalMethod != DisposalMethod::RESTORE_PREVIOUS) {
if (isFullNextFrame) {
// Optimization: No need to dispose prev.frame when
// next frame is full frame and not transparent.
doDisposal = false;
// No need to blank the composite frame
needToBlankComposite = false;
} else {
- if ((prevRect.x >= nextRect.x) && (prevRect.y >= nextRect.y) &&
+ if ((prevRect.X() >= nextRect.X()) && (prevRect.Y() >= nextRect.Y()) &&
(prevRect.XMost() <= nextRect.XMost()) &&
(prevRect.YMost() <= nextRect.YMost())) {
// Optimization: No need to dispose prev.frame when
// next frame fully overlaps previous frame.
doDisposal = false;
}
}
}
@@ -888,18 +884,18 @@ FrameAnimator::ClearFrame(uint8_t* aFram
}
IntRect toClear = aFrameRect.Intersect(aRectToClear);
if (toClear.IsEmpty()) {
return;
}
uint32_t bytesPerRow = aFrameRect.Width() * 4;
- for (int row = toClear.y; row < toClear.YMost(); ++row) {
- memset(aFrameData + toClear.x * 4 + row * bytesPerRow, 0,
+ for (int row = toClear.Y(); row < toClear.YMost(); ++row) {
+ memset(aFrameData + toClear.X() * 4 + row * bytesPerRow, 0,
toClear.Width() * 4);
}
}
//******************************************************************************
// Whether we succeed or fail will not cause a crash, and there's not much
// we can do about a failure, so there we don't return a nsresult
bool
@@ -925,47 +921,48 @@ FrameAnimator::DrawFrameTo(const uint8_t
uint32_t aSrcPaletteLength, bool aSrcHasAlpha,
uint8_t* aDstPixels, const IntRect& aDstRect,
BlendMethod aBlendMethod, const Maybe<IntRect>& aBlendRect)
{
NS_ENSURE_ARG_POINTER(aSrcData);
NS_ENSURE_ARG_POINTER(aDstPixels);
// According to both AGIF and APNG specs, offsets are unsigned
- if (aSrcRect.x < 0 || aSrcRect.y < 0) {
+ if (aSrcRect.X() < 0 || aSrcRect.Y() < 0) {
NS_WARNING("FrameAnimator::DrawFrameTo: negative offsets not allowed");
return NS_ERROR_FAILURE;
}
+
// Outside the destination frame, skip it
- if ((aSrcRect.x > aDstRect.Width()) || (aSrcRect.y > aDstRect.Height())) {
+ if ((aSrcRect.X() > aDstRect.Width()) || (aSrcRect.Y() > aDstRect.Height())) {
return NS_OK;
}
if (aSrcPaletteLength) {
// Larger than the destination frame, clip it
- int32_t width = std::min(aSrcRect.Width(), aDstRect.Width() - aSrcRect.x);
- int32_t height = std::min(aSrcRect.Height(), aDstRect.Height() - aSrcRect.y);
+ int32_t width = std::min(aSrcRect.Width(), aDstRect.Width() - aSrcRect.X());
+ int32_t height = std::min(aSrcRect.Height(), aDstRect.Height() - aSrcRect.Y());
// The clipped image must now fully fit within destination image frame
- NS_ASSERTION((aSrcRect.x >= 0) && (aSrcRect.y >= 0) &&
- (aSrcRect.x + width <= aDstRect.Width()) &&
- (aSrcRect.y + height <= aDstRect.Height()),
+ NS_ASSERTION((aSrcRect.X() >= 0) && (aSrcRect.Y() >= 0) &&
+ (aSrcRect.X() + width <= aDstRect.Width()) &&
+ (aSrcRect.Y() + height <= aDstRect.Height()),
"FrameAnimator::DrawFrameTo: Invalid aSrcRect");
// clipped image size may be smaller than source, but not larger
NS_ASSERTION((width <= aSrcRect.Width()) && (height <= aSrcRect.Height()),
"FrameAnimator::DrawFrameTo: source must be smaller than dest");
// Get pointers to image data
const uint8_t* srcPixels = aSrcData + aSrcPaletteLength;
uint32_t* dstPixels = reinterpret_cast<uint32_t*>(aDstPixels);
const uint32_t* colormap = reinterpret_cast<const uint32_t*>(aSrcData);
// Skip to the right offset
- dstPixels += aSrcRect.x + (aSrcRect.y * aDstRect.Width());
+ dstPixels += aSrcRect.X() + (aSrcRect.Y() * aDstRect.Width());
if (!aSrcHasAlpha) {
for (int32_t r = height; r > 0; --r) {
for (int32_t c = 0; c < width; c++) {
dstPixels[c] = colormap[srcPixels[c]];
}
// Go to the next row in the source resp. destination image
srcPixels += aSrcRect.Width();
dstPixels += aDstRect.Width();
@@ -1025,35 +1022,35 @@ FrameAnimator::DrawFrameTo(const uint8_t
// We don't need to do anything clever. (Or, in the case where no blend
// rect was specified, we can't.)
pixman_image_composite32(op,
src,
nullptr,
dst,
0, 0,
0, 0,
- aSrcRect.x, aSrcRect.y,
+ aSrcRect.X(), aSrcRect.Y(),
aSrcRect.Width(), aSrcRect.Height());
} else {
// We need to do the OVER followed by SOURCE trick above.
pixman_image_composite32(PIXMAN_OP_OVER,
src,
nullptr,
dst,
0, 0,
0, 0,
- aSrcRect.x, aSrcRect.y,
+ aSrcRect.X(), aSrcRect.Y(),
aSrcRect.Width(), aSrcRect.Height());
pixman_image_composite32(PIXMAN_OP_SRC,
src,
nullptr,
dst,
- aBlendRect->x, aBlendRect->y,
+ aBlendRect->X(), aBlendRect->Y(),
0, 0,
- aBlendRect->x, aBlendRect->y,
+ aBlendRect->X(), aBlendRect->Y(),
aBlendRect->Width(), aBlendRect->Height());
}
pixman_image_unref(src);
pixman_image_unref(dst);
}
return NS_OK;
--- a/image/OrientedImage.cpp
+++ b/image/OrientedImage.cpp
@@ -390,17 +390,17 @@ OrientedImage::GetImageSpaceInvalidation
rv = NS_FAILED(rv) ? rv : InnerImage()->GetHeight(&innerSize.height);
if (NS_FAILED(rv)) {
// Fall back to identity if the width and height aren't available.
return rect;
}
// Transform the invalidation rect into the correct orientation.
gfxMatrix matrix(OrientationMatrix(innerSize));
- gfxRect invalidRect(matrix.TransformBounds(gfxRect(rect.x, rect.y,
+ gfxRect invalidRect(matrix.TransformBounds(gfxRect(rect.X(), rect.Y(),
rect.Width(), rect.Height())));
- return IntRect::RoundOut(invalidRect.x, invalidRect.y,
+ return IntRect::RoundOut(invalidRect.X(), invalidRect.Y(),
invalidRect.Width(), invalidRect.Height());
}
} // namespace image
} // namespace mozilla
--- a/image/ProgressTracker.cpp
+++ b/image/ProgressTracker.cpp
@@ -396,20 +396,23 @@ ProgressTracker::SyncNotify(IProgressObs
if (image && image->GetURI()) {
image->GetURI()->GetSpec(spec);
}
LOG_SCOPE_WITH_PARAM(gImgLog,
"ProgressTracker::SyncNotify", "uri", spec.get());
nsIntRect rect;
if (image) {
- if (NS_FAILED(image->GetWidth(&rect.width)) ||
- NS_FAILED(image->GetHeight(&rect.height))) {
+ int32_t width, height;
+ if (NS_FAILED(image->GetWidth(&width)) ||
+ NS_FAILED(image->GetHeight(&height))) {
// Either the image has no intrinsic size, or it has an error.
rect = GetMaxSizedIntRect();
+ } else {
+ rect.SizeTo(width, height);
}
}
SyncNotifyInternal(aObserver, !!image, mProgress, rect);
}
void
ProgressTracker::EmulateRequestFinished(IProgressObserver* aObserver)
--- a/image/SurfaceFilters.h
+++ b/image/SurfaceFilters.h
@@ -418,22 +418,22 @@ protected:
uint8_t* DoResetToFirstRow() override
{
uint8_t* rowPtr = mNext.ResetToFirstRow();
if (rowPtr == nullptr) {
mRow = mFrameRect.YMost();
return nullptr;
}
- mRow = mUnclampedFrameRect.y;
+ mRow = mUnclampedFrameRect.Y();
// Advance the next pipeline stage to the beginning of the frame rect,
// outputting blank rows.
- if (mFrameRect.y > 0) {
- for (int32_t rowToOutput = 0; rowToOutput < mFrameRect.y ; ++rowToOutput) {
+ if (mFrameRect.Y() > 0) {
+ for (int32_t rowToOutput = 0; rowToOutput < mFrameRect.Y() ; ++rowToOutput) {
mNext.WriteEmptyRow();
}
}
// We're at the beginning of the frame rect now, so return if we're either
// ready for input or we're already done.
rowPtr = mBuffer ? mBuffer.get() : mNext.CurrentRowPointer();
if (!mFrameRect.IsEmpty() || rowPtr == nullptr) {
@@ -454,38 +454,38 @@ protected:
uint8_t* DoAdvanceRow() override
{
uint8_t* rowPtr = nullptr;
const int32_t currentRow = mRow;
mRow++;
- if (currentRow < mFrameRect.y) {
+ if (currentRow < mFrameRect.Y()) {
// This row is outside of the frame rect, so just drop it on the floor.
rowPtr = mBuffer ? mBuffer.get() : mNext.CurrentRowPointer();
return AdjustRowPointer(rowPtr);
} else if (currentRow >= mFrameRect.YMost()) {
NS_WARNING("RemoveFrameRectFilter: Advancing past end of frame rect");
return nullptr;
}
// If we had to buffer, copy the data. Otherwise, just advance the row.
if (mBuffer) {
// We write from the beginning of the buffer unless |mUnclampedFrameRect.x|
// is negative; if that's the case, we have to skip the portion of the
// unclamped frame rect that's outside the row.
uint32_t* source = reinterpret_cast<uint32_t*>(mBuffer.get()) -
- std::min(mUnclampedFrameRect.x, 0);
+ std::min(mUnclampedFrameRect.X(), 0);
// We write |mFrameRect.width| columns starting at |mFrameRect.x|; we've
// already clamped these values to the size of the output, so we don't
// have to worry about bounds checking here (though WriteBuffer() will do
// it for us in any case).
- WriteState state = mNext.WriteBuffer(source, mFrameRect.x, mFrameRect.Width());
+ WriteState state = mNext.WriteBuffer(source, mFrameRect.X(), mFrameRect.Width());
rowPtr = state == WriteState::NEED_MORE_DATA ? mBuffer.get()
: nullptr;
} else {
rowPtr = mNext.AdvanceRow();
}
// If there's still more data coming or we're already done, just adjust the
@@ -511,17 +511,17 @@ private:
}
if (mFrameRect.IsEmpty() ||
mRow >= mFrameRect.YMost() ||
aNextRowPointer == nullptr) {
return nullptr; // Nothing left to write.
}
- return aNextRowPointer + mFrameRect.x * sizeof(uint32_t);
+ return aNextRowPointer + mFrameRect.X() * sizeof(uint32_t);
}
Next mNext; /// The next SurfaceFilter in the chain.
gfx::IntRect mFrameRect; /// The surface subrect which contains data,
/// clamped to the image size.
gfx::IntRect mUnclampedFrameRect; /// The frame rect before clamping.
UniquePtr<uint8_t[]> mBuffer; /// The intermediate buffer, if one is
--- a/image/decoders/nsGIFDecoder2.cpp
+++ b/image/decoders/nsGIFDecoder2.cpp
@@ -792,20 +792,20 @@ nsGIFDecoder2::ReadImageDescriptor(const
}
LexerTransition<nsGIFDecoder2::State>
nsGIFDecoder2::FinishImageDescriptor(const char* aData)
{
IntRect frameRect;
// Get image offsets with respect to the screen origin.
- frameRect.x = LittleEndian::readUint16(aData + 0);
- frameRect.y = LittleEndian::readUint16(aData + 2);
- frameRect.SetWidth(LittleEndian::readUint16(aData + 4));
- frameRect.SetHeight(LittleEndian::readUint16(aData + 6));
+ frameRect.SetRect(LittleEndian::readUint16(aData + 0),
+ LittleEndian::readUint16(aData + 2),
+ LittleEndian::readUint16(aData + 4),
+ LittleEndian::readUint16(aData + 6));
if (!mGIFStruct.images_decoded) {
// Work around GIF files where
// * at least one of the logical screen dimensions is smaller than the
// same dimension in the first image, or
// * GIF87a files where the first image's dimensions do not match the
// logical screen dimensions.
if (mGIFStruct.screen_height < frameRect.Height() ||
--- a/image/imgFrame.cpp
+++ b/image/imgFrame.cpp
@@ -502,33 +502,33 @@ imgFrame::SurfaceForDrawing(bool
MOZ_ASSERT(NS_IsMainThread());
mMonitor.AssertCurrentThreadOwns();
if (!aDoPartialDecode) {
return SurfaceWithFormat(new gfxSurfaceDrawable(aSurface, mImageSize),
mFormat);
}
- gfxRect available = gfxRect(mDecoded.x, mDecoded.y, mDecoded.Width(),
+ gfxRect available = gfxRect(mDecoded.X(), mDecoded.Y(), mDecoded.Width(),
mDecoded.Height());
if (aDoTile) {
// Create a temporary surface.
// Give this surface an alpha channel because there are
// transparent pixels in the padding or undecoded area
RefPtr<DrawTarget> target =
gfxPlatform::GetPlatform()->
CreateOffscreenContentDrawTarget(mImageSize, SurfaceFormat::B8G8R8A8);
if (!target) {
return SurfaceWithFormat();
}
SurfacePattern pattern(aSurface,
aRegion.GetExtendMode(),
- Matrix::Translation(mDecoded.x, mDecoded.y));
+ Matrix::Translation(mDecoded.X(), mDecoded.Y()));
target->FillRect(ToRect(aRegion.Intersect(available).Rect()), pattern);
RefPtr<SourceSurface> newsurf = target->Snapshot();
return SurfaceWithFormat(new gfxSurfaceDrawable(newsurf, mImageSize),
target->GetFormat());
}
// Not tiling, and we have a surface, so we can account for
--- a/image/test/gtest/Common.cpp
+++ b/image/test/gtest/Common.cpp
@@ -165,17 +165,17 @@ RowsAreSolidColor(SourceSurface* aSurfac
bool
PalettedRowsAreSolidColor(Decoder* aDecoder,
int32_t aStartRow,
int32_t aRowCount,
uint8_t aColor)
{
RawAccessFrameRef currentFrame = aDecoder->GetCurrentFrameRef();
IntRect frameRect = currentFrame->GetRect();
- IntRect solidColorRect(frameRect.x, aStartRow, frameRect.Width(), aRowCount);
+ IntRect solidColorRect(frameRect.X(), aStartRow, frameRect.Width(), aRowCount);
return PalettedRectIsSolidColor(aDecoder, solidColorRect, aColor);
}
bool
RectIsSolidColor(SourceSurface* aSurface,
const IntRect& aRect,
BGRAColor aColor,
uint8_t aFuzz /* = 0 */)
@@ -191,18 +191,18 @@ RectIsSolidColor(SourceSurface* aSurface
DataSourceSurface::MapType::READ);
ASSERT_TRUE_OR_RETURN(mapping.IsMapped(), false);
ASSERT_EQ_OR_RETURN(mapping.GetStride(), surfaceSize.width * 4, false);
uint8_t* data = mapping.GetData();
ASSERT_TRUE_OR_RETURN(data != nullptr, false);
int32_t rowLength = mapping.GetStride();
- for (int32_t row = rect.y; row < rect.YMost(); ++row) {
- for (int32_t col = rect.x; col < rect.XMost(); ++col) {
+ for (int32_t row = rect.Y(); row < rect.YMost(); ++row) {
+ for (int32_t col = rect.X(); col < rect.XMost(); ++col) {
int32_t i = row * rowLength + col * 4;
if (aFuzz != 0) {
ASSERT_LE_OR_RETURN(abs(aColor.mBlue - data[i + 0]), aFuzz, false);
ASSERT_LE_OR_RETURN(abs(aColor.mGreen - data[i + 1]), aFuzz, false);
ASSERT_LE_OR_RETURN(abs(aColor.mRed - data[i + 2]), aFuzz, false);
ASSERT_LE_OR_RETURN(abs(aColor.mAlpha - data[i + 3]), aFuzz, false);
} else {
ASSERT_EQ_OR_RETURN(aColor.mBlue, data[i + 0], false);
@@ -238,18 +238,18 @@ PalettedRectIsSolidColor(Decoder* aDecod
// frame rect's offset doesn't actually mean anything in terms of the
// in-memory representation of the surface. The image data starts at the upper
// left corner of the frame rect, in other words.
rect -= frameRect.TopLeft();
// Walk through the image data and make sure that the entire rect has the
// palette index |aColor|.
int32_t rowLength = frameRect.Width();
- for (int32_t row = rect.y; row < rect.YMost(); ++row) {
- for (int32_t col = rect.x; col < rect.XMost(); ++col) {
+ for (int32_t row = rect.Y(); row < rect.YMost(); ++row) {
+ for (int32_t col = rect.X(); col < rect.XMost(); ++col) {
int32_t i = row * rowLength + col;
ASSERT_EQ_OR_RETURN(aColor, imageData[i], false);
}
}
return true;
}
@@ -337,28 +337,28 @@ CheckGeneratedImage(Decoder* aDecoder,
// | E |
// +---------------------------+
// Check that the output rect itself is green. (Region 'C'.)
EXPECT_TRUE(RectIsSolidColor(surface, aRect, BGRAColor::Green(), aFuzz));
// Check that the area above the output rect is transparent. (Region 'A'.)
EXPECT_TRUE(RectIsSolidColor(surface,
- IntRect(0, 0, surfaceSize.width, aRect.y),
+ IntRect(0, 0, surfaceSize.width, aRect.Y()),
BGRAColor::Transparent(), aFuzz));
// Check that the area to the left of the output rect is transparent. (Region 'B'.)
EXPECT_TRUE(RectIsSolidColor(surface,
- IntRect(0, aRect.y, aRect.x, aRect.YMost()),
+ IntRect(0, aRect.Y(), aRect.X(), aRect.YMost()),
BGRAColor::Transparent(), aFuzz));
// Check that the area to the right of the output rect is transparent. (Region 'D'.)
const int32_t widthOnRight = surfaceSize.width - aRect.XMost();
EXPECT_TRUE(RectIsSolidColor(surface,
- IntRect(aRect.XMost(), aRect.y, widthOnRight, aRect.YMost()),
+ IntRect(aRect.XMost(), aRect.Y(), widthOnRight, aRect.YMost()),
BGRAColor::Transparent(), aFuzz));
// Check that the area below the output rect is transparent. (Region 'E'.)
const int32_t heightBelow = surfaceSize.height - aRect.YMost();
EXPECT_TRUE(RectIsSolidColor(surface,
IntRect(0, aRect.YMost(), surfaceSize.width, heightBelow),
BGRAColor::Transparent(), aFuzz));
}
@@ -381,28 +381,28 @@ CheckGeneratedPalettedImage(Decoder* aDe
// | E |
// +---------------------------+
// Check that the output rect itself is all 255's. (Region 'C'.)
EXPECT_TRUE(PalettedRectIsSolidColor(aDecoder, aRect, 255));
// Check that the area above the output rect is all 0's. (Region 'A'.)
EXPECT_TRUE(PalettedRectIsSolidColor(aDecoder,
- IntRect(0, 0, imageSize.width, aRect.y),
+ IntRect(0, 0, imageSize.width, aRect.Y()),
0));
// Check that the area to the left of the output rect is all 0's. (Region 'B'.)
EXPECT_TRUE(PalettedRectIsSolidColor(aDecoder,
- IntRect(0, aRect.y, aRect.x, aRect.YMost()),
+ IntRect(0, aRect.Y(), aRect.X(), aRect.YMost()),
0));
// Check that the area to the right of the output rect is all 0's. (Region 'D'.)
const int32_t widthOnRight = imageSize.width - aRect.XMost();
EXPECT_TRUE(PalettedRectIsSolidColor(aDecoder,
- IntRect(aRect.XMost(), aRect.y, widthOnRight, aRect.YMost()),
+ IntRect(aRect.XMost(), aRect.Y(), widthOnRight, aRect.YMost()),
0));
// Check that the area below the output rect is transparent. (Region 'E'.)
const int32_t heightBelow = imageSize.height - aRect.YMost();
EXPECT_TRUE(PalettedRectIsSolidColor(aDecoder,
IntRect(0, aRect.YMost(), imageSize.width, heightBelow),
0));
}