Bug 1510139 - Part 1. Ensure we honor invalidations if using vector image containers. r=tnikkel

If a vector image has an image container, it is unlikely the caller will
call VectorImage::Draw (and thus Show indirectly) to display the image.
As such, WebRender was missing subsequent invalidations and not
regenerating the rasterized surface as expected. Thus we now resume
honoring the invalidations if we updated the image container.

Differential Revision: https://phabricator.services.mozilla.com/D15667
This commit is contained in:
Andrew Osmond 2018-12-17 08:31:04 -05:00
Родитель acd97a7608
Коммит 2d6036e804
3 изменённых файлов: 19 добавлений и 5 удалений

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

@ -262,7 +262,7 @@ ImgDrawResult ImageResource::GetImageContainerImpl(
return drawResult;
}
void ImageResource::UpdateImageContainer(const Maybe<IntRect>& aDirtyRect) {
bool ImageResource::UpdateImageContainer(const Maybe<IntRect>& aDirtyRect) {
MOZ_ASSERT(NS_IsMainThread());
for (int i = mImageContainers.Length() - 1; i >= 0; --i) {
@ -289,6 +289,8 @@ void ImageResource::UpdateImageContainer(const Maybe<IntRect>& aDirtyRect) {
mImageContainers.RemoveElementAt(i);
}
}
return !mImageContainers.IsEmpty();
}
void ImageResource::ReleaseImageContainer() {

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

@ -368,7 +368,12 @@ class ImageResource : public Image {
uint32_t aFlags,
layers::ImageContainer** aContainer);
void UpdateImageContainer(const Maybe<gfx::IntRect>& aDirtyRect);
/**
* Re-requests the appropriate frames for each image container using
* GetFrameInternal.
* @returns True if any image containers were updated, else false.
*/
bool UpdateImageContainer(const Maybe<gfx::IntRect>& aDirtyRect);
void ReleaseImageContainer();

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

@ -563,13 +563,20 @@ void VectorImage::SendInvalidationNotifications() {
// we would miss the subsequent invalidations if we didn't send out the
// notifications directly in |InvalidateObservers...|.
SurfaceCache::RemoveImage(ImageKey(this));
if (UpdateImageContainer(Nothing())) {
// If we have image containers, that means we probably won't get a Draw call
// from the owner since they are using the container. We must assume all
// invalidations need to be handled.
MOZ_ASSERT(mRenderingObserver, "Should have a rendering observer by now");
mRenderingObserver->ResumeHonoringInvalidations();
}
if (mProgressTracker) {
SurfaceCache::RemoveImage(ImageKey(this));
mProgressTracker->SyncNotifyProgress(FLAG_FRAME_COMPLETE,
GetMaxSizedIntRect());
}
UpdateImageContainer(Nothing());
}
NS_IMETHODIMP_(IntRect)