mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 22:05:44 +00:00
Bug 1361751 - Update gecko bindings to webrender to reflect changes in PR 1181. r=kats
MozReview-Commit-ID: Fxt4sNm4vxa
This commit is contained in:
parent
7818effada
commit
6ece5add60
@ -21,7 +21,6 @@ using mozilla::wr::ExternalImageId from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::ImageKey from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::FontKey from "mozilla/webrender/WebRenderTypes.h";
|
||||
using WrBuiltDisplayListDescriptor from "mozilla/webrender/webrender_ffi.h";
|
||||
using WrAuxiliaryListsDescriptor from "mozilla/webrender/webrender_ffi.h";
|
||||
using mozilla::layers::WebRenderScrollData from "mozilla/layers/WebRenderScrollData.h";
|
||||
|
||||
namespace mozilla {
|
||||
@ -53,10 +52,10 @@ parent:
|
||||
async DeleteFont(FontKey aFontKey);
|
||||
async DPBegin(IntSize aSize);
|
||||
async DPEnd(IntSize aSize, WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, uint64_t transactionId,
|
||||
ByteBuffer aDL, WrBuiltDisplayListDescriptor aDLDesc, ByteBuffer aAux, WrAuxiliaryListsDescriptor aAuxDesc,
|
||||
ByteBuffer aDL, WrBuiltDisplayListDescriptor aDLDesc,
|
||||
WebRenderScrollData aScrollData);
|
||||
sync DPSyncEnd(IntSize aSize, WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, uint64_t transactionId,
|
||||
ByteBuffer aDL, WrBuiltDisplayListDescriptor aDLDesc, ByteBuffer aAux, WrAuxiliaryListsDescriptor aAuxDesc,
|
||||
ByteBuffer aDL, WrBuiltDisplayListDescriptor aDLDesc,
|
||||
WebRenderScrollData aScrollData);
|
||||
sync DPGetSnapshot(PTexture texture);
|
||||
async AddExternalImageId(ExternalImageId aImageId, CompositableHandle aHandle);
|
||||
|
@ -102,14 +102,13 @@ WebRenderBridgeChild::DPEnd(wr::DisplayListBuilder &aBuilder,
|
||||
|
||||
wr::BuiltDisplayList dl = aBuilder.Finalize();
|
||||
ByteBuffer dlData(Move(dl.dl));
|
||||
ByteBuffer auxData(Move(dl.aux));
|
||||
|
||||
if (aIsSync) {
|
||||
this->SendDPSyncEnd(aSize, mParentCommands, mDestroyedActors, GetFwdTransactionId(), aTransactionId,
|
||||
dlData, dl.dl_desc, auxData, dl.aux_desc, aScrollData);
|
||||
dlData, dl.dl_desc, aScrollData);
|
||||
} else {
|
||||
this->SendDPEnd(aSize, mParentCommands, mDestroyedActors, GetFwdTransactionId(), aTransactionId,
|
||||
dlData, dl.dl_desc, auxData, dl.aux_desc, aScrollData);
|
||||
dlData, dl.dl_desc, aScrollData);
|
||||
}
|
||||
|
||||
mParentCommands.Clear();
|
||||
@ -188,8 +187,6 @@ WebRenderBridgeChild::PushGlyphs(wr::DisplayListBuilder& aBuilder, const nsTArra
|
||||
WrFontKey key = GetFontKeyForScaledFont(aFont);
|
||||
MOZ_ASSERT(key.mNamespace && key.mHandle);
|
||||
|
||||
WrClipRegion clipRegion = aBuilder.BuildClipRegion(aSc.ToRelativeWrRect(aClip));
|
||||
|
||||
for (size_t i = 0; i < aGlyphs.Length(); i++) {
|
||||
GlyphArray glyph_array = aGlyphs[i];
|
||||
nsTArray<gfx::Glyph>& glyphs = glyph_array.glyphs();
|
||||
@ -202,6 +199,8 @@ WebRenderBridgeChild::PushGlyphs(wr::DisplayListBuilder& aBuilder, const nsTArra
|
||||
wr_glyph_instances[j].point = aSc.ToRelativeWrPoint(
|
||||
LayerPoint::FromUnknownPoint(glyphs[j].mPosition));
|
||||
}
|
||||
|
||||
WrClipRegionToken clipRegion = aBuilder.PushClipRegion(aSc.ToRelativeWrRect(aClip));
|
||||
aBuilder.PushText(aSc.ToRelativeWrRect(aBounds),
|
||||
clipRegion,
|
||||
glyph_array.color().value(),
|
||||
|
@ -306,8 +306,6 @@ WebRenderBridgeParent::HandleDPEnd(const gfx::IntSize& aSize,
|
||||
const uint64_t& aTransactionId,
|
||||
const ByteBuffer& dl,
|
||||
const WrBuiltDisplayListDescriptor& dlDesc,
|
||||
const ByteBuffer& aux,
|
||||
const WrAuxiliaryListsDescriptor& auxDesc,
|
||||
const WebRenderScrollData& aScrollData)
|
||||
{
|
||||
UpdateFwdTransactionId(aFwdTransactionId);
|
||||
@ -325,7 +323,7 @@ WebRenderBridgeParent::HandleDPEnd(const gfx::IntSize& aSize,
|
||||
|
||||
++mWrEpoch; // Update webrender epoch
|
||||
ProcessWebRenderCommands(aSize, aCommands, wr::NewEpoch(mWrEpoch),
|
||||
dl, dlDesc, aux, auxDesc);
|
||||
dl, dlDesc);
|
||||
HoldPendingTransactionId(mWrEpoch, aTransactionId);
|
||||
|
||||
mScrollData = aScrollData;
|
||||
@ -389,12 +387,10 @@ WebRenderBridgeParent::RecvDPEnd(const gfx::IntSize& aSize,
|
||||
const uint64_t& aTransactionId,
|
||||
const ByteBuffer& dl,
|
||||
const WrBuiltDisplayListDescriptor& dlDesc,
|
||||
const ByteBuffer& aux,
|
||||
const WrAuxiliaryListsDescriptor& auxDesc,
|
||||
const WebRenderScrollData& aScrollData)
|
||||
{
|
||||
HandleDPEnd(aSize, Move(aCommands), Move(aToDestroy), aFwdTransactionId, aTransactionId,
|
||||
dl, dlDesc, aux, auxDesc, aScrollData);
|
||||
dl, dlDesc, aScrollData);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
@ -406,12 +402,10 @@ WebRenderBridgeParent::RecvDPSyncEnd(const gfx::IntSize &aSize,
|
||||
const uint64_t& aTransactionId,
|
||||
const ByteBuffer& dl,
|
||||
const WrBuiltDisplayListDescriptor& dlDesc,
|
||||
const ByteBuffer& aux,
|
||||
const WrAuxiliaryListsDescriptor& auxDesc,
|
||||
const WebRenderScrollData& aScrollData)
|
||||
{
|
||||
HandleDPEnd(aSize, Move(aCommands), Move(aToDestroy), aFwdTransactionId, aTransactionId,
|
||||
dl, dlDesc, aux, auxDesc, aScrollData);
|
||||
dl, dlDesc, aScrollData);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
@ -419,9 +413,7 @@ void
|
||||
WebRenderBridgeParent::ProcessWebRenderCommands(const gfx::IntSize &aSize,
|
||||
InfallibleTArray<WebRenderParentCommand>& aCommands, const wr::Epoch& aEpoch,
|
||||
const ByteBuffer& dl,
|
||||
const WrBuiltDisplayListDescriptor& dlDesc,
|
||||
const ByteBuffer& aux,
|
||||
const WrAuxiliaryListsDescriptor& auxDesc)
|
||||
const WrBuiltDisplayListDescriptor& dlDesc)
|
||||
{
|
||||
mCompositableHolder->SetCompositionTime(TimeStamp::Now());
|
||||
|
||||
@ -527,8 +519,7 @@ WebRenderBridgeParent::ProcessWebRenderCommands(const gfx::IntSize &aSize,
|
||||
}
|
||||
mApi->SetRootDisplayList(gfx::Color(0.3f, 0.f, 0.f, 1.f), aEpoch, LayerSize(aSize.width, aSize.height),
|
||||
mPipelineId,
|
||||
dlDesc, dl.mData, dl.mLength,
|
||||
auxDesc, aux.mData, aux.mLength);
|
||||
dlDesc, dl.mData, dl.mLength);
|
||||
|
||||
ScheduleComposition();
|
||||
DeleteOldImages();
|
||||
|
@ -92,8 +92,6 @@ public:
|
||||
const uint64_t& aTransactionId,
|
||||
const ByteBuffer& dl,
|
||||
const WrBuiltDisplayListDescriptor& dlDesc,
|
||||
const ByteBuffer& aux,
|
||||
const WrAuxiliaryListsDescriptor& auxDesc,
|
||||
const WebRenderScrollData& aScrollData) override;
|
||||
mozilla::ipc::IPCResult RecvDPSyncEnd(const gfx::IntSize& aSize,
|
||||
InfallibleTArray<WebRenderParentCommand>&& aCommands,
|
||||
@ -102,8 +100,6 @@ public:
|
||||
const uint64_t& aTransactionId,
|
||||
const ByteBuffer& dl,
|
||||
const WrBuiltDisplayListDescriptor& dlDesc,
|
||||
const ByteBuffer& aux,
|
||||
const WrAuxiliaryListsDescriptor& auxDesc,
|
||||
const WebRenderScrollData& aScrollData) override;
|
||||
mozilla::ipc::IPCResult RecvDPGetSnapshot(PTextureParent* aTexture) override;
|
||||
|
||||
@ -175,9 +171,7 @@ private:
|
||||
void DeleteOldImages();
|
||||
void ProcessWebRenderCommands(const gfx::IntSize &aSize, InfallibleTArray<WebRenderParentCommand>& commands, const wr::Epoch& aEpoch,
|
||||
const ByteBuffer& dl,
|
||||
const WrBuiltDisplayListDescriptor& dlDesc,
|
||||
const ByteBuffer& aux,
|
||||
const WrAuxiliaryListsDescriptor& auxDesc);
|
||||
const WrBuiltDisplayListDescriptor& dlDesc);
|
||||
void ScheduleComposition();
|
||||
void ClearResources();
|
||||
uint64_t GetChildLayerObserverEpoch() const { return mChildLayerObserverEpoch; }
|
||||
@ -189,8 +183,6 @@ private:
|
||||
const uint64_t& aTransactionId,
|
||||
const ByteBuffer& dl,
|
||||
const WrBuiltDisplayListDescriptor& dlDesc,
|
||||
const ByteBuffer& aux,
|
||||
const WrAuxiliaryListsDescriptor& auxDesc,
|
||||
const WebRenderScrollData& aScrollData);
|
||||
|
||||
void SampleAnimations(nsTArray<WrOpacityProperty>& aOpacityArray,
|
||||
|
@ -69,7 +69,7 @@ WebRenderCanvasLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
|
||||
|
||||
LayerRect clipRect = ClipRect().valueOr(rect);
|
||||
Maybe<WrImageMask> mask = BuildWrMaskLayer(&sc);
|
||||
WrClipRegion clip = aBuilder.BuildClipRegion(
|
||||
WrClipRegionToken clip = aBuilder.PushClipRegion(
|
||||
sc.ToRelativeWrRect(clipRect),
|
||||
mask.ptrOr(nullptr));
|
||||
|
||||
|
@ -28,7 +28,7 @@ WebRenderColorLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
|
||||
|
||||
LayerRect clipRect = ClipRect().valueOr(rect);
|
||||
Maybe<WrImageMask> mask = BuildWrMaskLayer(&sc);
|
||||
WrClipRegion clip = aBuilder.BuildClipRegion(
|
||||
WrClipRegionToken clip = aBuilder.PushClipRegion(
|
||||
sc.ToRelativeWrRect(clipRect),
|
||||
mask.ptrOr(nullptr));
|
||||
|
||||
|
@ -121,7 +121,7 @@ WebRenderRefLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
|
||||
PixelCastJustification::MovingDownToChildren);
|
||||
DumpLayerInfo("RefLayer", rect);
|
||||
|
||||
WrClipRegion clipRegion = aBuilder.BuildClipRegion(aSc.ToRelativeWrRect(rect));
|
||||
WrClipRegionToken clipRegion = aBuilder.PushClipRegion(aSc.ToRelativeWrRect(rect));
|
||||
aBuilder.PushIFrame(aSc.ToRelativeWrRect(rect), clipRegion, wr::AsPipelineId(mId));
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ WebRenderDisplayItemLayer::PushItemAsBlobImage(wr::DisplayListBuilder& aBuilder,
|
||||
MOZ_ASSERT(ok);
|
||||
|
||||
WrRect dest = aSc.ToRelativeWrRect(imageRect + offset);
|
||||
WrClipRegion clipRegion = aBuilder.BuildClipRegion(dest);
|
||||
WrClipRegionToken clipRegion = aBuilder.PushClipRegion(dest);
|
||||
WrImageKey key = GetImageKey();
|
||||
WrBridge()->SendAddBlobImage(key, imageSize.ToUnknownSize(), imageSize.width * 4, dt->GetFormat(), bytes);
|
||||
WrManager()->AddImageKeyForDiscard(key);
|
||||
|
@ -176,7 +176,7 @@ WebRenderImageLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
|
||||
|
||||
LayerRect clipRect = ClipRect().valueOr(rect);
|
||||
Maybe<WrImageMask> mask = BuildWrMaskLayer(&sc);
|
||||
WrClipRegion clip = aBuilder.BuildClipRegion(
|
||||
WrClipRegionToken clip = aBuilder.PushClipRegion(
|
||||
sc.ToRelativeWrRect(clipRect),
|
||||
mask.ptrOr(nullptr));
|
||||
|
||||
|
@ -192,28 +192,6 @@ struct ParamTraits<WrBuiltDisplayListDescriptor>
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<WrAuxiliaryListsDescriptor>
|
||||
{
|
||||
static void
|
||||
Write(Message* aMsg, const WrAuxiliaryListsDescriptor& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.gradient_stops_size);
|
||||
WriteParam(aMsg, aParam.complex_clip_regions_size);
|
||||
WriteParam(aMsg, aParam.filters_size);
|
||||
WriteParam(aMsg, aParam.glyph_instances_size);
|
||||
}
|
||||
|
||||
static bool
|
||||
Read(const Message* aMsg, PickleIterator* aIter, WrAuxiliaryListsDescriptor* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->gradient_stops_size)
|
||||
&& ReadParam(aMsg, aIter, &aResult->complex_clip_regions_size)
|
||||
&& ReadParam(aMsg, aIter, &aResult->filters_size)
|
||||
&& ReadParam(aMsg, aIter, &aResult->glyph_instances_size);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace IPC
|
||||
|
||||
#endif // GFX_WEBRENDERMESSAGEUTILS_H
|
||||
|
@ -99,7 +99,7 @@ WebRenderPaintedLayer::CreateWebRenderDisplayList(wr::DisplayListBuilder& aBuild
|
||||
|
||||
LayerRect clipRect = ClipRect().valueOr(rect);
|
||||
Maybe<WrImageMask> mask = BuildWrMaskLayer(&sc);
|
||||
WrClipRegion clip = aBuilder.BuildClipRegion(
|
||||
WrClipRegionToken clip = aBuilder.PushClipRegion(
|
||||
sc.ToRelativeWrRect(clipRect),
|
||||
mask.ptrOr(nullptr));
|
||||
|
||||
|
@ -84,7 +84,7 @@ WebRenderPaintedLayerBlob::RenderLayer(wr::DisplayListBuilder& aBuilder,
|
||||
|
||||
LayerRect clipRect = ClipRect().valueOr(rect);
|
||||
Maybe<WrImageMask> mask = BuildWrMaskLayer(&sc);
|
||||
WrClipRegion clip = aBuilder.BuildClipRegion(
|
||||
WrClipRegionToken clip = aBuilder.PushClipRegion(
|
||||
sc.ToRelativeWrRect(clipRect),
|
||||
mask.ptrOr(nullptr));
|
||||
|
||||
|
@ -198,10 +198,7 @@ WebRenderAPI::SetRootDisplayList(gfx::Color aBgColor,
|
||||
WrPipelineId pipeline_id,
|
||||
WrBuiltDisplayListDescriptor dl_descriptor,
|
||||
uint8_t *dl_data,
|
||||
size_t dl_size,
|
||||
WrAuxiliaryListsDescriptor aux_descriptor,
|
||||
uint8_t *aux_data,
|
||||
size_t aux_size)
|
||||
size_t dl_size)
|
||||
{
|
||||
wr_api_set_root_display_list(mWrApi,
|
||||
aEpoch,
|
||||
@ -209,10 +206,7 @@ WebRenderAPI::SetRootDisplayList(gfx::Color aBgColor,
|
||||
pipeline_id,
|
||||
dl_descriptor,
|
||||
dl_data,
|
||||
dl_size,
|
||||
aux_descriptor,
|
||||
aux_data,
|
||||
aux_size);
|
||||
dl_size);
|
||||
}
|
||||
|
||||
void
|
||||
@ -531,9 +525,7 @@ DisplayListBuilder::Finalize()
|
||||
BuiltDisplayList dl;
|
||||
wr_api_finalize_builder(mWrState,
|
||||
&dl.dl_desc,
|
||||
&dl.dl.inner,
|
||||
&dl.aux_desc,
|
||||
&dl.aux.inner);
|
||||
&dl.dl.inner);
|
||||
return dl;
|
||||
}
|
||||
|
||||
@ -587,9 +579,7 @@ DisplayListBuilder::PushBuiltDisplayList(BuiltDisplayList dl)
|
||||
{
|
||||
wr_dp_push_built_display_list(mWrState,
|
||||
dl.dl_desc,
|
||||
dl.dl.Extract(),
|
||||
dl.aux_desc,
|
||||
dl.aux.Extract());
|
||||
dl.dl.Extract());
|
||||
}
|
||||
|
||||
void
|
||||
@ -608,7 +598,7 @@ DisplayListBuilder::PopScrollLayer()
|
||||
|
||||
void
|
||||
DisplayListBuilder::PushRect(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrColor& aColor)
|
||||
{
|
||||
wr_dp_push_rect(mWrState, aBounds, aClip, aColor);
|
||||
@ -616,7 +606,7 @@ DisplayListBuilder::PushRect(const WrRect& aBounds,
|
||||
|
||||
void
|
||||
DisplayListBuilder::PushLinearGradient(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrPoint& aStartPoint,
|
||||
const WrPoint& aEndPoint,
|
||||
const nsTArray<WrGradientStop>& aStops,
|
||||
@ -634,7 +624,7 @@ DisplayListBuilder::PushLinearGradient(const WrRect& aBounds,
|
||||
|
||||
void
|
||||
DisplayListBuilder::PushRadialGradient(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrPoint& aCenter,
|
||||
const WrSize& aRadius,
|
||||
const nsTArray<WrGradientStop>& aStops,
|
||||
@ -652,7 +642,7 @@ DisplayListBuilder::PushRadialGradient(const WrRect& aBounds,
|
||||
|
||||
void
|
||||
DisplayListBuilder::PushImage(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
wr::ImageRendering aFilter,
|
||||
wr::ImageKey aImage)
|
||||
{
|
||||
@ -664,7 +654,7 @@ DisplayListBuilder::PushImage(const WrRect& aBounds,
|
||||
|
||||
void
|
||||
DisplayListBuilder::PushImage(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrSize& aStretchSize,
|
||||
const WrSize& aTileSpacing,
|
||||
wr::ImageRendering aFilter,
|
||||
@ -675,7 +665,7 @@ DisplayListBuilder::PushImage(const WrRect& aBounds,
|
||||
|
||||
void
|
||||
DisplayListBuilder::PushYCbCrPlanarImage(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
wr::ImageKey aImageChannel0,
|
||||
wr::ImageKey aImageChannel1,
|
||||
wr::ImageKey aImageChannel2,
|
||||
@ -692,7 +682,7 @@ DisplayListBuilder::PushYCbCrPlanarImage(const WrRect& aBounds,
|
||||
|
||||
void
|
||||
DisplayListBuilder::PushNV12Image(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
wr::ImageKey aImageChannel0,
|
||||
wr::ImageKey aImageChannel1,
|
||||
WrYuvColorSpace aColorSpace)
|
||||
@ -707,7 +697,7 @@ DisplayListBuilder::PushNV12Image(const WrRect& aBounds,
|
||||
|
||||
void
|
||||
DisplayListBuilder::PushIFrame(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
PipelineId aPipeline)
|
||||
{
|
||||
wr_dp_push_iframe(mWrState, aBounds, aClip, aPipeline);
|
||||
@ -715,7 +705,7 @@ DisplayListBuilder::PushIFrame(const WrRect& aBounds,
|
||||
|
||||
void
|
||||
DisplayListBuilder::PushBorder(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrBorderWidths& aWidths,
|
||||
const WrBorderSide& aTop,
|
||||
const WrBorderSide& aRight,
|
||||
@ -729,7 +719,7 @@ DisplayListBuilder::PushBorder(const WrRect& aBounds,
|
||||
|
||||
void
|
||||
DisplayListBuilder::PushBorderImage(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrBorderWidths& aWidths,
|
||||
wr::ImageKey aImage,
|
||||
const WrNinePatchDescriptor& aPatch,
|
||||
@ -744,7 +734,7 @@ DisplayListBuilder::PushBorderImage(const WrRect& aBounds,
|
||||
|
||||
void
|
||||
DisplayListBuilder::PushBorderGradient(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrBorderWidths& aWidths,
|
||||
const WrPoint& aStartPoint,
|
||||
const WrPoint& aEndPoint,
|
||||
@ -760,7 +750,7 @@ DisplayListBuilder::PushBorderGradient(const WrRect& aBounds,
|
||||
|
||||
void
|
||||
DisplayListBuilder::PushBorderRadialGradient(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrBorderWidths& aWidths,
|
||||
const WrPoint& aCenter,
|
||||
const WrSize& aRadius,
|
||||
@ -776,7 +766,7 @@ DisplayListBuilder::PushBorderRadialGradient(const WrRect& aBounds,
|
||||
|
||||
void
|
||||
DisplayListBuilder::PushText(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const gfx::Color& aColor,
|
||||
wr::FontKey aFontKey,
|
||||
Range<const WrGlyphInstance> aGlyphBuffer,
|
||||
@ -791,7 +781,7 @@ DisplayListBuilder::PushText(const WrRect& aBounds,
|
||||
|
||||
void
|
||||
DisplayListBuilder::PushBoxShadow(const WrRect& aRect,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrRect& aBoxBounds,
|
||||
const WrPoint& aOffset,
|
||||
const WrColor& aColor,
|
||||
@ -806,25 +796,25 @@ DisplayListBuilder::PushBoxShadow(const WrRect& aRect,
|
||||
aClipMode);
|
||||
}
|
||||
|
||||
WrClipRegion
|
||||
DisplayListBuilder::BuildClipRegion(const WrRect& aMain,
|
||||
const WrImageMask* aMask)
|
||||
WrClipRegionToken
|
||||
DisplayListBuilder::PushClipRegion(const WrRect& aMain,
|
||||
const WrImageMask* aMask)
|
||||
{
|
||||
return wr_dp_new_clip_region(mWrState,
|
||||
aMain,
|
||||
nullptr, 0,
|
||||
aMask);
|
||||
return wr_dp_push_clip_region(mWrState,
|
||||
aMain,
|
||||
nullptr, 0,
|
||||
aMask);
|
||||
}
|
||||
|
||||
WrClipRegion
|
||||
DisplayListBuilder::BuildClipRegion(const WrRect& aMain,
|
||||
const nsTArray<WrComplexClipRegion>& aComplex,
|
||||
const WrImageMask* aMask)
|
||||
WrClipRegionToken
|
||||
DisplayListBuilder::PushClipRegion(const WrRect& aMain,
|
||||
const nsTArray<WrComplexClipRegion>& aComplex,
|
||||
const WrImageMask* aMask)
|
||||
{
|
||||
return wr_dp_new_clip_region(mWrState,
|
||||
aMain,
|
||||
aComplex.Elements(), aComplex.Length(),
|
||||
aMask);
|
||||
return wr_dp_push_clip_region(mWrState,
|
||||
aMain,
|
||||
aComplex.Elements(), aComplex.Length(),
|
||||
aMask);
|
||||
}
|
||||
|
||||
} // namespace wr
|
||||
|
@ -55,10 +55,7 @@ public:
|
||||
WrPipelineId pipeline_id,
|
||||
WrBuiltDisplayListDescriptor dl_descriptor,
|
||||
uint8_t *dl_data,
|
||||
size_t dl_size,
|
||||
WrAuxiliaryListsDescriptor aux_descriptor,
|
||||
uint8_t *aux_data,
|
||||
size_t aux_size);
|
||||
size_t dl_size);
|
||||
|
||||
void ClearRootDisplayList(Epoch aEpoch,
|
||||
WrPipelineId pipeline_id);
|
||||
@ -164,11 +161,11 @@ public:
|
||||
|
||||
|
||||
void PushRect(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrColor& aColor);
|
||||
|
||||
void PushLinearGradient(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrPoint& aStartPoint,
|
||||
const WrPoint& aEndPoint,
|
||||
const nsTArray<WrGradientStop>& aStops,
|
||||
@ -177,7 +174,7 @@ public:
|
||||
const WrSize aTileSpacing);
|
||||
|
||||
void PushRadialGradient(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrPoint& aCenter,
|
||||
const WrSize& aRadius,
|
||||
const nsTArray<WrGradientStop>& aStops,
|
||||
@ -186,36 +183,36 @@ public:
|
||||
const WrSize aTileSpacing);
|
||||
|
||||
void PushImage(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
wr::ImageRendering aFilter,
|
||||
wr::ImageKey aImage);
|
||||
|
||||
void PushImage(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrSize& aStretchSize,
|
||||
const WrSize& aTileSpacing,
|
||||
wr::ImageRendering aFilter,
|
||||
wr::ImageKey aImage);
|
||||
|
||||
void PushYCbCrPlanarImage(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
wr::ImageKey aImageChannel0,
|
||||
wr::ImageKey aImageChannel1,
|
||||
wr::ImageKey aImageChannel2,
|
||||
WrYuvColorSpace aColorSpace);
|
||||
|
||||
void PushNV12Image(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
wr::ImageKey aImageChannel0,
|
||||
wr::ImageKey aImageChannel1,
|
||||
WrYuvColorSpace aColorSpace);
|
||||
|
||||
void PushIFrame(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
wr::PipelineId aPipeline);
|
||||
|
||||
void PushBorder(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrBorderWidths& aWidths,
|
||||
const WrBorderSide& aTop,
|
||||
const WrBorderSide& aRight,
|
||||
@ -224,7 +221,7 @@ public:
|
||||
const WrBorderRadius& aRadius);
|
||||
|
||||
void PushBorderImage(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrBorderWidths& aWidths,
|
||||
wr::ImageKey aImage,
|
||||
const WrNinePatchDescriptor& aPatch,
|
||||
@ -233,7 +230,7 @@ public:
|
||||
const WrRepeatMode& aRepeatVertical);
|
||||
|
||||
void PushBorderGradient(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrBorderWidths& aWidths,
|
||||
const WrPoint& aStartPoint,
|
||||
const WrPoint& aEndPoint,
|
||||
@ -242,7 +239,7 @@ public:
|
||||
const WrSideOffsets2Df32& aOutset);
|
||||
|
||||
void PushBorderRadialGradient(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrBorderWidths& aWidths,
|
||||
const WrPoint& aCenter,
|
||||
const WrSize& aRadius,
|
||||
@ -251,14 +248,14 @@ public:
|
||||
const WrSideOffsets2Df32& aOutset);
|
||||
|
||||
void PushText(const WrRect& aBounds,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const gfx::Color& aColor,
|
||||
wr::FontKey aFontKey,
|
||||
Range<const WrGlyphInstance> aGlyphBuffer,
|
||||
float aGlyphSize);
|
||||
|
||||
void PushBoxShadow(const WrRect& aRect,
|
||||
const WrClipRegion& aClip,
|
||||
const WrClipRegionToken aClip,
|
||||
const WrRect& aBoxBounds,
|
||||
const WrPoint& aOffset,
|
||||
const WrColor& aColor,
|
||||
@ -267,11 +264,11 @@ public:
|
||||
const float& aBorderRadius,
|
||||
const WrBoxShadowClipMode& aClipMode);
|
||||
|
||||
WrClipRegion BuildClipRegion(const WrRect& aMain,
|
||||
const WrImageMask* aMask = nullptr);
|
||||
WrClipRegion BuildClipRegion(const WrRect& aMain,
|
||||
const nsTArray<WrComplexClipRegion>& aComplex,
|
||||
const WrImageMask* aMask = nullptr);
|
||||
WrClipRegionToken PushClipRegion(const WrRect& aMain,
|
||||
const WrImageMask* aMask = nullptr);
|
||||
WrClipRegionToken PushClipRegion(const WrRect& aMain,
|
||||
const nsTArray<WrComplexClipRegion>& aComplex,
|
||||
const WrImageMask* aMask = nullptr);
|
||||
|
||||
// Try to avoid using this when possible.
|
||||
WrState* Raw() { return mWrState; }
|
||||
|
@ -540,8 +540,6 @@ inline mozilla::Range<uint8_t> MutByteSliceToRange(MutByteSlice aWrSlice) {
|
||||
struct BuiltDisplayList {
|
||||
VecU8 dl;
|
||||
WrBuiltDisplayListDescriptor dl_desc;
|
||||
VecU8 aux;
|
||||
WrAuxiliaryListsDescriptor aux_desc;
|
||||
};
|
||||
|
||||
} // namespace wr
|
||||
|
@ -22,7 +22,6 @@ extern crate webrender_traits;
|
||||
static ENABLE_RECORDING: bool = false;
|
||||
|
||||
type WrAPI = RenderApi;
|
||||
type WrAuxiliaryListsDescriptor = AuxiliaryListsDescriptor;
|
||||
type WrBorderStyle = BorderStyle;
|
||||
type WrBoxShadowClipMode = BoxShadowClipMode;
|
||||
type WrBuiltDisplayListDescriptor = BuiltDisplayListDescriptor;
|
||||
@ -147,30 +146,6 @@ impl Into<ExtendMode> for WrGradientExtendMode {
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
struct WrItemRange {
|
||||
start: usize,
|
||||
length: usize,
|
||||
}
|
||||
|
||||
impl Into<ItemRange> for WrItemRange {
|
||||
fn into(self) -> ItemRange {
|
||||
ItemRange {
|
||||
start: self.start,
|
||||
length: self.length,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl From<ItemRange> for WrItemRange {
|
||||
fn from(item_range: ItemRange) -> Self {
|
||||
WrItemRange {
|
||||
start: item_range.start,
|
||||
length: item_range.length,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct WrPoint {
|
||||
@ -481,7 +456,8 @@ impl<'a> Into<ComplexClipRegion> for &'a WrComplexClipRegion {
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct WrClipRegion {
|
||||
main: WrRect,
|
||||
complex: WrItemRange,
|
||||
complex: ItemRange<ComplexClipRegion>,
|
||||
complex_count: usize,
|
||||
image_mask: WrImageMask,
|
||||
has_image_mask: bool,
|
||||
}
|
||||
@ -490,7 +466,8 @@ impl Into<ClipRegion> for WrClipRegion {
|
||||
fn into(self) -> ClipRegion {
|
||||
ClipRegion {
|
||||
main: self.main.into(),
|
||||
complex: self.complex.into(),
|
||||
complex_clips: self.complex,
|
||||
complex_clip_count: self.complex_count,
|
||||
image_mask: if self.has_image_mask {
|
||||
Some(self.image_mask.into())
|
||||
} else {
|
||||
@ -504,7 +481,8 @@ impl From<ClipRegion> for WrClipRegion {
|
||||
if let Some(image_mask) = clip_region.image_mask {
|
||||
WrClipRegion {
|
||||
main: clip_region.main.into(),
|
||||
complex: clip_region.complex.into(),
|
||||
complex: clip_region.complex_clips,
|
||||
complex_count: clip_region.complex_clip_count,
|
||||
image_mask: image_mask.into(),
|
||||
has_image_mask: true,
|
||||
}
|
||||
@ -522,7 +500,8 @@ impl From<ClipRegion> for WrClipRegion {
|
||||
|
||||
WrClipRegion {
|
||||
main: clip_region.main.into(),
|
||||
complex: clip_region.complex.into(),
|
||||
complex: clip_region.complex_clips,
|
||||
complex_count: clip_region.complex_clip_count,
|
||||
image_mask: blank,
|
||||
has_image_mask: false,
|
||||
}
|
||||
@ -530,6 +509,25 @@ impl From<ClipRegion> for WrClipRegion {
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct WrClipRegionToken {
|
||||
_dummy: bool,
|
||||
}
|
||||
|
||||
impl Into<ClipRegionToken> for WrClipRegionToken {
|
||||
fn into(self) -> ClipRegionToken {
|
||||
// ClipRegionTokens are a zero sized move-only "proof of work"
|
||||
// this doesn't really translate... so uh, pretend it does?
|
||||
unsafe { mem::transmute(()) }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ClipRegionToken> for WrClipRegionToken {
|
||||
fn from(_token: ClipRegionToken) -> WrClipRegionToken {
|
||||
WrClipRegionToken { _dummy: true }
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(u32)]
|
||||
#[allow(dead_code)]
|
||||
enum WrExternalImageType {
|
||||
@ -1016,10 +1014,7 @@ pub unsafe extern "C" fn wr_api_set_root_display_list(api: &mut WrAPI,
|
||||
pipeline_id: WrPipelineId,
|
||||
dl_descriptor: WrBuiltDisplayListDescriptor,
|
||||
dl_data: *mut u8,
|
||||
dl_size: usize,
|
||||
aux_descriptor: WrAuxiliaryListsDescriptor,
|
||||
aux_data: *mut u8,
|
||||
aux_size: usize) {
|
||||
dl_size: usize) {
|
||||
let root_background_color = ColorF::new(0.3, 0.0, 0.0, 1.0);
|
||||
// See the documentation of set_display_list in api.rs. I don't think
|
||||
// it makes a difference in gecko at the moment(until APZ is figured out)
|
||||
@ -1032,16 +1027,10 @@ pub unsafe extern "C" fn wr_api_set_root_display_list(api: &mut WrAPI,
|
||||
dl_vec.extend_from_slice(dl_slice);
|
||||
let dl = BuiltDisplayList::from_data(dl_vec, dl_descriptor);
|
||||
|
||||
let aux_slice = make_slice(aux_data, aux_size);
|
||||
let mut aux_vec = Vec::new();
|
||||
// XXX: see if we can get rid of the copy here
|
||||
aux_vec.extend_from_slice(aux_slice);
|
||||
let aux = AuxiliaryLists::from_data(aux_vec, aux_descriptor);
|
||||
|
||||
api.set_display_list(Some(root_background_color),
|
||||
epoch,
|
||||
LayoutSize::new(viewport_width, viewport_height),
|
||||
(pipeline_id, dl, aux),
|
||||
(pipeline_id, dl),
|
||||
preserve_frame_state);
|
||||
}
|
||||
|
||||
@ -1197,7 +1186,7 @@ pub extern "C" fn wr_dp_begin(state: &mut WrState,
|
||||
width: u32,
|
||||
height: u32) {
|
||||
assert!(unsafe { is_in_main_thread() });
|
||||
state.frame_builder.dl_builder.list.clear();
|
||||
state.frame_builder.dl_builder.data.clear();
|
||||
|
||||
let bounds = LayoutRect::new(LayoutPoint::new(0.0, 0.0),
|
||||
LayoutSize::new(width as f32, height as f32));
|
||||
@ -1220,20 +1209,20 @@ pub extern "C" fn wr_dp_end(state: &mut WrState) {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_new_clip_region(state: &mut WrState,
|
||||
main: WrRect,
|
||||
complex: *const WrComplexClipRegion,
|
||||
complex_count: usize,
|
||||
image_mask: *const WrImageMask)
|
||||
-> WrClipRegion {
|
||||
pub extern "C" fn wr_dp_push_clip_region(state: &mut WrState,
|
||||
main: WrRect,
|
||||
complex: *const WrComplexClipRegion,
|
||||
complex_count: usize,
|
||||
image_mask: *const WrImageMask)
|
||||
-> WrClipRegionToken {
|
||||
assert!(unsafe { is_in_main_thread() });
|
||||
|
||||
let main = main.into();
|
||||
let complex_slice = make_slice(complex, complex_count);
|
||||
let complex_vector = complex_slice.iter().map(|x| x.into()).collect();
|
||||
let complex_iter = complex_slice.iter().map(|x| x.into());
|
||||
let mask = unsafe { image_mask.as_ref() }.map(|x| x.into());
|
||||
|
||||
let clip_region = state.frame_builder.dl_builder.new_clip_region(&main, complex_vector, mask);
|
||||
let clip_region = state.frame_builder.dl_builder.push_clip_region(&main, complex_iter, mask);
|
||||
|
||||
clip_region.into()
|
||||
}
|
||||
@ -1290,8 +1279,8 @@ pub extern "C" fn wr_dp_push_scroll_layer(state: &mut WrState,
|
||||
let content_rect = content_rect.into();
|
||||
let clip_rect = clip_rect.into();
|
||||
let mask = unsafe { mask.as_ref() }.map(|x| x.into());
|
||||
let clip_region = state.frame_builder.dl_builder.new_clip_region(&clip_rect, vec![], mask);
|
||||
state.frame_builder.dl_builder.push_clip_node(clip_region, content_rect, None);
|
||||
let clip_region = state.frame_builder.dl_builder.push_clip_region(&clip_rect, vec![], mask);
|
||||
state.frame_builder.dl_builder.push_clip_node(content_rect, clip_region, None);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
@ -1303,7 +1292,7 @@ pub extern "C" fn wr_dp_pop_scroll_layer(state: &mut WrState) {
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_iframe(state: &mut WrState,
|
||||
rect: WrRect,
|
||||
clip: WrClipRegion,
|
||||
clip: WrClipRegionToken,
|
||||
pipeline_id: WrPipelineId) {
|
||||
assert!(unsafe { is_in_main_thread() });
|
||||
|
||||
@ -1313,7 +1302,7 @@ pub extern "C" fn wr_dp_push_iframe(state: &mut WrState,
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_rect(state: &mut WrState,
|
||||
rect: WrRect,
|
||||
clip: WrClipRegion,
|
||||
clip: WrClipRegionToken,
|
||||
color: WrColor) {
|
||||
assert!(unsafe { is_in_main_thread() });
|
||||
|
||||
@ -1323,7 +1312,7 @@ pub extern "C" fn wr_dp_push_rect(state: &mut WrState,
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_image(state: &mut WrState,
|
||||
bounds: WrRect,
|
||||
clip: WrClipRegion,
|
||||
clip: WrClipRegionToken,
|
||||
stretch_size: WrSize,
|
||||
tile_spacing: WrSize,
|
||||
image_rendering: WrImageRendering,
|
||||
@ -1344,7 +1333,7 @@ pub extern "C" fn wr_dp_push_image(state: &mut WrState,
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_yuv_planar_image(state: &mut WrState,
|
||||
bounds: WrRect,
|
||||
clip: WrClipRegion,
|
||||
clip: WrClipRegionToken,
|
||||
image_key_0: WrImageKey,
|
||||
image_key_1: WrImageKey,
|
||||
image_key_2: WrImageKey,
|
||||
@ -1363,7 +1352,7 @@ pub extern "C" fn wr_dp_push_yuv_planar_image(state: &mut WrState,
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_yuv_NV12_image(state: &mut WrState,
|
||||
bounds: WrRect,
|
||||
clip: WrClipRegion,
|
||||
clip: WrClipRegionToken,
|
||||
image_key_0: WrImageKey,
|
||||
image_key_1: WrImageKey,
|
||||
color_space: WrYuvColorSpace) {
|
||||
@ -1380,7 +1369,7 @@ pub extern "C" fn wr_dp_push_yuv_NV12_image(state: &mut WrState,
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_text(state: &mut WrState,
|
||||
bounds: WrRect,
|
||||
clip: WrClipRegion,
|
||||
clip: WrClipRegionToken,
|
||||
color: WrColor,
|
||||
font_key: WrFontKey,
|
||||
glyphs: *const WrGlyphInstance,
|
||||
@ -1409,7 +1398,7 @@ pub extern "C" fn wr_dp_push_text(state: &mut WrState,
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_border(state: &mut WrState,
|
||||
rect: WrRect,
|
||||
clip: WrClipRegion,
|
||||
clip: WrClipRegionToken,
|
||||
widths: WrBorderWidths,
|
||||
top: WrBorderSide,
|
||||
right: WrBorderSide,
|
||||
@ -1433,7 +1422,7 @@ pub extern "C" fn wr_dp_push_border(state: &mut WrState,
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_border_image(state: &mut WrState,
|
||||
rect: WrRect,
|
||||
clip: WrClipRegion,
|
||||
clip: WrClipRegionToken,
|
||||
widths: WrBorderWidths,
|
||||
image: WrImageKey,
|
||||
patch: WrNinePatchDescriptor,
|
||||
@ -1457,7 +1446,7 @@ pub extern "C" fn wr_dp_push_border_image(state: &mut WrState,
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_border_gradient(state: &mut WrState,
|
||||
rect: WrRect,
|
||||
clip: WrClipRegion,
|
||||
clip: WrClipRegionToken,
|
||||
widths: WrBorderWidths,
|
||||
start_point: WrPoint,
|
||||
end_point: WrPoint,
|
||||
@ -1488,7 +1477,7 @@ pub extern "C" fn wr_dp_push_border_gradient(state: &mut WrState,
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_border_radial_gradient(state: &mut WrState,
|
||||
rect: WrRect,
|
||||
clip: WrClipRegion,
|
||||
clip: WrClipRegionToken,
|
||||
widths: WrBorderWidths,
|
||||
center: WrPoint,
|
||||
radius: WrSize,
|
||||
@ -1520,7 +1509,7 @@ pub extern "C" fn wr_dp_push_border_radial_gradient(state: &mut WrState,
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_linear_gradient(state: &mut WrState,
|
||||
rect: WrRect,
|
||||
clip: WrClipRegion,
|
||||
clip: WrClipRegionToken,
|
||||
start_point: WrPoint,
|
||||
end_point: WrPoint,
|
||||
stops: *const WrGradientStop,
|
||||
@ -1550,7 +1539,7 @@ pub extern "C" fn wr_dp_push_linear_gradient(state: &mut WrState,
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_radial_gradient(state: &mut WrState,
|
||||
rect: WrRect,
|
||||
clip: WrClipRegion,
|
||||
clip: WrClipRegionToken,
|
||||
center: WrPoint,
|
||||
radius: WrSize,
|
||||
stops: *const WrGradientStop,
|
||||
@ -1580,7 +1569,7 @@ pub extern "C" fn wr_dp_push_radial_gradient(state: &mut WrState,
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_box_shadow(state: &mut WrState,
|
||||
rect: WrRect,
|
||||
clip: WrClipRegion,
|
||||
clip: WrClipRegionToken,
|
||||
box_bounds: WrRect,
|
||||
offset: WrPoint,
|
||||
color: WrColor,
|
||||
@ -1606,34 +1595,24 @@ pub extern "C" fn wr_dp_push_box_shadow(state: &mut WrState,
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wr_api_finalize_builder(state: &mut WrState,
|
||||
dl_descriptor: &mut WrBuiltDisplayListDescriptor,
|
||||
dl_data: &mut WrVecU8,
|
||||
aux_descriptor: &mut WrAuxiliaryListsDescriptor,
|
||||
aux_data: &mut WrVecU8) {
|
||||
dl_data: &mut WrVecU8) {
|
||||
let frame_builder = mem::replace(&mut state.frame_builder,
|
||||
WebRenderFrameBuilder::new(state.pipeline_id));
|
||||
let (_, dl, aux) = frame_builder.dl_builder.finalize();
|
||||
let (_, dl) = frame_builder.dl_builder.finalize();
|
||||
let (data, descriptor) = dl.into_data();
|
||||
*dl_data = WrVecU8::from_vec(data);
|
||||
*dl_descriptor = descriptor;
|
||||
|
||||
let (data, descriptor) = aux.into_data();
|
||||
*aux_data = WrVecU8::from_vec(data);
|
||||
*aux_descriptor = descriptor;
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wr_dp_push_built_display_list(state: &mut WrState,
|
||||
dl_descriptor: WrBuiltDisplayListDescriptor,
|
||||
dl_data: WrVecU8,
|
||||
aux_descriptor: WrAuxiliaryListsDescriptor,
|
||||
aux_data: WrVecU8) {
|
||||
dl_data: WrVecU8) {
|
||||
let dl_vec = dl_data.to_vec();
|
||||
let aux_vec = aux_data.to_vec();
|
||||
|
||||
let dl = BuiltDisplayList::from_data(dl_vec, dl_descriptor);
|
||||
let aux = AuxiliaryLists::from_data(aux_vec, aux_descriptor);
|
||||
|
||||
state.frame_builder.dl_builder.push_built_display_list(dl, aux);
|
||||
state.frame_builder.dl_builder.push_built_display_list(dl);
|
||||
}
|
||||
|
||||
struct Moz2dImageRenderer {
|
||||
|
@ -258,73 +258,11 @@ struct WrRect {
|
||||
}
|
||||
};
|
||||
|
||||
struct WrItemRange {
|
||||
size_t start;
|
||||
size_t length;
|
||||
struct WrClipRegionToken {
|
||||
bool _dummy;
|
||||
|
||||
bool operator==(const WrItemRange& aOther) const {
|
||||
return start == aOther.start &&
|
||||
length == aOther.length;
|
||||
}
|
||||
};
|
||||
|
||||
struct WrImageMask {
|
||||
WrImageKey image;
|
||||
WrRect rect;
|
||||
bool repeat;
|
||||
|
||||
bool operator==(const WrImageMask& aOther) const {
|
||||
return image == aOther.image &&
|
||||
rect == aOther.rect &&
|
||||
repeat == aOther.repeat;
|
||||
}
|
||||
};
|
||||
|
||||
struct WrClipRegion {
|
||||
WrRect main;
|
||||
WrItemRange complex;
|
||||
WrImageMask image_mask;
|
||||
bool has_image_mask;
|
||||
|
||||
bool operator==(const WrClipRegion& aOther) const {
|
||||
return main == aOther.main &&
|
||||
complex == aOther.complex &&
|
||||
image_mask == aOther.image_mask &&
|
||||
has_image_mask == aOther.has_image_mask;
|
||||
}
|
||||
};
|
||||
|
||||
struct WrSize {
|
||||
float width;
|
||||
float height;
|
||||
|
||||
bool operator==(const WrSize& aOther) const {
|
||||
return width == aOther.width &&
|
||||
height == aOther.height;
|
||||
}
|
||||
};
|
||||
|
||||
struct WrBorderRadius {
|
||||
WrSize top_left;
|
||||
WrSize top_right;
|
||||
WrSize bottom_left;
|
||||
WrSize bottom_right;
|
||||
|
||||
bool operator==(const WrBorderRadius& aOther) const {
|
||||
return top_left == aOther.top_left &&
|
||||
top_right == aOther.top_right &&
|
||||
bottom_left == aOther.bottom_left &&
|
||||
bottom_right == aOther.bottom_right;
|
||||
}
|
||||
};
|
||||
|
||||
struct WrComplexClipRegion {
|
||||
WrRect rect;
|
||||
WrBorderRadius radii;
|
||||
|
||||
bool operator==(const WrComplexClipRegion& aOther) const {
|
||||
return rect == aOther.rect &&
|
||||
radii == aOther.radii;
|
||||
bool operator==(const WrClipRegionToken& aOther) const {
|
||||
return _dummy == aOther._dummy;
|
||||
}
|
||||
};
|
||||
|
||||
@ -366,6 +304,30 @@ struct WrBorderSide {
|
||||
}
|
||||
};
|
||||
|
||||
struct WrSize {
|
||||
float width;
|
||||
float height;
|
||||
|
||||
bool operator==(const WrSize& aOther) const {
|
||||
return width == aOther.width &&
|
||||
height == aOther.height;
|
||||
}
|
||||
};
|
||||
|
||||
struct WrBorderRadius {
|
||||
WrSize top_left;
|
||||
WrSize top_right;
|
||||
WrSize bottom_left;
|
||||
WrSize bottom_right;
|
||||
|
||||
bool operator==(const WrBorderRadius& aOther) const {
|
||||
return top_left == aOther.top_left &&
|
||||
top_right == aOther.top_right &&
|
||||
bottom_left == aOther.bottom_left &&
|
||||
bottom_right == aOther.bottom_right;
|
||||
}
|
||||
};
|
||||
|
||||
struct WrPoint {
|
||||
float x;
|
||||
float y;
|
||||
@ -426,6 +388,28 @@ struct WrNinePatchDescriptor {
|
||||
}
|
||||
};
|
||||
|
||||
struct WrComplexClipRegion {
|
||||
WrRect rect;
|
||||
WrBorderRadius radii;
|
||||
|
||||
bool operator==(const WrComplexClipRegion& aOther) const {
|
||||
return rect == aOther.rect &&
|
||||
radii == aOther.radii;
|
||||
}
|
||||
};
|
||||
|
||||
struct WrImageMask {
|
||||
WrImageKey image;
|
||||
WrRect rect;
|
||||
bool repeat;
|
||||
|
||||
bool operator==(const WrImageMask& aOther) const {
|
||||
return image == aOther.image &&
|
||||
rect == aOther.rect &&
|
||||
repeat == aOther.repeat;
|
||||
}
|
||||
};
|
||||
|
||||
struct WrGlyphInstance {
|
||||
uint32_t index;
|
||||
WrPoint point;
|
||||
@ -565,9 +549,7 @@ WR_FUNC;
|
||||
WR_INLINE
|
||||
void wr_api_finalize_builder(WrState* aState,
|
||||
WrBuiltDisplayListDescriptor* aDlDescriptor,
|
||||
WrVecU8* aDlData,
|
||||
WrAuxiliaryListsDescriptor* aAuxDescriptor,
|
||||
WrVecU8* aAuxData)
|
||||
WrVecU8* aDlData)
|
||||
WR_FUNC;
|
||||
|
||||
WR_INLINE
|
||||
@ -599,10 +581,7 @@ void wr_api_set_root_display_list(WrAPI* aApi,
|
||||
WrPipelineId aPipelineId,
|
||||
WrBuiltDisplayListDescriptor aDlDescriptor,
|
||||
uint8_t* aDlData,
|
||||
size_t aDlSize,
|
||||
WrAuxiliaryListsDescriptor aAuxDescriptor,
|
||||
uint8_t* aAuxData,
|
||||
size_t aAuxSize)
|
||||
size_t aDlSize)
|
||||
WR_FUNC;
|
||||
|
||||
WR_INLINE
|
||||
@ -633,14 +612,6 @@ WR_INLINE
|
||||
void wr_dp_end(WrState* aState)
|
||||
WR_FUNC;
|
||||
|
||||
WR_INLINE
|
||||
WrClipRegion wr_dp_new_clip_region(WrState* aState,
|
||||
WrRect aMain,
|
||||
const WrComplexClipRegion* aComplex,
|
||||
size_t aComplexCount,
|
||||
const WrImageMask* aImageMask)
|
||||
WR_FUNC;
|
||||
|
||||
WR_INLINE
|
||||
void wr_dp_pop_scroll_layer(WrState* aState)
|
||||
WR_FUNC;
|
||||
@ -652,7 +623,7 @@ WR_FUNC;
|
||||
WR_INLINE
|
||||
void wr_dp_push_border(WrState* aState,
|
||||
WrRect aRect,
|
||||
WrClipRegion aClip,
|
||||
WrClipRegionToken aClip,
|
||||
WrBorderWidths aWidths,
|
||||
WrBorderSide aTop,
|
||||
WrBorderSide aRight,
|
||||
@ -664,7 +635,7 @@ WR_FUNC;
|
||||
WR_INLINE
|
||||
void wr_dp_push_border_gradient(WrState* aState,
|
||||
WrRect aRect,
|
||||
WrClipRegion aClip,
|
||||
WrClipRegionToken aClip,
|
||||
WrBorderWidths aWidths,
|
||||
WrPoint aStartPoint,
|
||||
WrPoint aEndPoint,
|
||||
@ -677,7 +648,7 @@ WR_FUNC;
|
||||
WR_INLINE
|
||||
void wr_dp_push_border_image(WrState* aState,
|
||||
WrRect aRect,
|
||||
WrClipRegion aClip,
|
||||
WrClipRegionToken aClip,
|
||||
WrBorderWidths aWidths,
|
||||
WrImageKey aImage,
|
||||
WrNinePatchDescriptor aPatch,
|
||||
@ -689,7 +660,7 @@ WR_FUNC;
|
||||
WR_INLINE
|
||||
void wr_dp_push_border_radial_gradient(WrState* aState,
|
||||
WrRect aRect,
|
||||
WrClipRegion aClip,
|
||||
WrClipRegionToken aClip,
|
||||
WrBorderWidths aWidths,
|
||||
WrPoint aCenter,
|
||||
WrSize aRadius,
|
||||
@ -702,7 +673,7 @@ WR_FUNC;
|
||||
WR_INLINE
|
||||
void wr_dp_push_box_shadow(WrState* aState,
|
||||
WrRect aRect,
|
||||
WrClipRegion aClip,
|
||||
WrClipRegionToken aClip,
|
||||
WrRect aBoxBounds,
|
||||
WrPoint aOffset,
|
||||
WrColor aColor,
|
||||
@ -715,22 +686,28 @@ WR_FUNC;
|
||||
WR_INLINE
|
||||
void wr_dp_push_built_display_list(WrState* aState,
|
||||
WrBuiltDisplayListDescriptor aDlDescriptor,
|
||||
WrVecU8 aDlData,
|
||||
WrAuxiliaryListsDescriptor aAuxDescriptor,
|
||||
WrVecU8 aAuxData)
|
||||
WrVecU8 aDlData)
|
||||
WR_FUNC;
|
||||
|
||||
WR_INLINE
|
||||
WrClipRegionToken wr_dp_push_clip_region(WrState* aState,
|
||||
WrRect aMain,
|
||||
const WrComplexClipRegion* aComplex,
|
||||
size_t aComplexCount,
|
||||
const WrImageMask* aImageMask)
|
||||
WR_FUNC;
|
||||
|
||||
WR_INLINE
|
||||
void wr_dp_push_iframe(WrState* aState,
|
||||
WrRect aRect,
|
||||
WrClipRegion aClip,
|
||||
WrClipRegionToken aClip,
|
||||
WrPipelineId aPipelineId)
|
||||
WR_FUNC;
|
||||
|
||||
WR_INLINE
|
||||
void wr_dp_push_image(WrState* aState,
|
||||
WrRect aBounds,
|
||||
WrClipRegion aClip,
|
||||
WrClipRegionToken aClip,
|
||||
WrSize aStretchSize,
|
||||
WrSize aTileSpacing,
|
||||
WrImageRendering aImageRendering,
|
||||
@ -740,7 +717,7 @@ WR_FUNC;
|
||||
WR_INLINE
|
||||
void wr_dp_push_linear_gradient(WrState* aState,
|
||||
WrRect aRect,
|
||||
WrClipRegion aClip,
|
||||
WrClipRegionToken aClip,
|
||||
WrPoint aStartPoint,
|
||||
WrPoint aEndPoint,
|
||||
const WrGradientStop* aStops,
|
||||
@ -753,7 +730,7 @@ WR_FUNC;
|
||||
WR_INLINE
|
||||
void wr_dp_push_radial_gradient(WrState* aState,
|
||||
WrRect aRect,
|
||||
WrClipRegion aClip,
|
||||
WrClipRegionToken aClip,
|
||||
WrPoint aCenter,
|
||||
WrSize aRadius,
|
||||
const WrGradientStop* aStops,
|
||||
@ -766,7 +743,7 @@ WR_FUNC;
|
||||
WR_INLINE
|
||||
void wr_dp_push_rect(WrState* aState,
|
||||
WrRect aRect,
|
||||
WrClipRegion aClip,
|
||||
WrClipRegionToken aClip,
|
||||
WrColor aColor)
|
||||
WR_FUNC;
|
||||
|
||||
@ -789,7 +766,7 @@ WR_FUNC;
|
||||
WR_INLINE
|
||||
void wr_dp_push_text(WrState* aState,
|
||||
WrRect aBounds,
|
||||
WrClipRegion aClip,
|
||||
WrClipRegionToken aClip,
|
||||
WrColor aColor,
|
||||
WrFontKey aFontKey,
|
||||
const WrGlyphInstance* aGlyphs,
|
||||
@ -800,7 +777,7 @@ WR_FUNC;
|
||||
WR_INLINE
|
||||
void wr_dp_push_yuv_NV12_image(WrState* aState,
|
||||
WrRect aBounds,
|
||||
WrClipRegion aClip,
|
||||
WrClipRegionToken aClip,
|
||||
WrImageKey aImageKey0,
|
||||
WrImageKey aImageKey1,
|
||||
WrYuvColorSpace aColorSpace)
|
||||
@ -809,7 +786,7 @@ WR_FUNC;
|
||||
WR_INLINE
|
||||
void wr_dp_push_yuv_planar_image(WrState* aState,
|
||||
WrRect aBounds,
|
||||
WrClipRegion aClip,
|
||||
WrClipRegionToken aClip,
|
||||
WrImageKey aImageKey0,
|
||||
WrImageKey aImageKey1,
|
||||
WrImageKey aImageKey2,
|
||||
|
@ -468,7 +468,7 @@ BulletRenderer::CreateWebRenderCommandsForImage(nsDisplayItem* aItem,
|
||||
LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits(mDest, appUnitsPerDevPixel);
|
||||
WrRect dest = aSc.ToRelativeWrRectRounded(destRect);
|
||||
|
||||
WrClipRegion clipRegion = aBuilder.BuildClipRegion(dest);
|
||||
WrClipRegionToken clipRegion = aBuilder.PushClipRegion(dest);
|
||||
|
||||
aBuilder.PushImage(dest,
|
||||
clipRegion,
|
||||
|
@ -319,7 +319,7 @@ nsDisplayCanvasBackgroundColor::CreateWebRenderCommands(mozilla::wr::DisplayList
|
||||
|
||||
WrRect transformedRect = aSc.ToRelativeWrRect(rect);
|
||||
aBuilder.PushRect(transformedRect,
|
||||
aBuilder.BuildClipRegion(transformedRect),
|
||||
aBuilder.PushClipRegion(transformedRect),
|
||||
wr::ToWrColor(ToDeviceColor(mColor)));
|
||||
}
|
||||
|
||||
|
@ -3562,7 +3562,7 @@ nsCSSBorderRenderer::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder,
|
||||
side[i] = wr::ToWrBorderSide(ToDeviceColor(mBorderColors[i]), mBorderStyles[i]);
|
||||
}
|
||||
|
||||
WrClipRegion clipRegion = aBuilder.BuildClipRegion(transformedRect);
|
||||
WrClipRegionToken clipRegion = aBuilder.PushClipRegion(transformedRect);
|
||||
WrBorderRadius borderRadius = wr::ToWrBorderRadius(LayerSize(mBorderRadii[0].width, mBorderRadii[0].height),
|
||||
LayerSize(mBorderRadii[1].width, mBorderRadii[1].height),
|
||||
LayerSize(mBorderRadii[3].width, mBorderRadii[3].height),
|
||||
|
@ -1087,7 +1087,7 @@ nsCSSGradientRenderer::BuildWebRenderDisplayItems(wr::DisplayListBuilder& aBuild
|
||||
|
||||
aBuilder.PushLinearGradient(
|
||||
wrGradientBounds,
|
||||
aBuilder.BuildClipRegion(wrClipBounds),
|
||||
aBuilder.PushClipRegion(wrClipBounds),
|
||||
mozilla::wr::ToWrPoint(lineStart),
|
||||
mozilla::wr::ToWrPoint(lineEnd),
|
||||
stops,
|
||||
@ -1100,7 +1100,7 @@ nsCSSGradientRenderer::BuildWebRenderDisplayItems(wr::DisplayListBuilder& aBuild
|
||||
|
||||
aBuilder.PushRadialGradient(
|
||||
wrGradientBounds,
|
||||
aBuilder.BuildClipRegion(wrClipBounds),
|
||||
aBuilder.PushClipRegion(wrClipBounds),
|
||||
mozilla::wr::ToWrPoint(lineStart),
|
||||
mozilla::wr::ToWrSize(gradientRadius),
|
||||
stops,
|
||||
|
@ -4599,12 +4599,12 @@ nsDisplayCaret::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder,
|
||||
|
||||
// Note, WR will pixel snap anything that is layout aligned.
|
||||
aBuilder.PushRect(caret,
|
||||
aBuilder.BuildClipRegion(caret),
|
||||
aBuilder.PushClipRegion(caret),
|
||||
wr::ToWrColor(color));
|
||||
|
||||
if (!devHookRect.IsEmpty()) {
|
||||
aBuilder.PushRect(hook,
|
||||
aBuilder.BuildClipRegion(hook),
|
||||
aBuilder.PushClipRegion(hook),
|
||||
wr::ToWrColor(color));
|
||||
}
|
||||
}
|
||||
@ -4876,7 +4876,7 @@ nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuil
|
||||
}
|
||||
|
||||
aBuilder.PushBorderImage(dest,
|
||||
aBuilder.BuildClipRegion(clip),
|
||||
aBuilder.PushClipRegion(clip),
|
||||
wr::ToWrBorderWidths(widths[0], widths[1], widths[2], widths[3]),
|
||||
key.value(),
|
||||
wr::ToWrNinePatchDescriptor(
|
||||
@ -4909,7 +4909,7 @@ nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuil
|
||||
endPoint = endPoint + ViewAs<LayerPixel>(lineEnd, PixelCastJustification::WebRenderHasUnitResolution);
|
||||
|
||||
aBuilder.PushBorderGradient(dest,
|
||||
aBuilder.BuildClipRegion(clip),
|
||||
aBuilder.PushClipRegion(clip),
|
||||
wr::ToWrBorderWidths(widths[0], widths[1], widths[2], widths[3]),
|
||||
wr::ToWrPoint(startPoint),
|
||||
wr::ToWrPoint(endPoint),
|
||||
@ -4918,7 +4918,7 @@ nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuil
|
||||
wr::ToWrSideOffsets2Df32(outset[0], outset[1], outset[2], outset[3]));
|
||||
} else {
|
||||
aBuilder.PushBorderRadialGradient(dest,
|
||||
aBuilder.BuildClipRegion(clip),
|
||||
aBuilder.PushClipRegion(clip),
|
||||
wr::ToWrBorderWidths(widths[0], widths[1], widths[2], widths[3]),
|
||||
wr::ToWrPoint(lineStart),
|
||||
wr::ToWrSize(gradientRadius),
|
||||
@ -5266,17 +5266,17 @@ nsDisplayBoxShadowOuter::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilde
|
||||
nsTArray<WrComplexClipRegion> clips;
|
||||
clips.AppendElement(roundedRect);
|
||||
aBuilder.PushRect(deviceBoxRect,
|
||||
aBuilder.BuildClipRegion(deviceClipRect,
|
||||
aBuilder.PushClipRegion(deviceClipRect,
|
||||
clips),
|
||||
wr::ToWrColor(shadowColor));
|
||||
} else {
|
||||
aBuilder.PushRect(deviceBoxRect,
|
||||
aBuilder.BuildClipRegion(deviceClipRect),
|
||||
aBuilder.PushClipRegion(deviceClipRect),
|
||||
wr::ToWrColor(shadowColor));
|
||||
}
|
||||
} else {
|
||||
aBuilder.PushBoxShadow(deviceBoxRect,
|
||||
aBuilder.BuildClipRegion(deviceClipRect),
|
||||
aBuilder.PushClipRegion(deviceClipRect),
|
||||
deviceBoxRect,
|
||||
wr::ToWrPoint(shadowOffset),
|
||||
wr::ToWrColor(shadowColor),
|
||||
@ -5447,7 +5447,7 @@ nsDisplayBoxShadowInner::CreateInsetBoxShadowWebRenderCommands(mozilla::wr::Disp
|
||||
float spreadRadius = float(shadowItem->mSpread) / float(appUnitsPerDevPixel);
|
||||
|
||||
aBuilder.PushBoxShadow(wr::ToWrRect(deviceBoxRect),
|
||||
aBuilder.BuildClipRegion(deviceClipRect),
|
||||
aBuilder.PushClipRegion(deviceClipRect),
|
||||
wr::ToWrRect(deviceBoxRect),
|
||||
wr::ToWrPoint(shadowOffset),
|
||||
wr::ToWrColor(shadowColor),
|
||||
|
@ -639,7 +639,7 @@ nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
|
||||
|
||||
LayoutDeviceSize gapSize = LayoutDeviceSize::FromAppUnits(
|
||||
aRepeatSize - aDest.Size(), appUnitsPerDevPixel);
|
||||
aBuilder.PushImage(fill, aBuilder.BuildClipRegion(clip),
|
||||
aBuilder.PushImage(fill, aBuilder.PushClipRegion(clip),
|
||||
wr::ToWrSize(destRect.Size()), wr::ToWrSize(gapSize),
|
||||
wr::ImageRendering::Auto, key.value());
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user