Bug 1376215 - Stop exposing the WrClipRegionToken in WebRenderAPI.h APIs. r=jrmuizel

No functional changes intended in this patch. It merely simplifies the
additional patch that we'll need to update gecko past WR cset 0bf6655,
and saves some potential manual rebasing work.

MozReview-Commit-ID: Km8dBotP3NQ

--HG--
extra : rebase_source : 77c34ec1cbbc1c0fe4d1971feb131d30c97f0d66
This commit is contained in:
Kartikaya Gupta 2017-06-26 07:49:52 -04:00
parent a405e81d94
commit 34903d0ba6
29 changed files with 110 additions and 141 deletions

View File

@ -134,7 +134,7 @@ GPUVideoTextureHost::AddWRImage(wr::WebRenderAPI* aAPI,
void
GPUVideoTextureHost::PushExternalImage(wr::DisplayListBuilder& aBuilder,
const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{

View File

@ -57,7 +57,7 @@ public:
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;

View File

@ -625,7 +625,7 @@ BufferTextureHost::AddWRImage(wr::WebRenderAPI* aAPI,
void
BufferTextureHost::PushExternalImage(wr::DisplayListBuilder& aBuilder,
const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{

View File

@ -644,7 +644,7 @@ public:
// Put all necessary WR commands into DisplayListBuilder for this textureHost rendering.
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aKeys)
{
@ -750,7 +750,7 @@ public:
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;

View File

@ -918,7 +918,7 @@ DXGITextureHostD3D11::AddWRImage(wr::WebRenderAPI* aAPI,
void
DXGITextureHostD3D11::PushExternalImage(wr::DisplayListBuilder& aBuilder,
const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{
@ -1085,7 +1085,7 @@ DXGIYCbCrTextureHostD3D11::AddWRImage(wr::WebRenderAPI* aAPI,
void
DXGIYCbCrTextureHostD3D11::PushExternalImage(wr::DisplayListBuilder& aBuilder,
const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{

View File

@ -335,7 +335,7 @@ public:
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;
@ -396,7 +396,7 @@ public:
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;

View File

@ -225,7 +225,7 @@ MacIOSurfaceTextureHostOGL::AddWRImage(wr::WebRenderAPI* aAPI,
void
MacIOSurfaceTextureHostOGL::PushExternalImage(wr::DisplayListBuilder& aBuilder,
const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{

View File

@ -73,7 +73,7 @@ public:
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;

View File

@ -217,9 +217,8 @@ WebRenderBridgeChild::PushGlyphs(wr::DisplayListBuilder& aBuilder, const nsTArra
LayerPoint::FromUnknownPoint(glyphs[j].mPosition));
}
WrClipRegionToken clipRegion = aBuilder.PushClipRegion(aSc.ToRelativeWrRect(aClip));
aBuilder.PushText(aSc.ToRelativeWrRect(aBounds),
clipRegion,
aSc.ToRelativeWrRect(aClip),
glyph_array.color().value(),
key,
Range<const WrGlyphInstance>(wr_glyph_instances.Elements(), wr_glyph_instances.Length()),

View File

@ -69,8 +69,6 @@ WebRenderCanvasLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
LayerRect rect(0, 0, mBounds.width, mBounds.height);
DumpLayerInfo("CanvasLayer", rect);
WrClipRegionToken clip = aBuilder.PushClipRegion(sc.ToRelativeWrRect(rect));
wr::ImageRendering filter = wr::ToImageRendering(mSamplingFilter);
if (gfxPrefs::LayersDump()) {
@ -83,7 +81,8 @@ WebRenderCanvasLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(mExternalImageId.value(), key));
WrManager()->AddImageKeyForDiscard(key);
aBuilder.PushImage(sc.ToRelativeWrRect(rect), clip, filter, key);
WrRect r = sc.ToRelativeWrRect(rect);
aBuilder.PushImage(r, r, filter, key);
}
void

View File

@ -28,9 +28,8 @@ WebRenderColorLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
LayerRect rect = Bounds();
DumpLayerInfo("ColorLayer", rect);
WrClipRegionToken clip = aBuilder.PushClipRegion(sc.ToRelativeWrRect(rect));
aBuilder.PushRect(sc.ToRelativeWrRect(rect), clip, wr::ToWrColor(mColor));
WrRect r = sc.ToRelativeWrRect(rect);
aBuilder.PushRect(r, r, wr::ToWrColor(mColor));
}
} // namespace layers

View File

@ -279,22 +279,20 @@ WebRenderCompositableHolder::ApplyAsyncImages(wr::WebRenderAPI* aApi)
if (holder->mScaleToSize.isSome()) {
rect = LayerRect(0, 0, holder->mScaleToSize.value().width, holder->mScaleToSize.value().height);
}
WrClipRegionToken clip = builder.PushClipRegion(
wr::ToWrRect(rect), nullptr);
if (useExternalImage) {
MOZ_ASSERT(holder->mCurrentTexture->AsWebRenderTextureHost());
Range<const wr::ImageKey> range_keys(&keys[0], keys.Length());
holder->mCurrentTexture->PushExternalImage(builder,
wr::ToWrRect(rect),
clip,
wr::ToWrRect(rect),
holder->mFilter,
range_keys);
HoldExternalImage(pipelineId, epoch, holder->mCurrentTexture->AsWebRenderTextureHost());
} else {
MOZ_ASSERT(keys.Length() == 1);
builder.PushImage(wr::ToWrRect(rect),
clip,
wr::ToWrRect(rect),
holder->mFilter,
keys[0]);
}

View File

@ -150,8 +150,8 @@ WebRenderRefLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
PixelCastJustification::MovingDownToChildren);
DumpLayerInfo("RefLayer", rect);
WrClipRegionToken clipRegion = aBuilder.PushClipRegion(aSc.ToRelativeWrRect(rect));
aBuilder.PushIFrame(aSc.ToRelativeWrRect(rect), clipRegion, wr::AsPipelineId(mId));
WrRect r = aSc.ToRelativeWrRect(rect);
aBuilder.PushIFrame(r, r, wr::AsPipelineId(mId));
}
} // namespace layers

View File

@ -139,13 +139,12 @@ WebRenderDisplayItemLayer::PushItemAsBlobImage(wr::DisplayListBuilder& aBuilder,
wr::ByteBuffer bytes(recorder->mOutputStream.mLength, (uint8_t*)recorder->mOutputStream.mData);
WrRect dest = aSc.ToRelativeWrRect(imageRect + offset);
WrClipRegionToken clipRegion = aBuilder.PushClipRegion(dest);
WrImageKey key = GetImageKey();
WrBridge()->SendAddBlobImage(key, imageSize.ToUnknownSize(), imageSize.width * 4, dt->GetFormat(), bytes);
WrManager()->AddImageKeyForDiscard(key);
aBuilder.PushImage(dest,
clipRegion,
dest,
wr::ImageRendering::Auto,
key);
return true;

View File

@ -159,8 +159,8 @@ WebRenderImageLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
PixelCastJustification::MovingDownToChildren);
DumpLayerInfo("Image Layer async", rect);
WrClipRegionToken clipRegion = aBuilder.PushClipRegion(aSc.ToRelativeWrRect(rect));
aBuilder.PushIFrame(aSc.ToRelativeWrRect(rect), clipRegion, mPipelineId.ref());
WrRect r = aSc.ToRelativeWrRect(rect);
aBuilder.PushIFrame(r, r, mPipelineId.ref());
gfx::Matrix4x4 scTransform = GetTransform();
// Translate is applied as part of PushIFrame()
@ -215,8 +215,6 @@ WebRenderImageLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
rect = LayerRect(0, 0, mScaleToSize.width, mScaleToSize.height);
}
WrClipRegionToken clip = aBuilder.PushClipRegion(
sc.ToRelativeWrRect(rect));
wr::ImageRendering filter = wr::ToImageRendering(mSamplingFilter);
DumpLayerInfo("Image Layer", rect);
@ -225,7 +223,8 @@ WebRenderImageLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
GetLayer(),
Stringify(filter).c_str());
}
aBuilder.PushImage(sc.ToRelativeWrRect(rect), clip, filter, mKey.value());
WrRect r = sc.ToRelativeWrRect(rect);
aBuilder.PushImage(r, r, filter, mKey.value());
}
Maybe<WrImageMask>

View File

@ -100,13 +100,12 @@ WebRenderPaintedLayer::CreateWebRenderDisplayList(wr::DisplayListBuilder& aBuild
LayerRect rect = Bounds();
DumpLayerInfo("PaintedLayer", rect);
WrClipRegionToken clip = aBuilder.PushClipRegion(sc.ToRelativeWrRect(rect));
WrImageKey key = GetImageKey();
WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(mExternalImageId.value(), key));
WrManager()->AddImageKeyForDiscard(key);
aBuilder.PushImage(sc.ToRelativeWrRect(rect), clip, wr::ImageRendering::Auto, key);
WrRect r = sc.ToRelativeWrRect(rect);
aBuilder.PushImage(r, r, wr::ImageRendering::Auto, key);
}
void

View File

@ -89,9 +89,8 @@ WebRenderPaintedLayerBlob::RenderLayer(wr::DisplayListBuilder& aBuilder,
LayerRect rect = Bounds();
DumpLayerInfo("PaintedLayer", rect);
WrClipRegionToken clip = aBuilder.PushClipRegion(sc.ToRelativeWrRect(rect));
aBuilder.PushImage(sc.ToRelativeWrRect(rect), clip, wr::ImageRendering::Auto, mImageKey.value());
WrRect r = sc.ToRelativeWrRect(rect);
aBuilder.PushImage(r, r, wr::ImageRendering::Auto, mImageKey.value());
}
} // namespace layers

View File

@ -179,7 +179,7 @@ WebRenderTextureHost::AddWRImage(wr::WebRenderAPI* aAPI,
void
WebRenderTextureHost::PushExternalImage(wr::DisplayListBuilder& aBuilder,
const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{

View File

@ -74,7 +74,7 @@ public:
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;

View File

@ -652,18 +652,20 @@ DisplayListBuilder::PopClipAndScrollInfo()
void
DisplayListBuilder::PushRect(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrColor& aColor)
{
WRDL_LOG("PushRect b=%s c=%s\n",
WRDL_LOG("PushRect b=%s cl=%s c=%s\n",
Stringify(aBounds).c_str(),
Stringify(aClip).c_str(),
Stringify(aColor).c_str());
wr_dp_push_rect(mWrState, aBounds, aClip, aColor);
WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
wr_dp_push_rect(mWrState, aBounds, tok, aColor);
}
void
DisplayListBuilder::PushLinearGradient(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrPoint& aStartPoint,
const WrPoint& aEndPoint,
const nsTArray<WrGradientStop>& aStops,
@ -671,8 +673,9 @@ DisplayListBuilder::PushLinearGradient(const WrRect& aBounds,
const WrSize aTileSize,
const WrSize aTileSpacing)
{
WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
wr_dp_push_linear_gradient(mWrState,
aBounds, aClip,
aBounds, tok,
aStartPoint, aEndPoint,
aStops.Elements(), aStops.Length(),
aExtendMode,
@ -681,7 +684,7 @@ DisplayListBuilder::PushLinearGradient(const WrRect& aBounds,
void
DisplayListBuilder::PushRadialGradient(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrPoint& aCenter,
const WrSize& aRadius,
const nsTArray<WrGradientStop>& aStops,
@ -689,8 +692,9 @@ DisplayListBuilder::PushRadialGradient(const WrRect& aBounds,
const WrSize aTileSize,
const WrSize aTileSpacing)
{
WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
wr_dp_push_radial_gradient(mWrState,
aBounds, aClip,
aBounds, tok,
aCenter, aRadius,
aStops.Elements(), aStops.Length(),
aExtendMode,
@ -699,7 +703,7 @@ DisplayListBuilder::PushRadialGradient(const WrRect& aBounds,
void
DisplayListBuilder::PushImage(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageRendering aFilter,
wr::ImageKey aImage)
{
@ -711,29 +715,32 @@ DisplayListBuilder::PushImage(const WrRect& aBounds,
void
DisplayListBuilder::PushImage(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrSize& aStretchSize,
const WrSize& aTileSpacing,
wr::ImageRendering aFilter,
wr::ImageKey aImage)
{
WRDL_LOG("PushImage b=%s s=%s t=%s\n", Stringify(aBounds).c_str(),
Stringify(aStretchSize).c_str(), Stringify(aTileSpacing).c_str());
wr_dp_push_image(mWrState, aBounds, aClip, aStretchSize, aTileSpacing, aFilter, aImage);
WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
WRDL_LOG("PushImage b=%s cl=%s s=%s t=%s\n", Stringify(aBounds).c_str(),
Stringify(aClip).c_str(), Stringify(aStretchSize).c_str(),
Stringify(aTileSpacing).c_str());
wr_dp_push_image(mWrState, aBounds, tok, aStretchSize, aTileSpacing, aFilter, aImage);
}
void
DisplayListBuilder::PushYCbCrPlanarImage(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageKey aImageChannel0,
wr::ImageKey aImageChannel1,
wr::ImageKey aImageChannel2,
WrYuvColorSpace aColorSpace,
wr::ImageRendering aRendering)
{
WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
wr_dp_push_yuv_planar_image(mWrState,
aBounds,
aClip,
tok,
aImageChannel0,
aImageChannel1,
aImageChannel2,
@ -743,15 +750,16 @@ DisplayListBuilder::PushYCbCrPlanarImage(const WrRect& aBounds,
void
DisplayListBuilder::PushNV12Image(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageKey aImageChannel0,
wr::ImageKey aImageChannel1,
WrYuvColorSpace aColorSpace,
wr::ImageRendering aRendering)
{
WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
wr_dp_push_yuv_NV12_image(mWrState,
aBounds,
aClip,
tok,
aImageChannel0,
aImageChannel1,
aColorSpace,
@ -760,14 +768,15 @@ DisplayListBuilder::PushNV12Image(const WrRect& aBounds,
void
DisplayListBuilder::PushYCbCrInterleavedImage(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageKey aImageChannel0,
WrYuvColorSpace aColorSpace,
wr::ImageRendering aRendering)
{
WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
wr_dp_push_yuv_interleaved_image(mWrState,
aBounds,
aClip,
tok,
aImageChannel0,
aColorSpace,
aRendering);
@ -775,15 +784,16 @@ DisplayListBuilder::PushYCbCrInterleavedImage(const WrRect& aBounds,
void
DisplayListBuilder::PushIFrame(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
PipelineId aPipeline)
{
wr_dp_push_iframe(mWrState, aBounds, aClip, aPipeline);
WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
wr_dp_push_iframe(mWrState, aBounds, tok, aPipeline);
}
void
DisplayListBuilder::PushBorder(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrBorderWidths& aWidths,
const WrBorderSide& aTop,
const WrBorderSide& aRight,
@ -791,13 +801,14 @@ DisplayListBuilder::PushBorder(const WrRect& aBounds,
const WrBorderSide& aLeft,
const WrBorderRadius& aRadius)
{
wr_dp_push_border(mWrState, aBounds, aClip,
WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
wr_dp_push_border(mWrState, aBounds, tok,
aWidths, aTop, aRight, aBottom, aLeft, aRadius);
}
void
DisplayListBuilder::PushBorderImage(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrBorderWidths& aWidths,
wr::ImageKey aImage,
const WrNinePatchDescriptor& aPatch,
@ -805,14 +816,15 @@ DisplayListBuilder::PushBorderImage(const WrRect& aBounds,
const WrRepeatMode& aRepeatHorizontal,
const WrRepeatMode& aRepeatVertical)
{
wr_dp_push_border_image(mWrState, aBounds, aClip,
WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
wr_dp_push_border_image(mWrState, aBounds, tok,
aWidths, aImage, aPatch, aOutset,
aRepeatHorizontal, aRepeatVertical);
}
void
DisplayListBuilder::PushBorderGradient(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrBorderWidths& aWidths,
const WrPoint& aStartPoint,
const WrPoint& aEndPoint,
@ -820,7 +832,8 @@ DisplayListBuilder::PushBorderGradient(const WrRect& aBounds,
wr::GradientExtendMode aExtendMode,
const WrSideOffsets2Df32& aOutset)
{
wr_dp_push_border_gradient(mWrState, aBounds, aClip,
WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
wr_dp_push_border_gradient(mWrState, aBounds, tok,
aWidths, aStartPoint, aEndPoint,
aStops.Elements(), aStops.Length(),
aExtendMode, aOutset);
@ -828,7 +841,7 @@ DisplayListBuilder::PushBorderGradient(const WrRect& aBounds,
void
DisplayListBuilder::PushBorderRadialGradient(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrBorderWidths& aWidths,
const WrPoint& aCenter,
const WrSize& aRadius,
@ -836,21 +849,23 @@ DisplayListBuilder::PushBorderRadialGradient(const WrRect& aBounds,
wr::GradientExtendMode aExtendMode,
const WrSideOffsets2Df32& aOutset)
{
WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
wr_dp_push_border_radial_gradient(
mWrState, aBounds, aClip, aWidths, aCenter,
mWrState, aBounds, tok, aWidths, aCenter,
aRadius, aStops.Elements(), aStops.Length(),
aExtendMode, aOutset);
}
void
DisplayListBuilder::PushText(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const gfx::Color& aColor,
wr::FontKey aFontKey,
Range<const WrGlyphInstance> aGlyphBuffer,
float aGlyphSize)
{
wr_dp_push_text(mWrState, aBounds, aClip,
WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
wr_dp_push_text(mWrState, aBounds, tok,
ToWrColor(aColor),
aFontKey,
&aGlyphBuffer[0], aGlyphBuffer.length(),
@ -859,7 +874,7 @@ DisplayListBuilder::PushText(const WrRect& aBounds,
void
DisplayListBuilder::PushBoxShadow(const WrRect& aRect,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrRect& aBoxBounds,
const WrPoint& aOffset,
const WrColor& aColor,
@ -868,38 +883,13 @@ DisplayListBuilder::PushBoxShadow(const WrRect& aRect,
const float& aBorderRadius,
const WrBoxShadowClipMode& aClipMode)
{
wr_dp_push_box_shadow(mWrState, aRect, aClip,
WrClipRegionToken tok = wr_dp_push_clip_region(mWrState, aClip, nullptr, 0, nullptr);
wr_dp_push_box_shadow(mWrState, aRect, tok,
aBoxBounds, aOffset, aColor,
aBlurRadius, aSpreadRadius, aBorderRadius,
aClipMode);
}
WrClipRegionToken
DisplayListBuilder::PushClipRegion(const WrRect& aMain,
const WrImageMask* aMask)
{
WRDL_LOG("PushClipRegion r=%s m=%p b=%s\n", Stringify(aMain).c_str(), aMask,
aMask ? Stringify(aMask->rect).c_str() : "none");
return wr_dp_push_clip_region(mWrState,
aMain,
nullptr, 0,
aMask);
}
WrClipRegionToken
DisplayListBuilder::PushClipRegion(const WrRect& aMain,
const nsTArray<WrComplexClipRegion>& aComplex,
const WrImageMask* aMask)
{
WRDL_LOG("PushClipRegion r=%s cl=%d m=%p b=%s\n", Stringify(aMain).c_str(),
(int)aComplex.Length(), aMask,
aMask ? Stringify(aMask->rect).c_str() : "none");
return wr_dp_push_clip_region(mWrState,
aMain,
aComplex.Elements(), aComplex.Length(),
aMask);
}
Maybe<WrClipId>
DisplayListBuilder::TopmostClipId()
{

View File

@ -174,11 +174,11 @@ public:
void PopClipAndScrollInfo();
void PushRect(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrColor& aColor);
void PushLinearGradient(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrPoint& aStartPoint,
const WrPoint& aEndPoint,
const nsTArray<WrGradientStop>& aStops,
@ -187,7 +187,7 @@ public:
const WrSize aTileSpacing);
void PushRadialGradient(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrPoint& aCenter,
const WrSize& aRadius,
const nsTArray<WrGradientStop>& aStops,
@ -196,19 +196,19 @@ public:
const WrSize aTileSpacing);
void PushImage(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageRendering aFilter,
wr::ImageKey aImage);
void PushImage(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrSize& aStretchSize,
const WrSize& aTileSpacing,
wr::ImageRendering aFilter,
wr::ImageKey aImage);
void PushYCbCrPlanarImage(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageKey aImageChannel0,
wr::ImageKey aImageChannel1,
wr::ImageKey aImageChannel2,
@ -216,24 +216,24 @@ public:
wr::ImageRendering aFilter);
void PushNV12Image(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageKey aImageChannel0,
wr::ImageKey aImageChannel1,
WrYuvColorSpace aColorSpace,
wr::ImageRendering aFilter);
void PushYCbCrInterleavedImage(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::ImageKey aImageChannel0,
WrYuvColorSpace aColorSpace,
wr::ImageRendering aFilter);
void PushIFrame(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
wr::PipelineId aPipeline);
void PushBorder(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrBorderWidths& aWidths,
const WrBorderSide& aTop,
const WrBorderSide& aRight,
@ -242,7 +242,7 @@ public:
const WrBorderRadius& aRadius);
void PushBorderImage(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrBorderWidths& aWidths,
wr::ImageKey aImage,
const WrNinePatchDescriptor& aPatch,
@ -251,7 +251,7 @@ public:
const WrRepeatMode& aRepeatVertical);
void PushBorderGradient(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrBorderWidths& aWidths,
const WrPoint& aStartPoint,
const WrPoint& aEndPoint,
@ -260,7 +260,7 @@ public:
const WrSideOffsets2Df32& aOutset);
void PushBorderRadialGradient(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrBorderWidths& aWidths,
const WrPoint& aCenter,
const WrSize& aRadius,
@ -269,14 +269,14 @@ public:
const WrSideOffsets2Df32& aOutset);
void PushText(const WrRect& aBounds,
const WrClipRegionToken aClip,
const WrRect& aClip,
const gfx::Color& aColor,
wr::FontKey aFontKey,
Range<const WrGlyphInstance> aGlyphBuffer,
float aGlyphSize);
void PushBoxShadow(const WrRect& aRect,
const WrClipRegionToken aClip,
const WrRect& aClip,
const WrRect& aBoxBounds,
const WrPoint& aOffset,
const WrColor& aColor,
@ -285,12 +285,6 @@ public:
const float& aBorderRadius,
const WrBoxShadowClipMode& aClipMode);
WrClipRegionToken PushClipRegion(const WrRect& aMain,
const WrImageMask* aMask = nullptr);
WrClipRegionToken PushClipRegion(const WrRect& aMain,
const nsTArray<WrComplexClipRegion>& aComplex,
const WrImageMask* aMask = nullptr);
// Returns the clip id that was most recently pushed with PushClip and that
// has not yet been popped with PopClip. Return Nothing() if the clip stack
// is empty.

View File

@ -466,10 +466,8 @@ BulletRenderer::CreateWebRenderCommandsForImage(nsDisplayItem* aItem,
LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits(mDest, appUnitsPerDevPixel);
WrRect dest = aSc.ToRelativeWrRectRounded(destRect);
WrClipRegionToken clipRegion = aBuilder.PushClipRegion(dest);
aBuilder.PushImage(dest,
clipRegion,
dest,
WrImageRendering::Auto,
key.value());
}

View File

@ -321,7 +321,7 @@ nsDisplayCanvasBackgroundColor::CreateWebRenderCommands(mozilla::wr::DisplayList
WrRect transformedRect = aSc.ToRelativeWrRect(rect);
aBuilder.PushRect(transformedRect,
aBuilder.PushClipRegion(transformedRect),
transformedRect,
wr::ToWrColor(ToDeviceColor(mColor)));
}

View File

@ -3561,13 +3561,12 @@ nsCSSBorderRenderer::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder,
side[i] = wr::ToWrBorderSide(ToDeviceColor(mBorderColors[i]), mBorderStyles[i]);
}
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),
LayerSize(mBorderRadii[2].width, mBorderRadii[2].height));
aBuilder.PushBorder(transformedRect,
clipRegion,
transformedRect,
wr::ToWrBorderWidths(mBorderWidths[0], mBorderWidths[1], mBorderWidths[2], mBorderWidths[3]),
side[0], side[1], side[2], side[3],
borderRadius);

View File

@ -1084,7 +1084,7 @@ nsCSSGradientRenderer::BuildWebRenderDisplayItems(wr::DisplayListBuilder& aBuild
aBuilder.PushLinearGradient(
wrGradientBounds,
aBuilder.PushClipRegion(wrClipBounds),
wrClipBounds,
mozilla::wr::ToWrPoint(lineStart),
mozilla::wr::ToWrPoint(lineEnd),
stops,
@ -1097,7 +1097,7 @@ nsCSSGradientRenderer::BuildWebRenderDisplayItems(wr::DisplayListBuilder& aBuild
aBuilder.PushRadialGradient(
wrGradientBounds,
aBuilder.PushClipRegion(wrClipBounds),
wrClipBounds,
mozilla::wr::ToWrPoint(lineStart),
mozilla::wr::ToWrSize(gradientRadius),
stops,

View File

@ -4618,12 +4618,12 @@ nsDisplayCaret::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder,
// Note, WR will pixel snap anything that is layout aligned.
aBuilder.PushRect(caret,
aBuilder.PushClipRegion(caret),
caret,
wr::ToWrColor(color));
if (!devHookRect.IsEmpty()) {
aBuilder.PushRect(hook,
aBuilder.PushClipRegion(hook),
hook,
wr::ToWrColor(color));
}
}
@ -4895,7 +4895,7 @@ nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuil
}
aBuilder.PushBorderImage(dest,
aBuilder.PushClipRegion(clip),
clip,
wr::ToWrBorderWidths(widths[0], widths[1], widths[2], widths[3]),
key.value(),
wr::ToWrNinePatchDescriptor(
@ -4928,7 +4928,7 @@ nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuil
endPoint = endPoint + ViewAs<LayerPixel>(lineEnd, PixelCastJustification::WebRenderHasUnitResolution);
aBuilder.PushBorderGradient(dest,
aBuilder.PushClipRegion(clip),
clip,
wr::ToWrBorderWidths(widths[0], widths[1], widths[2], widths[3]),
wr::ToWrPoint(startPoint),
wr::ToWrPoint(endPoint),
@ -4937,7 +4937,7 @@ nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuil
wr::ToWrSideOffsets2Df32(outset[0], outset[1], outset[2], outset[3]));
} else {
aBuilder.PushBorderRadialGradient(dest,
aBuilder.PushClipRegion(clip),
clip,
wr::ToWrBorderWidths(widths[0], widths[1], widths[2], widths[3]),
wr::ToWrPoint(lineStart),
wr::ToWrSize(gradientRadius),
@ -5264,7 +5264,7 @@ nsDisplayBoxShadowOuter::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilde
float spreadRadius = float(shadow->mSpread) / float(appUnitsPerDevPixel);
aBuilder.PushBoxShadow(deviceBoxRect,
aBuilder.PushClipRegion(deviceClipRect),
deviceClipRect,
deviceBoxRect,
wr::ToWrPoint(shadowOffset),
wr::ToWrColor(shadowColor),
@ -5421,7 +5421,7 @@ nsDisplayBoxShadowInner::CreateInsetBoxShadowWebRenderCommands(mozilla::wr::Disp
float spreadRadius = float(shadowItem->mSpread) / float(appUnitsPerDevPixel);
aBuilder.PushBoxShadow(wr::ToWrRect(deviceBoxRect),
aBuilder.PushClipRegion(deviceClipRect),
deviceClipRect,
wr::ToWrRect(deviceBoxRect),
wr::ToWrPoint(shadowOffset),
wr::ToWrColor(shadowColor),

View File

@ -652,7 +652,7 @@ nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
LayoutDeviceSize gapSize = LayoutDeviceSize::FromAppUnits(
aRepeatSize - aDest.Size(), appUnitsPerDevPixel);
aBuilder.PushImage(fill, aBuilder.PushClipRegion(clip),
aBuilder.PushImage(fill, clip,
wr::ToWrSize(destRect.Size()), wr::ToWrSize(gapSize),
wr::ImageRendering::Auto, key.value());
break;

View File

@ -7432,10 +7432,9 @@ BCBlockDirSeg::CreateWebRenderCommands(BCPaintBorderIterator& aIter,
transformedRect.width,
transformedRect.width,
transformedRect.width);
WrClipRegionToken clipRegion = aBuilder.PushClipRegion(transformedRect);
transformedRect.width *= 2.0f;
aBuilder.PushBorder(transformedRect,
clipRegion,
transformedRect,
borderWidths,
wrSide[0], wrSide[1], wrSide[2], wrSide[3],
borderRadii);
@ -7691,10 +7690,9 @@ BCInlineDirSeg::CreateWebRenderCommands(BCPaintBorderIterator& aIter,
transformedRect.height,
transformedRect.height,
transformedRect.height);
WrClipRegionToken clipRegion = aBuilder.PushClipRegion(transformedRect);
transformedRect.height *= 2.0f;
aBuilder.PushBorder(transformedRect,
clipRegion,
transformedRect,
borderWidths,
wrSide[0], wrSide[1], wrSide[2], wrSide[3],
borderRadii);

View File

@ -2107,9 +2107,8 @@ nsChildView::AddWindowOverlayWebRenderCommands(layers::WebRenderBridgeChild* aWr
}
WrRect rect = wr::ToWrRect(mTitlebarRect);
WrClipRegionToken clip = aBuilder.PushClipRegion(rect, nullptr);
aBuilder.PushImage(WrRect{ 0, 0, float(size.width), float(size.height) },
clip, wr::ImageRendering::Auto, *mTitlebarImageKey);
rect, wr::ImageRendering::Auto, *mTitlebarImageKey);
}
}