зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1464927 - Make nsImageBoxFrame fallback from WebRender consistently with nsImageFrame. r=tnikkel
Vector images don't support image containers if they are animated. In order to support this with WebRender, we would need to know when the generated shared surface was composited, so that we can update the image container on the next refresh tick. Because images use a different code path (not ImageClient), we don't have the ability at present. Changing vector images naively and just updating on every refresh tick if there is an image container to avoid fallback causes the animation to be very janky. Given nsImageFrame is already using fallback properly in this situation, then we can just fix nsImageBoxFrame to do the same. This gives acceptable performance without any visible slowness on the animation.
This commit is contained in:
Родитель
ee59da45b2
Коммит
19dc40f412
|
@ -417,7 +417,7 @@ nsImageBoxFrame::PaintImage(gfxContext& aRenderingContext,
|
|||
hasSubRect ? &mSubRect : nullptr);
|
||||
}
|
||||
|
||||
ImgDrawResult
|
||||
Maybe<ImgDrawResult>
|
||||
nsImageBoxFrame::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const StackingContextHelper& aSc,
|
||||
|
@ -433,7 +433,7 @@ nsImageBoxFrame::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuild
|
|||
anchorPoint,
|
||||
dest);
|
||||
if (!imgCon) {
|
||||
return result;
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
uint32_t containerFlags = imgIContainer::FLAG_ASYNC_NOTIFY;
|
||||
|
@ -455,7 +455,7 @@ nsImageBoxFrame::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuild
|
|||
imgCon->GetImageContainerAtSize(aManager, decodeSize, svgContext, containerFlags);
|
||||
if (!container) {
|
||||
NS_WARNING("Failed to get image container");
|
||||
return ImgDrawResult::NOT_READY;
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
gfx::IntSize size;
|
||||
|
@ -463,7 +463,7 @@ nsImageBoxFrame::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuild
|
|||
aBuilder, aResources,
|
||||
aSc, size, Nothing());
|
||||
if (key.isNothing()) {
|
||||
return ImgDrawResult::NOT_READY;
|
||||
return Some(ImgDrawResult::NOT_READY);
|
||||
}
|
||||
wr::LayoutRect fill = wr::ToRoundedLayoutRect(fillRect);
|
||||
|
||||
|
@ -473,7 +473,7 @@ nsImageBoxFrame::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuild
|
|||
wr::ToLayoutSize(fillRect.Size()), wr::ToLayoutSize(gapSize),
|
||||
wr::ToImageRendering(sampleFilter), key.value());
|
||||
|
||||
return ImgDrawResult::SUCCESS;
|
||||
return Some(ImgDrawResult::SUCCESS);
|
||||
}
|
||||
|
||||
nsRect
|
||||
|
@ -564,10 +564,13 @@ nsDisplayXULImage::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBui
|
|||
flags |= imgIContainer::FLAG_HIGH_QUALITY_SCALING;
|
||||
}
|
||||
|
||||
ImgDrawResult result = imageFrame->
|
||||
Maybe<ImgDrawResult> result = imageFrame->
|
||||
CreateWebRenderCommands(aBuilder, aResources, aSc, aManager, this, ToReferenceFrame(), flags);
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
||||
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, *result);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,13 +96,13 @@ public:
|
|||
const nsRect& aDirtyRect,
|
||||
nsPoint aPt, uint32_t aFlags);
|
||||
|
||||
ImgDrawResult CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const mozilla::layers::StackingContextHelper& aSc,
|
||||
mozilla::layers::WebRenderLayerManager* aManager,
|
||||
nsDisplayItem* aItem,
|
||||
nsPoint aPt,
|
||||
uint32_t aFlags);
|
||||
Maybe<ImgDrawResult> CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const mozilla::layers::StackingContextHelper& aSc,
|
||||
mozilla::layers::WebRenderLayerManager* aManager,
|
||||
nsDisplayItem* aItem,
|
||||
nsPoint aPt,
|
||||
uint32_t aFlags);
|
||||
|
||||
bool CanOptimizeToImageLayer();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче