зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1863846 convert MediaInfo::Rotation to WrRotation before creating a WebRender command r=aosmond
This adds some separation between MediaInfo.h and WebRender, avoiding the include of MediaInfo.h in WebRenderMessages.h. Depends on D193161 Differential Revision: https://phabricator.services.mozilla.com/D193162
This commit is contained in:
Родитель
6d1a9b9b85
Коммит
7ac9b7561d
|
@ -25,13 +25,13 @@ using mozilla::wr::FontInstanceKey from "mozilla/webrender/WebRenderTypes.h";
|
|||
using mozilla::wr::FontKey from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::ImageKey from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::BlobImageKey from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::WrRotation from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::PipelineId from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::gfx::MaybeIntSize from "mozilla/gfx/Point.h";
|
||||
using mozilla::LayoutDeviceRect from "Units.h";
|
||||
using mozilla::LayoutDeviceSize from "Units.h";
|
||||
using mozilla::ImageIntRect from "Units.h";
|
||||
using mozilla::gfx::Rect from "mozilla/gfx/Rect.h";
|
||||
using mozilla::VideoInfo::Rotation from "MediaInfo.h";
|
||||
using mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
|
||||
using struct mozilla::void_t from "mozilla/ipc/IPCCore.h";
|
||||
|
||||
|
@ -75,7 +75,7 @@ struct OpReleaseTextureOfImage {
|
|||
struct OpUpdateAsyncImagePipeline {
|
||||
PipelineId pipelineId;
|
||||
LayoutDeviceRect scBounds;
|
||||
Rotation rotation;
|
||||
WrRotation rotation;
|
||||
ImageRendering filter;
|
||||
MixBlendMode mixBlendMode;
|
||||
};
|
||||
|
|
|
@ -38,7 +38,7 @@ AsyncImagePipelineManager::AsyncImagePipeline::AsyncImagePipeline(
|
|||
: mInitialised(false),
|
||||
mIsChanged(false),
|
||||
mUseExternalImage(false),
|
||||
mRotation(VideoInfo::Rotation::kDegree_0),
|
||||
mRotation(wr::WrRotation::Degree0),
|
||||
mFilter(wr::ImageRendering::Auto),
|
||||
mMixBlendMode(wr::MixBlendMode::Normal),
|
||||
mDLBuilder(aPipelineId, aBackend) {}
|
||||
|
@ -195,7 +195,7 @@ void AsyncImagePipelineManager::RemoveAsyncImagePipeline(
|
|||
|
||||
void AsyncImagePipelineManager::UpdateAsyncImagePipeline(
|
||||
const wr::PipelineId& aPipelineId, const LayoutDeviceRect& aScBounds,
|
||||
const VideoInfo::Rotation aRotation, const wr::ImageRendering& aFilter,
|
||||
const wr::WrRotation aRotation, const wr::ImageRendering& aFilter,
|
||||
const wr::MixBlendMode& aMixBlendMode) {
|
||||
if (mDestroyed) {
|
||||
return;
|
||||
|
@ -384,20 +384,6 @@ void AsyncImagePipelineManager::ApplyAsyncImagesOfImageBridge(
|
|||
}
|
||||
}
|
||||
|
||||
wr::WrRotation ToWrRotation(VideoInfo::Rotation aRotation) {
|
||||
switch (aRotation) {
|
||||
case VideoInfo::Rotation::kDegree_0:
|
||||
return wr::WrRotation::Degree0;
|
||||
case VideoInfo::Rotation::kDegree_90:
|
||||
return wr::WrRotation::Degree90;
|
||||
case VideoInfo::Rotation::kDegree_180:
|
||||
return wr::WrRotation::Degree180;
|
||||
case VideoInfo::Rotation::kDegree_270:
|
||||
return wr::WrRotation::Degree270;
|
||||
}
|
||||
return wr::WrRotation::Degree0;
|
||||
}
|
||||
|
||||
void AsyncImagePipelineManager::ApplyAsyncImageForPipeline(
|
||||
const wr::Epoch& aEpoch, const wr::PipelineId& aPipelineId,
|
||||
AsyncImagePipeline* aPipeline, wr::TransactionBuilder& aSceneBuilderTxn,
|
||||
|
@ -439,7 +425,7 @@ void AsyncImagePipelineManager::ApplyAsyncImageForPipeline(
|
|||
computedTransform.scale_from = {
|
||||
float(aPipeline->mCurrentTexture->GetSize().width),
|
||||
float(aPipeline->mCurrentTexture->GetSize().height)};
|
||||
computedTransform.rotation = ToWrRotation(aPipeline->mRotation);
|
||||
computedTransform.rotation = aPipeline->mRotation;
|
||||
// We don't have a frame / per-frame key here, but we can use the pipeline id
|
||||
// and the key kind to create a unique stable key.
|
||||
computedTransform.key = wr::SpatialKey(
|
||||
|
|
|
@ -104,7 +104,7 @@ class AsyncImagePipelineManager final {
|
|||
|
||||
void UpdateAsyncImagePipeline(const wr::PipelineId& aPipelineId,
|
||||
const LayoutDeviceRect& aScBounds,
|
||||
VideoInfo::Rotation aRotation,
|
||||
wr::WrRotation aRotation,
|
||||
const wr::ImageRendering& aFilter,
|
||||
const wr::MixBlendMode& aMixBlendMode);
|
||||
void ApplyAsyncImagesOfImageBridge(wr::TransactionBuilder& aSceneBuilderTxn,
|
||||
|
@ -191,8 +191,7 @@ class AsyncImagePipelineManager final {
|
|||
struct AsyncImagePipeline {
|
||||
AsyncImagePipeline(wr::PipelineId aPipelineId,
|
||||
layers::WebRenderBackend aBackend);
|
||||
void Update(const LayoutDeviceRect& aScBounds,
|
||||
VideoInfo::Rotation aRotation,
|
||||
void Update(const LayoutDeviceRect& aScBounds, wr::WrRotation aRotation,
|
||||
const wr::ImageRendering& aFilter,
|
||||
const wr::MixBlendMode& aMixBlendMode) {
|
||||
mIsChanged |= !mScBounds.IsEqualEdges(aScBounds) ||
|
||||
|
@ -208,7 +207,7 @@ class AsyncImagePipelineManager final {
|
|||
bool mIsChanged;
|
||||
bool mUseExternalImage;
|
||||
LayoutDeviceRect mScBounds;
|
||||
VideoInfo::Rotation mRotation;
|
||||
wr::WrRotation mRotation;
|
||||
wr::ImageRendering mFilter;
|
||||
wr::MixBlendMode mMixBlendMode;
|
||||
RefPtr<WebRenderImageHost> mImageHost;
|
||||
|
|
|
@ -2210,6 +2210,20 @@ void WebRenderCommandBuilder::PopOverrideForASR(
|
|||
mClipManager.PopOverrideForASR(aASR);
|
||||
}
|
||||
|
||||
static wr::WrRotation ToWrRotation(VideoInfo::Rotation aRotation) {
|
||||
switch (aRotation) {
|
||||
case VideoInfo::Rotation::kDegree_0:
|
||||
return wr::WrRotation::Degree0;
|
||||
case VideoInfo::Rotation::kDegree_90:
|
||||
return wr::WrRotation::Degree90;
|
||||
case VideoInfo::Rotation::kDegree_180:
|
||||
return wr::WrRotation::Degree180;
|
||||
case VideoInfo::Rotation::kDegree_270:
|
||||
return wr::WrRotation::Degree270;
|
||||
}
|
||||
return wr::WrRotation::Degree0;
|
||||
}
|
||||
|
||||
Maybe<wr::ImageKey> WebRenderCommandBuilder::CreateImageKey(
|
||||
nsDisplayItem* aItem, ImageContainer* aContainer,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
|
@ -2229,8 +2243,9 @@ Maybe<wr::ImageKey> WebRenderCommandBuilder::CreateImageKey(
|
|||
// We appear to be using the image bridge for a lot (most/all?) of
|
||||
// layers-free image handling and that breaks frame consistency.
|
||||
imageData->CreateAsyncImageWebRenderCommands(
|
||||
aBuilder, aContainer, aSc, rect, scBounds, aContainer->GetRotation(),
|
||||
aRendering, wr::MixBlendMode::Normal, !aItem->BackfaceIsHidden());
|
||||
aBuilder, aContainer, aSc, rect, scBounds,
|
||||
ToWrRotation(aContainer->GetRotation()), aRendering,
|
||||
wr::MixBlendMode::Normal, !aItem->BackfaceIsHidden());
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
|
|
|
@ -196,6 +196,12 @@ struct ParamTraits<mozilla::wr::WebRenderError>
|
|||
mozilla::wr::WebRenderError::INITIALIZE,
|
||||
mozilla::wr::WebRenderError::Sentinel> {};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::wr::WrRotation>
|
||||
: public ContiguousEnumSerializer<mozilla::wr::WrRotation,
|
||||
mozilla::wr::WrRotation::Degree0,
|
||||
mozilla::wr::WrRotation::Sentinel> {};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::wr::MemoryReport>
|
||||
: public PlainOldDataSerializer<mozilla::wr::MemoryReport> {};
|
||||
|
|
|
@ -194,7 +194,7 @@ already_AddRefed<ImageClient> WebRenderImageData::GetImageClient() {
|
|||
void WebRenderImageData::CreateAsyncImageWebRenderCommands(
|
||||
mozilla::wr::DisplayListBuilder& aBuilder, ImageContainer* aContainer,
|
||||
const StackingContextHelper& aSc, const LayoutDeviceRect& aBounds,
|
||||
const LayoutDeviceRect& aSCBounds, VideoInfo::Rotation aRotation,
|
||||
const LayoutDeviceRect& aSCBounds, wr::WrRotation aRotation,
|
||||
const wr::ImageRendering& aFilter, const wr::MixBlendMode& aMixBlendMode,
|
||||
bool aIsBackfaceVisible) {
|
||||
MOZ_ASSERT(aContainer->IsAsync());
|
||||
|
|
|
@ -165,7 +165,7 @@ class WebRenderImageData : public WebRenderUserData {
|
|||
void CreateAsyncImageWebRenderCommands(
|
||||
mozilla::wr::DisplayListBuilder& aBuilder, ImageContainer* aContainer,
|
||||
const StackingContextHelper& aSc, const LayoutDeviceRect& aBounds,
|
||||
const LayoutDeviceRect& aSCBounds, VideoInfo::Rotation aRotation,
|
||||
const LayoutDeviceRect& aSCBounds, wr::WrRotation aRotation,
|
||||
const wr::ImageRendering& aFilter, const wr::MixBlendMode& aMixBlendMode,
|
||||
bool aIsBackfaceVisible);
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ class nsDisplayCanvas final : public nsPaintedDisplayItem {
|
|||
auto mixBlendMode = wr::MixBlendMode::Normal;
|
||||
aManager->WrBridge()->AddWebRenderParentCommand(
|
||||
OpUpdateAsyncImagePipeline(data->GetPipelineId().value(), scBounds,
|
||||
VideoInfo::Rotation::kDegree_0, filter,
|
||||
wr::WrRotation::Degree0, filter,
|
||||
mixBlendMode));
|
||||
break;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче