Bug 853337 - Make sure we MarkDirty on our image frames after every piece of decoding. r=seth

--HG--
extra : rebase_source : 097f3a7d59f7a59f5b8c1a6bcf7a0bce99235051
This commit is contained in:
Joe Drew 2013-03-22 18:47:25 -04:00
Родитель aff61943d7
Коммит c3d87b324d
5 изменённых файлов: 46 добавлений и 2 удалений

Просмотреть файл

@ -188,6 +188,8 @@ Decoder::AllocateFrame()
MOZ_ASSERT(mNeedsNewFrame);
MOZ_ASSERT(NS_IsMainThread());
MarkFrameDirty();
nsresult rv;
if (mNewFrameData.mPaletteDepth) {
rv = mImage.EnsureFrame(mNewFrameData.mFrameNum, mNewFrameData.mOffsetX,
@ -329,8 +331,6 @@ Decoder::PostFrameStop(RasterImage::FrameAlpha aFrameAlpha /* = RasterImage::kFr
// Flush any invalidations before we finish the frame
FlushInvalidations();
mCurrentFrame = nullptr;
// Fire notifications
if (mObserver) {
mObserver->OnStopFrame();
@ -403,5 +403,15 @@ Decoder::NeedNewFrame(uint32_t framenum, uint32_t x_offset, uint32_t y_offset,
mNeedsNewFrame = true;
}
void
Decoder::MarkFrameDirty()
{
MOZ_ASSERT(NS_IsMainThread());
if (mCurrentFrame) {
mCurrentFrame->MarkImageDataDirty();
}
}
} // namespace image
} // namespace mozilla

Просмотреть файл

@ -162,6 +162,10 @@ public:
// status code from that attempt. Clears mNewFrameData.
virtual nsresult AllocateFrame();
// Called when a chunk of decoding has been done and the frame needs to be
// marked as dirty. Must be called only on the main thread.
void MarkFrameDirty();
protected:
/*

Просмотреть файл

@ -3399,6 +3399,8 @@ RasterImage::FinishedSomeDecoding(eShutdownIntent aIntent /* = eShutdownIntent_D
nsresult rv = NS_OK;
if (image->mDecoder) {
image->mDecoder->MarkFrameDirty();
if (request && request->mChunkCount && !image->mDecoder->IsSizeDecode()) {
Telemetry::Accumulate(Telemetry::IMAGE_DECODE_CHUNKS, request->mChunkCount);
}

Просмотреть файл

@ -707,9 +707,36 @@ nsresult imgFrame::UnlockImageData()
if (mQuartzSurface)
mQuartzSurface->Flush();
#endif
return NS_OK;
}
void imgFrame::MarkImageDataDirty()
{
if (mImageSurface)
mImageSurface->Flush();
#ifdef USE_WIN_SURFACE
if (mWinSurface)
mWinSurface->Flush();
#endif
if (mImageSurface)
mImageSurface->MarkDirty();
#ifdef USE_WIN_SURFACE
if (mWinSurface)
mWinSurface->MarkDirty();
#endif
#ifdef XP_MACOSX
// The quartz image surface (ab)uses the flush method to get the
// cairo_image_surface data into a CGImage, so we have to call Flush() here.
if (mQuartzSurface)
mQuartzSurface->Flush();
#endif
}
int32_t imgFrame::GetTimeout() const
{
// Ensure a minimal time between updates so we don't throttle the UI thread.

Просмотреть файл

@ -69,6 +69,7 @@ public:
nsresult LockImageData();
nsresult UnlockImageData();
void MarkImageDataDirty();
nsresult GetSurface(gfxASurface **aSurface) const
{