mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1213744 (Part 1) - Support zero-size frame rects and detecting the end of the frame in Downscaler. r=tn
This commit is contained in:
parent
df2cb10dd3
commit
9c9c634dee
@ -74,8 +74,8 @@ Downscaler::BeginFrame(const nsIntSize& aOriginalSize,
|
||||
|
||||
mFrameRect = aFrameRect.valueOr(nsIntRect(nsIntPoint(), aOriginalSize));
|
||||
MOZ_ASSERT(mFrameRect.x >= 0 && mFrameRect.y >= 0 &&
|
||||
mFrameRect.width > 0 && mFrameRect.height > 0,
|
||||
"Frame rect must have positive components");
|
||||
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");
|
||||
@ -159,8 +159,13 @@ Downscaler::ResetForNextProgressivePass()
|
||||
mCurrentInLine = 0;
|
||||
mLinesInBuffer = 0;
|
||||
|
||||
// If we have a vertical offset, commit rows to shift us past it.
|
||||
SkipToRow(mFrameRect.y);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -83,6 +83,8 @@ 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()
|
||||
{
|
||||
@ -161,6 +163,7 @@ public:
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
bool IsFrameComplete() const { return false; }
|
||||
uint8_t* RowBuffer() { return nullptr; }
|
||||
void ClearRow(uint32_t = 0) { }
|
||||
void CommitRow() { }
|
||||
|
Loading…
Reference in New Issue
Block a user