--- a/gfx/layers/LayersLogging.cpp
+++ b/gfx/layers/LayersLogging.cpp
@@ -65,39 +65,39 @@ AppendToString(std::stringstream& aStrea
aStream << pfx;
aStream << nsPrintfCString(
"(x=%d, y=%d, w=%d, h=%d)",
r.x, r.y, r.width, r.height).get();
aStream << sfx;
}
void
-AppendToString(std::stringstream& aStream, const WrColor& c,
+AppendToString(std::stringstream& aStream, const wr::WrColor& c,
const char* pfx, const char* sfx)
{
aStream << pfx;
aStream << nsPrintfCString(
"rgba(%d, %d, %d, %f)",
uint8_t(c.r*255.f), uint8_t(c.g*255.f), uint8_t(c.b*255.f), c.a).get();
aStream << sfx;
}
void
-AppendToString(std::stringstream& aStream, const WrRect& r,
+AppendToString(std::stringstream& aStream, const wr::WrRect& r,
const char* pfx, const char* sfx)
{
aStream << pfx;
aStream << nsPrintfCString(
"(x=%f, y=%f, w=%f, h=%f)",
r.x, r.y, r.width, r.height).get();
aStream << sfx;
}
void
-AppendToString(std::stringstream& aStream, const WrSize& s,
+AppendToString(std::stringstream& aStream, const wr::WrSize& s,
const char* pfx, const char* sfx)
{
aStream << pfx;
aStream << nsPrintfCString(
"(w=%f, h=%f)",
s.width, s.height).get();
aStream << sfx;
}
--- a/gfx/layers/LayersLogging.h
+++ b/gfx/layers/LayersLogging.h
@@ -13,21 +13,24 @@
#include "mozilla/gfx/Types.h" // for SamplingFilter, SurfaceFormat
#include "mozilla/layers/CompositorTypes.h" // for TextureFlags
#include "mozilla/layers/WebRenderLayersLogging.h"
#include "nsAString.h"
#include "nsPrintfCString.h" // for nsPrintfCString
#include "nsRegion.h" // for nsRegion, nsIntRegion
#include "nscore.h" // for nsACString, etc
+namespace mozilla {
+
+namespace wr {
struct WrColor;
struct WrRect;
struct WrSize;
+} // namespace wr
-namespace mozilla {
namespace gfx {
template <class units, class F> struct RectTyped;
} // namespace gfx
enum class ImageFormat;
namespace layers {
@@ -87,25 +90,25 @@ AppendToString(std::stringstream& aStrea
aStream << pfx;
aStream << nsPrintfCString(
"(x=%d, y=%d, w=%d, h=%d)",
r.x, r.y, r.width, r.height).get();
aStream << sfx;
}
void
-AppendToString(std::stringstream& aStream, const WrColor& c,
+AppendToString(std::stringstream& aStream, const wr::WrColor& c,
const char* pfx="", const char* sfx="");
void
-AppendToString(std::stringstream& aStream, const WrRect& r,
+AppendToString(std::stringstream& aStream, const wr::WrRect& r,
const char* pfx="", const char* sfx="");
void
-AppendToString(std::stringstream& aStream, const WrSize& s,
+AppendToString(std::stringstream& aStream, const wr::WrSize& s,
const char* pfx="", const char* sfx="");
void
AppendToString(std::stringstream& aStream, const nsRegion& r,
const char* pfx="", const char* sfx="");
void
AppendToString(std::stringstream& aStream, const nsIntRegion& r,
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -442,33 +442,33 @@ APZCTreeManager::UpdateHitTestingTree(ui
WebRenderScrollDataWrapper wrapper(&aScrollData);
UpdateHitTestingTreeImpl(aRootLayerTreeId, wrapper, aIsFirstPaint,
aOriginatingLayersId, aPaintSequenceNumber);
}
bool
APZCTreeManager::PushStateToWR(wr::WebRenderAPI* aWrApi,
const TimeStamp& aSampleTime,
- nsTArray<WrTransformProperty>& aTransformArray)
+ nsTArray<wr::WrTransformProperty>& aTransformArray)
{
APZThreadUtils::AssertOnCompositorThread();
MOZ_ASSERT(aWrApi);
MutexAutoLock lock(mTreeLock);
// During the first pass through the tree, we build a cache of guid->HTTN so
// that we can find the relevant APZC instances quickly in subsequent passes,
// such as the one below to generate scrollbar transforms. Without this, perf
// could end up being O(n^2) instead of O(n log n) because we'd have to search
// the tree to find the corresponding APZC every time we hit a thumb node.
std::unordered_map<ScrollableLayerGuid, HitTestingTreeNode*, ScrollableLayerGuidHash> httnMap;
bool activeAnimations = false;
uint64_t lastLayersId = -1;
- WrPipelineId lastPipelineId;
+ wr::WrPipelineId lastPipelineId;
// We iterate backwards here because the HitTestingTreeNode is optimized
// for backwards iteration. The equivalent code in AsyncCompositionManager
// iterates forwards, but the direction shouldn't really matter in practice
// so we do what's faster. In the future, if we need to start doing the
// equivalent of AlignFixedAndStickyLayers here, then the order will become
// important and we'll need to take that into consideration.
ForEachNode<ReverseIterator>(mRootNode.get(),
--- a/gfx/layers/apz/src/APZCTreeManager.h
+++ b/gfx/layers/apz/src/APZCTreeManager.h
@@ -20,23 +20,22 @@
#include "mozilla/RefPtr.h" // for RefPtr
#include "mozilla/TimeStamp.h" // for mozilla::TimeStamp
#include "nsCOMPtr.h" // for already_AddRefed
#if defined(MOZ_WIDGET_ANDROID)
#include "mozilla/layers/AndroidDynamicToolbarAnimator.h"
#endif // defined(MOZ_WIDGET_ANDROID)
-struct WrTransformProperty;
-
namespace mozilla {
class MultiTouchInput;
namespace wr {
class WebRenderAPI;
+struct WrTransformProperty;
}
namespace layers {
class Layer;
class AsyncPanZoomController;
class APZCTreeManagerParent;
class CompositorBridgeParent;
@@ -174,17 +173,17 @@ public:
* code in AsyncCompositionManager. If scrollbar transforms need updating
* to reflect the async scroll position, the updated transforms are appended
* to the provided aTransformArray.
* Returns true if any APZ animations are in progress and we need to keep
* compositing.
*/
bool PushStateToWR(wr::WebRenderAPI* aWrApi,
const TimeStamp& aSampleTime,
- nsTArray<WrTransformProperty>& aTransformArray);
+ nsTArray<wr::WrTransformProperty>& aTransformArray);
/**
* Walk the tree of APZCs and flushes the repaint requests for all the APZCS
* corresponding to the given layers id. Finally, sends a flush complete
* notification to the GeckoContentController for the layers id.
*/
void FlushApzRepaints(uint64_t aLayersId);
--- a/gfx/layers/composite/GPUVideoTextureHost.cpp
+++ b/gfx/layers/composite/GPUVideoTextureHost.cpp
@@ -128,18 +128,18 @@ GPUVideoTextureHost::AddWRImage(wr::WebR
{
MOZ_ASSERT(mWrappedTextureHost);
mWrappedTextureHost->AddWRImage(aAPI, aImageKeys, aExtID);
}
void
GPUVideoTextureHost::PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const WrRect& aBounds,
- const WrRect& aClip,
+ const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{
MOZ_ASSERT(mWrappedTextureHost);
MOZ_ASSERT(aImageKeys.length() > 0);
mWrappedTextureHost->PushExternalImage(aBuilder,
aBounds,
--- a/gfx/layers/composite/GPUVideoTextureHost.h
+++ b/gfx/layers/composite/GPUVideoTextureHost.h
@@ -51,18 +51,18 @@ public:
virtual void GetWRImageKeys(nsTArray<wr::ImageKey>& aImageKeys,
const std::function<wr::ImageKey()>& aImageKeyAllocator) override;
virtual void AddWRImage(wr::WebRenderAPI* aAPI,
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const WrRect& aBounds,
- const WrRect& aClip,
+ const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;
protected:
RefPtr<TextureHost> mWrappedTextureHost;
};
} // namespace layers
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -602,49 +602,49 @@ BufferTextureHost::AddWRImage(wr::WebRen
MOZ_ASSERT(aImageKeys.length() == 3);
const layers::YCbCrDescriptor& desc = mDescriptor.get_YCbCrDescriptor();
wr::ImageDescriptor yDescriptor(desc.ySize(), desc.ySize().width, gfx::SurfaceFormat::A8);
wr::ImageDescriptor cbcrDescriptor(desc.cbCrSize(), desc.cbCrSize().width, gfx::SurfaceFormat::A8);
aAPI->AddExternalImage(aImageKeys[0],
yDescriptor,
aExtID,
- WrExternalImageBufferType::ExternalBuffer,
+ wr::WrExternalImageBufferType::ExternalBuffer,
0);
aAPI->AddExternalImage(aImageKeys[1],
cbcrDescriptor,
aExtID,
- WrExternalImageBufferType::ExternalBuffer,
+ wr::WrExternalImageBufferType::ExternalBuffer,
1);
aAPI->AddExternalImage(aImageKeys[2],
cbcrDescriptor,
aExtID,
- WrExternalImageBufferType::ExternalBuffer,
+ wr::WrExternalImageBufferType::ExternalBuffer,
2);
}
}
void
BufferTextureHost::PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const WrRect& aBounds,
- const WrRect& aClip,
+ const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{
if (GetFormat() != gfx::SurfaceFormat::YUV) {
MOZ_ASSERT(aImageKeys.length() == 1);
aBuilder.PushImage(aBounds, aClip, aFilter, aImageKeys[0]);
} else {
MOZ_ASSERT(aImageKeys.length() == 3);
aBuilder.PushYCbCrPlanarImage(aBounds,
aClip,
aImageKeys[0],
aImageKeys[1],
aImageKeys[2],
- WrYuvColorSpace::Rec601,
+ wr::WrYuvColorSpace::Rec601,
aFilter);
}
}
void
TextureHost::DeserializeReadLock(const ReadLockDescriptor& aDesc,
ISurfaceAllocator* aAllocator)
{
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -638,18 +638,18 @@ public:
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID)
{
MOZ_ASSERT_UNREACHABLE("No AddWRImage() implementation for this TextureHost type.");
}
// Put all necessary WR commands into DisplayListBuilder for this textureHost rendering.
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const WrRect& aBounds,
- const WrRect& aClip,
+ const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aKeys)
{
MOZ_ASSERT_UNREACHABLE("No PushExternalImage() implementation for this TextureHost type.");
}
protected:
void ReadUnlock();
@@ -744,18 +744,18 @@ public:
virtual void GetWRImageKeys(nsTArray<wr::ImageKey>& aImageKeys,
const std::function<wr::ImageKey()>& aImageKeyAllocator) override;
virtual void AddWRImage(wr::WebRenderAPI* aAPI,
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const WrRect& aBounds,
- const WrRect& aClip,
+ const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;
protected:
bool Upload(nsIntRegion *aRegion = nullptr);
bool UploadIfNeeded();
bool MaybeUpload(nsIntRegion *aRegion);
bool EnsureWrappingTextureSource();
--- a/gfx/layers/d3d11/TextureD3D11.cpp
+++ b/gfx/layers/d3d11/TextureD3D11.cpp
@@ -979,18 +979,18 @@ DXGITextureHostD3D11::AddWRImage(wr::Web
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID)
{
MOZ_ASSERT_UNREACHABLE("No AddWRImage() implementation for this DXGITextureHostD3D11 type.");
}
void
DXGITextureHostD3D11::PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const WrRect& aBounds,
- const WrRect& aClip,
+ const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{
MOZ_ASSERT_UNREACHABLE("No PushExternalImage() implementation for this DXGITextureHostD3D11 type.");
}
DXGIYCbCrTextureHostD3D11::DXGIYCbCrTextureHostD3D11(TextureFlags aFlags,
const SurfaceDescriptorDXGIYCbCr& aDescriptor)
@@ -1146,18 +1146,18 @@ DXGIYCbCrTextureHostD3D11::AddWRImage(wr
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID)
{
MOZ_ASSERT_UNREACHABLE("No AddWRImage() implementation for this DXGIYCbCrTextureHostD3D11 type.");
}
void
DXGIYCbCrTextureHostD3D11::PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const WrRect& aBounds,
- const WrRect& aClip,
+ const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{
MOZ_ASSERT_UNREACHABLE("No PushExternalImage() implementation for this DXGIYCbCrTextureHostD3D11 type.");
}
bool
DXGIYCbCrTextureHostD3D11::AcquireTextureSource(CompositableTextureSourceRef& aTexture)
--- a/gfx/layers/d3d11/TextureD3D11.h
+++ b/gfx/layers/d3d11/TextureD3D11.h
@@ -326,18 +326,18 @@ public:
virtual void GetWRImageKeys(nsTArray<wr::ImageKey>& aImageKeys,
const std::function<wr::ImageKey()>& aImageKeyAllocator) override;
virtual void AddWRImage(wr::WebRenderAPI* aAPI,
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const WrRect& aBounds,
- const WrRect& aClip,
+ const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;
protected:
bool LockInternal();
void UnlockInternal();
bool EnsureTextureSource();
@@ -387,18 +387,18 @@ public:
virtual void GetWRImageKeys(nsTArray<wr::ImageKey>& aImageKeys,
const std::function<wr::ImageKey()>& aImageKeyAllocator) override;
virtual void AddWRImage(wr::WebRenderAPI* aAPI,
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const WrRect& aBounds,
- const WrRect& aClip,
+ const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;
private:
bool EnsureTextureSource();
protected:
RefPtr<ID3D11Device> GetDevice();
--- a/gfx/layers/ipc/PWebRenderBridge.ipdl
+++ b/gfx/layers/ipc/PWebRenderBridge.ipdl
@@ -18,17 +18,17 @@ using mozilla::layers::APZTestData from
using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h";
using mozilla::wr::ByteBuffer from "mozilla/webrender/WebRenderTypes.h";
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 mozilla::wr::PipelineId from "mozilla/webrender/WebRenderTypes.h";
-using WrBuiltDisplayListDescriptor from "mozilla/webrender/webrender_ffi.h";
+using mozilla::wr::WrBuiltDisplayListDescriptor from "mozilla/webrender/webrender_ffi.h";
using mozilla::layers::WebRenderScrollData from "mozilla/layers/WebRenderScrollData.h";
namespace mozilla {
namespace layers {
sync protocol PWebRenderBridge
{
manager PCompositorBridge;
--- a/gfx/layers/ipc/WebRenderMessages.ipdlh
+++ b/gfx/layers/ipc/WebRenderMessages.ipdlh
@@ -4,20 +4,20 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include LayersSurfaces;
include LayersMessages;
include protocol PTexture;
-using WrSize from "mozilla/webrender/webrender_ffi.h";
-using WrImageRendering from "mozilla/webrender/webrender_ffi.h";
-using WrMixBlendMode from "mozilla/webrender/webrender_ffi.h";
-using MaybeImageMask from "mozilla/webrender/WebRenderTypes.h";
+using mozilla::wr::WrSize from "mozilla/webrender/webrender_ffi.h";
+using mozilla::wr::WrImageRendering from "mozilla/webrender/webrender_ffi.h";
+using mozilla::wr::WrMixBlendMode from "mozilla/webrender/webrender_ffi.h";
+using mozilla::wr::MaybeImageMask from "mozilla/webrender/WebRenderTypes.h";
using mozilla::wr::ExternalImageId from "mozilla/webrender/WebRenderTypes.h";
using mozilla::wr::ImageKey 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::LayerPoint from "Units.h";
using mozilla::layers::MaybeLayerRect from "mozilla/layers/LayersTypes.h";
using class mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
--- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
+++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
@@ -173,64 +173,64 @@ MacIOSurfaceTextureHostOGL::AddWRImage(w
case gfx::SurfaceFormat::B8G8R8A8:
case gfx::SurfaceFormat::B8G8R8X8: {
MOZ_ASSERT(aImageKeys.length() == 1);
MOZ_ASSERT(mSurface->GetPlaneCount() == 0);
wr::ImageDescriptor descriptor(GetSize(), GetFormat());
aAPI->AddExternalImage(aImageKeys[0],
descriptor,
aExtID,
- WrExternalImageBufferType::TextureRectHandle,
+ wr::WrExternalImageBufferType::TextureRectHandle,
0);
break;
}
case gfx::SurfaceFormat::YUV422: {
// This is the special buffer format. The buffer contents could be a
// converted RGB interleaving data or a YCbCr interleaving data depending
// on the different platform setting. (e.g. It will be RGB at OpenGL 2.1
// and YCbCr at OpenGL 3.1)
MOZ_ASSERT(aImageKeys.length() == 1);
MOZ_ASSERT(mSurface->GetPlaneCount() == 0);
wr::ImageDescriptor descriptor(GetSize(), gfx::SurfaceFormat::R8G8B8X8);
aAPI->AddExternalImage(aImageKeys[0],
descriptor,
aExtID,
- WrExternalImageBufferType::TextureRectHandle,
+ wr::WrExternalImageBufferType::TextureRectHandle,
0);
break;
}
case gfx::SurfaceFormat::NV12: {
MOZ_ASSERT(aImageKeys.length() == 2);
MOZ_ASSERT(mSurface->GetPlaneCount() == 2);
wr::ImageDescriptor descriptor0(gfx::IntSize(mSurface->GetDevicePixelWidth(0), mSurface->GetDevicePixelHeight(0)),
gfx::SurfaceFormat::A8);
wr::ImageDescriptor descriptor1(gfx::IntSize(mSurface->GetDevicePixelWidth(1), mSurface->GetDevicePixelHeight(1)),
gfx::SurfaceFormat::R8G8);
aAPI->AddExternalImage(aImageKeys[0],
descriptor0,
aExtID,
- WrExternalImageBufferType::TextureRectHandle,
+ wr::WrExternalImageBufferType::TextureRectHandle,
0);
aAPI->AddExternalImage(aImageKeys[1],
descriptor1,
aExtID,
- WrExternalImageBufferType::TextureRectHandle,
+ wr::WrExternalImageBufferType::TextureRectHandle,
1);
break;
}
default: {
MOZ_ASSERT_UNREACHABLE("unexpected to be called");
}
}
}
void
MacIOSurfaceTextureHostOGL::PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const WrRect& aBounds,
- const WrRect& aClip,
+ const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{
switch (GetFormat()) {
case gfx::SurfaceFormat::R8G8B8X8:
case gfx::SurfaceFormat::R8G8B8A8:
case gfx::SurfaceFormat::B8G8R8A8:
case gfx::SurfaceFormat::B8G8R8X8: {
@@ -240,28 +240,28 @@ MacIOSurfaceTextureHostOGL::PushExternal
break;
}
case gfx::SurfaceFormat::YUV422: {
MOZ_ASSERT(aImageKeys.length() == 1);
MOZ_ASSERT(mSurface->GetPlaneCount() == 0);
aBuilder.PushYCbCrInterleavedImage(aBounds,
aClip,
aImageKeys[0],
- WrYuvColorSpace::Rec601,
+ wr::WrYuvColorSpace::Rec601,
aFilter);
break;
}
case gfx::SurfaceFormat::NV12: {
MOZ_ASSERT(aImageKeys.length() == 2);
MOZ_ASSERT(mSurface->GetPlaneCount() == 2);
aBuilder.PushNV12Image(aBounds,
aClip,
aImageKeys[0],
aImageKeys[1],
- WrYuvColorSpace::Rec601,
+ wr::WrYuvColorSpace::Rec601,
aFilter);
break;
}
default: {
MOZ_ASSERT_UNREACHABLE("unexpected to be called");
}
}
}
--- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
+++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
@@ -70,18 +70,18 @@ public:
virtual void GetWRImageKeys(nsTArray<wr::ImageKey>& aImageKeys,
const std::function<wr::ImageKey()>& aImageKeyAllocator) override;
virtual void AddWRImage(wr::WebRenderAPI* aAPI,
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const WrRect& aBounds,
- const WrRect& aClip,
+ const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;
protected:
GLTextureSource* CreateTextureSourceForPlane(size_t aPlane);
RefPtr<GLTextureSource> mTextureSource;
RefPtr<MacIOSurface> mSurface;
--- a/gfx/layers/wr/ScrollingLayersHelper.cpp
+++ b/gfx/layers/wr/ScrollingLayersHelper.cpp
@@ -115,31 +115,31 @@ ScrollingLayersHelper::PushLayerLocalCli
if (const Maybe<ParentLayerIntRect>& rect = layer->GetClipRect()) {
clip = Some(IntRectToRect(rect.ref()));
} else if (layer->GetMaskLayer()) {
// this layer has a mask, but no clip rect. so let's use the transformed
// visible bounds as the clip rect.
clip = Some(layer->GetLocalTransformTyped().TransformBounds(mLayer->Bounds()));
}
if (clip) {
- Maybe<WrImageMask> mask = mLayer->BuildWrMaskLayer(aStackingContext);
+ Maybe<wr::WrImageMask> mask = mLayer->BuildWrMaskLayer(aStackingContext);
LayerRect clipRect = ViewAs<LayerPixel>(clip.ref(),
PixelCastJustification::MovingDownToChildren);
mBuilder->PushClip(aStackingContext.ToRelativeWrRect(clipRect), mask.ptrOr(nullptr));
mPushedLayerLocalClip = true;
}
}
void
ScrollingLayersHelper::PushLayerClip(const LayerClip& aClip,
const StackingContextHelper& aSc)
{
LayerRect clipRect = IntRectToRect(ViewAs<LayerPixel>(aClip.GetClipRect(),
PixelCastJustification::MovingDownToChildren));
- Maybe<WrImageMask> mask;
+ Maybe<wr::WrImageMask> mask;
if (Maybe<size_t> maskLayerIndex = aClip.GetMaskLayerIndex()) {
Layer* maskLayer = mLayer->GetLayer()->GetAncestorMaskLayerAt(maskLayerIndex.value());
WebRenderLayer* maskWrLayer = WebRenderLayer::ToWebRenderLayer(maskLayer);
// TODO: check this transform is correct in all cases
mask = maskWrLayer->RenderMaskLayer(aSc, maskLayer->GetTransform());
}
mBuilder->PushClip(aSc.ToRelativeWrRect(clipRect), mask.ptrOr(nullptr));
}
--- a/gfx/layers/wr/StackingContextHelper.cpp
+++ b/gfx/layers/wr/StackingContextHelper.cpp
@@ -19,105 +19,105 @@ StackingContextHelper::StackingContextHe
StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParentSC,
wr::DisplayListBuilder& aBuilder,
LayerRect aBoundForSC,
LayerPoint aOrigin,
uint64_t aAnimationsId,
float* aOpacityPtr,
gfx::Matrix4x4* aTransformPtr,
- const nsTArray<WrFilterOp>& aFilters)
+ const nsTArray<wr::WrFilterOp>& aFilters)
: mBuilder(&aBuilder)
{
- WrRect scBounds = aParentSC.ToRelativeWrRect(aBoundForSC);
+ wr::WrRect scBounds = aParentSC.ToRelativeWrRect(aBoundForSC);
if (aTransformPtr) {
mTransform = *aTransformPtr;
}
mBuilder->PushStackingContext(scBounds,
aAnimationsId,
aOpacityPtr,
aTransformPtr,
- WrTransformStyle::Flat,
+ wr::WrTransformStyle::Flat,
// TODO: set correct blend mode.
wr::ToWrMixBlendMode(gfx::CompositionOp::OP_OVER),
aFilters);
mOrigin = aOrigin;
}
StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParentSC,
wr::DisplayListBuilder& aBuilder,
WebRenderLayer* aLayer,
const Maybe<gfx::Matrix4x4>& aTransform,
- const nsTArray<WrFilterOp>& aFilters)
+ const nsTArray<wr::WrFilterOp>& aFilters)
: mBuilder(&aBuilder)
{
- WrRect scBounds = aParentSC.ToRelativeWrRect(aLayer->BoundsForStackingContext());
+ wr::WrRect scBounds = aParentSC.ToRelativeWrRect(aLayer->BoundsForStackingContext());
Layer* layer = aLayer->GetLayer();
mTransform = aTransform.valueOr(layer->GetTransform());
float opacity = 1.0f;
mBuilder->PushStackingContext(scBounds, 0, &opacity,
mTransform.IsIdentity() ? nullptr : &mTransform,
- WrTransformStyle::Flat,
+ wr::WrTransformStyle::Flat,
wr::ToWrMixBlendMode(layer->GetMixBlendMode()),
aFilters);
mOrigin = aLayer->Bounds().TopLeft();
}
StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParentSC,
wr::DisplayListBuilder& aBuilder,
WebRenderLayer* aLayer,
uint64_t aAnimationsId,
float* aOpacityPtr,
gfx::Matrix4x4* aTransformPtr,
- const nsTArray<WrFilterOp>& aFilters)
+ const nsTArray<wr::WrFilterOp>& aFilters)
: mBuilder(&aBuilder)
{
- WrRect scBounds = aParentSC.ToRelativeWrRect(aLayer->BoundsForStackingContext());
+ wr::WrRect scBounds = aParentSC.ToRelativeWrRect(aLayer->BoundsForStackingContext());
if (aTransformPtr) {
mTransform = *aTransformPtr;
}
mBuilder->PushStackingContext(scBounds,
aAnimationsId,
aOpacityPtr,
aTransformPtr,
- WrTransformStyle::Flat,
+ wr::WrTransformStyle::Flat,
wr::ToWrMixBlendMode(aLayer->GetLayer()->GetMixBlendMode()),
aFilters);
mOrigin = aLayer->Bounds().TopLeft();
}
StackingContextHelper::~StackingContextHelper()
{
if (mBuilder) {
mBuilder->PopStackingContext();
}
}
-WrRect
+wr::WrRect
StackingContextHelper::ToRelativeWrRect(const LayerRect& aRect) const
{
return wr::ToWrRect(aRect - mOrigin);
}
-WrRect
+wr::WrRect
StackingContextHelper::ToRelativeWrRect(const LayoutDeviceRect& aRect) const
{
return wr::ToWrRect(ViewAs<LayerPixel>(aRect, PixelCastJustification::WebRenderHasUnitResolution) - mOrigin);
}
-WrPoint
+wr::WrPoint
StackingContextHelper::ToRelativeWrPoint(const LayerPoint& aPoint) const
{
return wr::ToWrPoint(aPoint - mOrigin);
}
-WrRect
+wr::WrRect
StackingContextHelper::ToRelativeWrRectRounded(const LayoutDeviceRect& aRect) const
{
return wr::ToWrRect(RoundedToInt(ViewAs<LayerPixel>(aRect, PixelCastJustification::WebRenderHasUnitResolution) - mOrigin));
}
} // namespace layers
} // namespace mozilla
--- a/gfx/layers/wr/StackingContextHelper.h
+++ b/gfx/layers/wr/StackingContextHelper.h
@@ -27,35 +27,35 @@ public:
// Pushes a stacking context onto the provided DisplayListBuilder. It uses
// the transform if provided, otherwise takes the transform from the layer.
// It also takes the mix-blend-mode and bounds from the layer, and uses 1.0
// for the opacity.
StackingContextHelper(const StackingContextHelper& aParentSC,
wr::DisplayListBuilder& aBuilder,
WebRenderLayer* aLayer,
const Maybe<gfx::Matrix4x4>& aTransform = Nothing(),
- const nsTArray<WrFilterOp>& aFilters = nsTArray<WrFilterOp>());
+ const nsTArray<wr::WrFilterOp>& aFilters = nsTArray<wr::WrFilterOp>());
// Alternate constructor which invokes the version of PushStackingContext
// for animations.
StackingContextHelper(const StackingContextHelper& aParentSC,
wr::DisplayListBuilder& aBuilder,
WebRenderLayer* aLayer,
uint64_t aAnimationsId,
float* aOpacityPtr,
gfx::Matrix4x4* aTransformPtr,
- const nsTArray<WrFilterOp>& aFilters = nsTArray<WrFilterOp>());
+ const nsTArray<wr::WrFilterOp>& aFilters = nsTArray<wr::WrFilterOp>());
// The constructor for layers-free mode.
StackingContextHelper(const StackingContextHelper& aParentSC,
wr::DisplayListBuilder& aBuilder,
LayerRect aBoundForSC,
LayerPoint aOrigin,
uint64_t aAnimationsId,
float* aOpacityPtr,
gfx::Matrix4x4* aTransformPtr,
- const nsTArray<WrFilterOp>& aFilters = nsTArray<WrFilterOp>());
+ const nsTArray<wr::WrFilterOp>& aFilters = nsTArray<wr::WrFilterOp>());
// This version of the constructor should only be used at the root level
// of the tree, so that we have a StackingContextHelper to pass down into
// the RenderLayer traversal, but don't actually want it to push a stacking
// context on the display list builder.
StackingContextHelper();
// Pops the stacking context, if one was pushed during the constructor.
~StackingContextHelper();
@@ -63,22 +63,22 @@ public:
// When this StackingContextHelper is in scope, this function can be used
// to convert a rect from the layer system's coordinate space to a WrRect
// that is relative to the stacking context. This is useful because most
// things that are pushed inside the stacking context need to be relative
// to the stacking context.
// We allow passing in a LayoutDeviceRect for convenience because in a lot of
// cases with WebRender display item generate the layout device space is the
// same as the layer space. (TODO: try to make this more explicit somehow).
- WrRect ToRelativeWrRect(const LayerRect& aRect) const;
- WrRect ToRelativeWrRect(const LayoutDeviceRect& aRect) const;
+ wr::WrRect ToRelativeWrRect(const LayerRect& aRect) const;
+ wr::WrRect ToRelativeWrRect(const LayoutDeviceRect& aRect) const;
// Same but for points
- WrPoint ToRelativeWrPoint(const LayerPoint& aPoint) const;
+ wr::WrPoint ToRelativeWrPoint(const LayerPoint& aPoint) const;
// Same but rounds the rectangle to ints after transforming.
- WrRect ToRelativeWrRectRounded(const LayoutDeviceRect& aRect) const;
+ wr::WrRect ToRelativeWrRectRounded(const LayoutDeviceRect& aRect) const;
private:
wr::DisplayListBuilder* mBuilder;
LayerPoint mOrigin;
gfx::Matrix4x4 mTransform;
};
} // namespace layers
--- a/gfx/layers/wr/WebRenderBridgeChild.cpp
+++ b/gfx/layers/wr/WebRenderBridgeChild.cpp
@@ -102,17 +102,17 @@ WebRenderBridgeChild::DPEnd(wr::DisplayL
bool aIsSync,
uint64_t aTransactionId,
const WebRenderScrollData& aScrollData)
{
MOZ_ASSERT(!mDestroyed);
MOZ_ASSERT(mIsInTransaction);
wr::BuiltDisplayList dl;
- WrSize contentSize;
+ wr::WrSize contentSize;
aBuilder.Finalize(contentSize, dl);
ByteBuffer dlData(Move(dl.dl));
if (aIsSync) {
this->SendDPSyncEnd(aSize, mParentCommands, mDestroyedActors, GetFwdTransactionId(), aTransactionId,
contentSize, dlData, dl.dl_desc, aScrollData, mIdNamespace);
} else {
this->SendDPEnd(aSize, mParentCommands, mDestroyedActors, GetFwdTransactionId(), aTransactionId,
@@ -200,37 +200,37 @@ WriteFontFileData(const uint8_t* aData,
void
WebRenderBridgeChild::PushGlyphs(wr::DisplayListBuilder& aBuilder, const nsTArray<GlyphArray>& aGlyphs,
gfx::ScaledFont* aFont, const StackingContextHelper& aSc,
const LayerRect& aBounds, const LayerRect& aClip)
{
MOZ_ASSERT(aFont);
MOZ_ASSERT(!aGlyphs.IsEmpty());
- WrFontKey key = GetFontKeyForScaledFont(aFont);
+ wr::WrFontKey key = GetFontKeyForScaledFont(aFont);
MOZ_ASSERT(key.mNamespace && key.mHandle);
for (size_t i = 0; i < aGlyphs.Length(); i++) {
GlyphArray glyph_array = aGlyphs[i];
nsTArray<gfx::Glyph>& glyphs = glyph_array.glyphs();
- nsTArray<WrGlyphInstance> wr_glyph_instances;
+ nsTArray<wr::WrGlyphInstance> wr_glyph_instances;
wr_glyph_instances.SetLength(glyphs.Length());
for (size_t j = 0; j < glyphs.Length(); j++) {
wr_glyph_instances[j].index = glyphs[j].mIndex;
wr_glyph_instances[j].point = aSc.ToRelativeWrPoint(
LayerPoint::FromUnknownPoint(glyphs[j].mPosition));
}
aBuilder.PushText(aSc.ToRelativeWrRect(aBounds),
aSc.ToRelativeWrRect(aClip),
glyph_array.color().value(),
key,
- Range<const WrGlyphInstance>(wr_glyph_instances.Elements(), wr_glyph_instances.Length()),
+ Range<const wr::WrGlyphInstance>(wr_glyph_instances.Elements(), wr_glyph_instances.Length()),
aFont->GetSize());
}
}
wr::FontKey
WebRenderBridgeChild::GetFontKeyForScaledFont(gfx::ScaledFont* aScaledFont)
{
--- a/gfx/layers/wr/WebRenderBridgeChild.h
+++ b/gfx/layers/wr/WebRenderBridgeChild.h
@@ -91,19 +91,19 @@ public:
uint32_t GetNextResourceId() { return ++mResourceId; }
uint32_t GetNamespace() { return mIdNamespace; }
void SetNamespace(uint32_t aIdNamespace)
{
mIdNamespace = aIdNamespace;
}
- WrImageKey GetNextImageKey()
+ wr::WrImageKey GetNextImageKey()
{
- return WrImageKey{ GetNamespace(), GetNextResourceId() };
+ return wr::WrImageKey{ GetNamespace(), GetNextResourceId() };
}
void PushGlyphs(wr::DisplayListBuilder& aBuilder, const nsTArray<GlyphArray>& aGlyphs,
gfx::ScaledFont* aFont, const StackingContextHelper& aSc,
const LayerRect& aBounds, const LayerRect& aClip);
wr::FontKey GetFontKeyForScaledFont(gfx::ScaledFont* aScaledFont);
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -395,19 +395,19 @@ WebRenderBridgeParent::RecvDPBegin(const
}
void
WebRenderBridgeParent::HandleDPEnd(const gfx::IntSize& aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
- const WrSize& aContentSize,
- const ByteBuffer& dl,
- const WrBuiltDisplayListDescriptor& dlDesc,
+ const wr::WrSize& aContentSize,
+ const wr::ByteBuffer& dl,
+ const wr::WrBuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
const uint32_t& aIdNameSpace)
{
AutoProfilerTracing tracing("Paint", "DPTransaction");
UpdateFwdTransactionId(aFwdTransactionId);
AutoClearReadLocks clearLocks(mReadLocks);
if (mDestroyed) {
@@ -475,17 +475,17 @@ WebRenderBridgeParent::UpdateAPZ()
mScrollData.GetFocusTarget());
apzc->UpdateHitTestingTree(rootLayersId, rootWrbp->GetScrollData(),
mScrollData.IsFirstPaint(), GetLayersId(),
mScrollData.GetPaintSequenceNumber());
}
}
bool
-WebRenderBridgeParent::PushAPZStateToWR(nsTArray<WrTransformProperty>& aTransformArray)
+WebRenderBridgeParent::PushAPZStateToWR(nsTArray<wr::WrTransformProperty>& aTransformArray)
{
CompositorBridgeParent* cbp = GetRootCompositorBridgeParent();
if (!cbp) {
return false;
}
if (RefPtr<APZCTreeManager> apzc = cbp->GetAPZCTreeManager()) {
TimeStamp animationTime = cbp->GetTestingTimeStamp().valueOr(
mCompositorScheduler->GetLastComposeTime());
@@ -508,19 +508,19 @@ WebRenderBridgeParent::GetScrollData() c
}
mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvDPEnd(const gfx::IntSize& aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
- const WrSize& aContentSize,
- const ByteBuffer& dl,
- const WrBuiltDisplayListDescriptor& dlDesc,
+ const wr::WrSize& aContentSize,
+ const wr::ByteBuffer& dl,
+ const wr::WrBuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
const uint32_t& aIdNameSpace)
{
if (mDestroyed) {
return IPC_OK();
}
HandleDPEnd(aSize, Move(aCommands), Move(aToDestroy), aFwdTransactionId, aTransactionId,
aContentSize, dl, dlDesc, aScrollData, aIdNameSpace);
@@ -528,19 +528,19 @@ WebRenderBridgeParent::RecvDPEnd(const g
}
mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvDPSyncEnd(const gfx::IntSize &aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
- const WrSize& aContentSize,
- const ByteBuffer& dl,
- const WrBuiltDisplayListDescriptor& dlDesc,
+ const wr::WrSize& aContentSize,
+ const wr::ByteBuffer& dl,
+ const wr::WrBuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
const uint32_t& aIdNameSpace)
{
if (mDestroyed) {
return IPC_OK();
}
HandleDPEnd(aSize, Move(aCommands), Move(aToDestroy), aFwdTransactionId, aTransactionId,
aContentSize, dl, dlDesc, aScrollData, aIdNameSpace);
@@ -651,18 +651,18 @@ WebRenderBridgeParent::ProcessWebRenderP
}
}
}
}
void
WebRenderBridgeParent::ProcessWebRenderCommands(const gfx::IntSize &aSize,
InfallibleTArray<WebRenderParentCommand>& aCommands, const wr::Epoch& aEpoch,
- const WrSize& aContentSize, const ByteBuffer& dl,
- const WrBuiltDisplayListDescriptor& dlDesc,
+ const wr::WrSize& aContentSize, const wr::ByteBuffer& dl,
+ const wr::WrBuiltDisplayListDescriptor& dlDesc,
const uint32_t& aIdNameSpace)
{
mCompositableHolder->SetCompositionTime(TimeStamp::Now());
ProcessWebRenderParentCommands(aCommands);
// The command is obsoleted.
// Do not set the command to webrender since it causes crash in webrender.
if (mIdNameSpace != aIdNameSpace) {
@@ -1052,18 +1052,18 @@ WebRenderBridgeParent::AdvanceAnimations
TimeStamp animTime = mCompositorScheduler->GetLastComposeTime();
if (CompositorBridgeParent* cbp = GetRootCompositorBridgeParent()) {
animTime = cbp->GetTestingTimeStamp().valueOr(animTime);
}
AnimationHelper::SampleAnimations(mAnimStorage, animTime);
}
void
-WebRenderBridgeParent::SampleAnimations(nsTArray<WrOpacityProperty>& aOpacityArray,
- nsTArray<WrTransformProperty>& aTransformArray)
+WebRenderBridgeParent::SampleAnimations(nsTArray<wr::WrOpacityProperty>& aOpacityArray,
+ nsTArray<wr::WrTransformProperty>& aTransformArray)
{
AdvanceAnimations();
// return the animated data if has
if (mAnimStorage->AnimatedValueCount()) {
for(auto iter = mAnimStorage->ConstAnimatedValueTableIter();
!iter.Done(); iter.Next()) {
AnimatedValue * value = iter.UserData();
@@ -1091,18 +1091,18 @@ WebRenderBridgeParent::CompositeToTarget
if (!mForceRendering &&
wr::RenderThread::Get()->GetPendingFrameCount(mApi->GetId()) > maxPendingFrameCount) {
// Render thread is busy, try next time.
ScheduleComposition();
return;
}
bool scheduleComposite = false;
- nsTArray<WrOpacityProperty> opacityArray;
- nsTArray<WrTransformProperty> transformArray;
+ nsTArray<wr::WrOpacityProperty> opacityArray;
+ nsTArray<wr::WrTransformProperty> transformArray;
mCompositableHolder->SetCompositionTime(TimeStamp::Now());
mCompositableHolder->ApplyAsyncImages(mApi);
if (gfxPrefs::WebRenderOMTAEnabled()) {
SampleAnimations(opacityArray, transformArray);
if (!transformArray.IsEmpty() || !opacityArray.IsEmpty()) {
--- a/gfx/layers/wr/WebRenderBridgeParent.h
+++ b/gfx/layers/wr/WebRenderBridgeParent.h
@@ -93,29 +93,29 @@ public:
const uint32_t& aFontIndex) override;
mozilla::ipc::IPCResult RecvDeleteFont(const wr::FontKey& aFontKey) override;
mozilla::ipc::IPCResult RecvDPBegin(const gfx::IntSize& aSize) override;
mozilla::ipc::IPCResult RecvDPEnd(const gfx::IntSize& aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
- const WrSize& aContentSize,
- const ByteBuffer& dl,
- const WrBuiltDisplayListDescriptor& dlDesc,
+ const wr::WrSize& aContentSize,
+ const wr::ByteBuffer& dl,
+ const wr::WrBuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
const uint32_t& aIdNameSpace) override;
mozilla::ipc::IPCResult RecvDPSyncEnd(const gfx::IntSize& aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
- const WrSize& aContentSize,
- const ByteBuffer& dl,
- const WrBuiltDisplayListDescriptor& dlDesc,
+ const wr::WrSize& aContentSize,
+ const wr::ByteBuffer& dl,
+ const wr::WrBuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
const uint32_t& aIdNameSpace) override;
mozilla::ipc::IPCResult RecvParentCommands(nsTArray<WebRenderParentCommand>&& commands) override;
mozilla::ipc::IPCResult RecvDPGetSnapshot(PTextureParent* aTexture) override;
mozilla::ipc::IPCResult RecvAddPipelineIdForAsyncCompositable(const wr::PipelineId& aPipelineIds,
const CompositableHandle& aHandle) override;
mozilla::ipc::IPCResult RecvRemovePipelineIdForAsyncCompositable(const wr::PipelineId& aPipelineId) override;
@@ -212,46 +212,46 @@ private:
virtual ~WebRenderBridgeParent();
uint64_t GetLayersId() const;
void DeleteOldImages();
void ProcessWebRenderParentCommands(InfallibleTArray<WebRenderParentCommand>& aCommands);
void ProcessWebRenderCommands(const gfx::IntSize &aSize,
InfallibleTArray<WebRenderParentCommand>& commands,
const wr::Epoch& aEpoch,
- const WrSize& aContentSize,
- const ByteBuffer& dl,
- const WrBuiltDisplayListDescriptor& dlDesc,
+ const wr::WrSize& aContentSize,
+ const wr::ByteBuffer& dl,
+ const wr::WrBuiltDisplayListDescriptor& dlDesc,
const uint32_t& aIdNameSpace);
void ClearResources();
uint64_t GetChildLayerObserverEpoch() const { return mChildLayerObserverEpoch; }
bool ShouldParentObserveEpoch();
void HandleDPEnd(const gfx::IntSize& aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
- const WrSize& aContentSize,
- const ByteBuffer& dl,
- const WrBuiltDisplayListDescriptor& dlDesc,
+ const wr::WrSize& aContentSize,
+ const wr::ByteBuffer& dl,
+ const wr::WrBuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
const uint32_t& aIdNameSpace);
mozilla::ipc::IPCResult HandleShutdown();
void AdvanceAnimations();
- void SampleAnimations(nsTArray<WrOpacityProperty>& aOpacityArray,
- nsTArray<WrTransformProperty>& aTransformArray);
+ void SampleAnimations(nsTArray<wr::WrOpacityProperty>& aOpacityArray,
+ nsTArray<wr::WrTransformProperty>& aTransformArray);
CompositorBridgeParent* GetRootCompositorBridgeParent() const;
// Have APZ push the async scroll state to WR. Returns true if an APZ
// animation is in effect and we need to schedule another composition.
// If scrollbars need their transforms updated, the provided aTransformArray
// is populated with the property update details.
- bool PushAPZStateToWR(nsTArray<WrTransformProperty>& aTransformArray);
+ bool PushAPZStateToWR(nsTArray<wr::WrTransformProperty>& aTransformArray);
// Helper method to get an APZC reference from a scroll id. Uses the layers
// id of this bridge, and may return null if the APZC wasn't found.
already_AddRefed<AsyncPanZoomController> GetTargetAPZC(const FrameMetrics::ViewID& aId);
private:
struct PendingTransactionId {
PendingTransactionId(wr::Epoch aEpoch, uint64_t aId)
--- a/gfx/layers/wr/WebRenderCanvasLayer.cpp
+++ b/gfx/layers/wr/WebRenderCanvasLayer.cpp
@@ -72,21 +72,21 @@ WebRenderCanvasLayer::RenderLayer(wr::Di
wr::ImageRendering filter = wr::ToImageRendering(mSamplingFilter);
if (gfxPrefs::LayersDump()) {
printf_stderr("CanvasLayer %p texture-filter=%s\n",
this->GetLayer(),
Stringify(filter).c_str());
}
- WrImageKey key = GetImageKey();
+ wr::WrImageKey key = GetImageKey();
WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(mExternalImageId.value(), key));
WrManager()->AddImageKeyForDiscard(key);
- WrRect r = sc.ToRelativeWrRect(rect);
+ wr::WrRect r = sc.ToRelativeWrRect(rect);
aBuilder.PushImage(r, r, filter, key);
}
void
WebRenderCanvasLayer::AttachCompositable()
{
mCanvasClient->Connect();
}
--- a/gfx/layers/wr/WebRenderColorLayer.cpp
+++ b/gfx/layers/wr/WebRenderColorLayer.cpp
@@ -23,14 +23,14 @@ WebRenderColorLayer::RenderLayer(wr::Dis
const StackingContextHelper& aSc)
{
ScrollingLayersHelper scroller(this, aBuilder, aSc);
StackingContextHelper sc(aSc, aBuilder, this);
LayerRect rect = Bounds();
DumpLayerInfo("ColorLayer", rect);
- WrRect r = sc.ToRelativeWrRect(rect);
+ wr::WrRect r = sc.ToRelativeWrRect(rect);
aBuilder.PushRect(r, r, wr::ToWrColor(mColor));
}
} // namespace layers
} // namespace mozilla
--- a/gfx/layers/wr/WebRenderCompositableHolder.cpp
+++ b/gfx/layers/wr/WebRenderCompositableHolder.cpp
@@ -14,18 +14,18 @@
namespace mozilla {
namespace layers {
WebRenderCompositableHolder::AsyncImagePipelineHolder::AsyncImagePipelineHolder()
: mInitialised(false)
, mIsChanged(false)
, mUseExternalImage(false)
- , mFilter(WrImageRendering::Auto)
- , mMixBlendMode(WrMixBlendMode::Normal)
+ , mFilter(wr::WrImageRendering::Auto)
+ , mMixBlendMode(wr::WrMixBlendMode::Normal)
{}
WebRenderCompositableHolder::WebRenderCompositableHolder(uint32_t aIdNamespace)
: mIdNamespace(aIdNamespace)
, mResourceId(0)
, mAsyncImageEpoch(0)
, mDestroyed(false)
{
@@ -130,18 +130,18 @@ WebRenderCompositableHolder::RemoveAsync
}
}
void
WebRenderCompositableHolder::UpdateAsyncImagePipeline(const wr::PipelineId& aPipelineId,
const LayerRect& aScBounds,
const gfx::Matrix4x4& aScTransform,
const gfx::MaybeIntSize& aScaleToSize,
- const WrImageRendering& aFilter,
- const WrMixBlendMode& aMixBlendMode)
+ const wr::WrImageRendering& aFilter,
+ const wr::WrMixBlendMode& aMixBlendMode)
{
if (mDestroyed) {
return;
}
AsyncImagePipelineHolder* holder = mAsyncImagePipelineHolders.Get(wr::AsUint64(aPipelineId));
if (!holder) {
return;
}
@@ -259,30 +259,30 @@ WebRenderCompositableHolder::ApplyAsyncI
useExternalImage,
holder,
keys,
keysToDelete);
if (!updateDisplayList) {
continue;
}
- WrSize contentSize { holder->mScBounds.width, holder->mScBounds.height };
+ wr::WrSize contentSize { holder->mScBounds.width, holder->mScBounds.height };
wr::DisplayListBuilder builder(pipelineId, contentSize);
if (!keys.IsEmpty()) {
MOZ_ASSERT(holder->mCurrentTexture.get());
float opacity = 1.0f;
builder.PushStackingContext(wr::ToWrRect(holder->mScBounds),
0,
&opacity,
holder->mScTransform.IsIdentity() ? nullptr : &holder->mScTransform,
- WrTransformStyle::Flat,
+ wr::WrTransformStyle::Flat,
holder->mMixBlendMode,
- nsTArray<WrFilterOp>());
+ nsTArray<wr::WrFilterOp>());
LayerRect rect(0, 0, holder->mCurrentTexture->GetSize().width, holder->mCurrentTexture->GetSize().height);
if (holder->mScaleToSize.isSome()) {
rect = LayerRect(0, 0, holder->mScaleToSize.value().width, holder->mScaleToSize.value().height);
}
if (useExternalImage) {
MOZ_ASSERT(holder->mCurrentTexture->AsWebRenderTextureHost());
@@ -299,17 +299,17 @@ WebRenderCompositableHolder::ApplyAsyncI
wr::ToWrRect(rect),
holder->mFilter,
keys[0]);
}
builder.PopStackingContext();
}
wr::BuiltDisplayList dl;
- WrSize builderContentSize;
+ wr::WrSize builderContentSize;
builder.Finalize(builderContentSize, dl);
aApi->SetRootDisplayList(gfx::Color(0.f, 0.f, 0.f, 0.f), epoch, LayerSize(holder->mScBounds.width, holder->mScBounds.height),
pipelineId, builderContentSize,
dl.dl_desc, dl.dl.inner.data, dl.dl.inner.length);
}
DeleteOldAsyncImages(aApi);
mKeysToDelete.SwapElements(keysToDelete);
}
--- a/gfx/layers/wr/WebRenderCompositableHolder.h
+++ b/gfx/layers/wr/WebRenderCompositableHolder.h
@@ -70,18 +70,18 @@ public:
void AddAsyncImagePipeline(const wr::PipelineId& aPipelineId, WebRenderImageHost* aImageHost);
void RemoveAsyncImagePipeline(wr::WebRenderAPI* aApi, const wr::PipelineId& aPipelineId);
void UpdateAsyncImagePipeline(const wr::PipelineId& aPipelineId,
const LayerRect& aScBounds,
const gfx::Matrix4x4& aScTransform,
const gfx::MaybeIntSize& aScaleToSize,
- const WrImageRendering& aFilter,
- const WrMixBlendMode& aMixBlendMode);
+ const wr::WrImageRendering& aFilter,
+ const wr::WrMixBlendMode& aMixBlendMode);
void ApplyAsyncImages(wr::WebRenderAPI* aApi);
private:
void DeleteOldAsyncImages(wr::WebRenderAPI* aApi);
uint32_t GetNextResourceId() { return ++mResourceId; }
uint32_t GetNamespace() { return mIdNamespace; }
wr::ImageKey GetImageKey()
@@ -112,18 +112,18 @@ private:
AsyncImagePipelineHolder();
bool mInitialised;
bool mIsChanged;
bool mUseExternalImage;
LayerRect mScBounds;
gfx::Matrix4x4 mScTransform;
gfx::MaybeIntSize mScaleToSize;
- WrImageRendering mFilter;
- WrMixBlendMode mMixBlendMode;
+ wr::WrImageRendering mFilter;
+ wr::WrMixBlendMode mMixBlendMode;
RefPtr<WebRenderImageHost> mImageHost;
CompositableTextureHostRef mCurrentTexture;
nsTArray<wr::ImageKey> mKeys;
};
bool UpdateImageKeys(wr::WebRenderAPI* aApi,
bool& aUseExternalImage,
AsyncImagePipelineHolder* aHolder,
--- a/gfx/layers/wr/WebRenderContainerLayer.cpp
+++ b/gfx/layers/wr/WebRenderContainerLayer.cpp
@@ -109,17 +109,17 @@ WebRenderContainerLayer::RenderLayer(wr:
if (transformForSC && transform.IsIdentity()) {
// If the transform is an identity transform, strip it out so that WR
// doesn't turn this stacking context into a reference frame, as it
// affects positioning. Bug 1345577 tracks a better fix.
transformForSC = nullptr;
}
- nsTArray<WrFilterOp> filters;
+ nsTArray<wr::WrFilterOp> filters;
for (const CSSFilter& filter : this->GetFilterChain()) {
filters.AppendElement(wr::ToWrFilterOp(filter));
}
ScrollingLayersHelper scroller(this, aBuilder, aSc);
StackingContextHelper sc(aSc, aBuilder, this, animationsId, opacityForSC, transformForSC, filters);
LayerRect rect = Bounds();
@@ -145,14 +145,14 @@ WebRenderRefLayer::RenderLayer(wr::Displ
// we need to apply that transform to the bounds before we pass it on to WR.
// The conversion from ParentLayerPixel to LayerPixel below is a result of
// changing the reference layer from "this layer" to the "the layer that
// created aSc".
LayerRect rect = ViewAs<LayerPixel>(bounds,
PixelCastJustification::MovingDownToChildren);
DumpLayerInfo("RefLayer", rect);
- WrRect r = aSc.ToRelativeWrRect(rect);
+ wr::WrRect r = aSc.ToRelativeWrRect(rect);
aBuilder.PushIFrame(r, wr::AsPipelineId(mId));
}
} // namespace layers
} // namespace mozilla
--- a/gfx/layers/wr/WebRenderDisplayItemLayer.cpp
+++ b/gfx/layers/wr/WebRenderDisplayItemLayer.cpp
@@ -29,17 +29,17 @@ WebRenderDisplayItemLayer::RenderLayer(w
{
if (mVisibleRegion.IsEmpty()) {
return;
}
ScrollingLayersHelper scroller(this, aBuilder, aSc);
if (mItem) {
- WrSize contentSize; // this won't actually be used by anything
+ wr::WrSize contentSize; // this won't actually be used by anything
wr::DisplayListBuilder builder(WrBridge()->GetPipeline(), contentSize);
// We might have recycled this layer. Throw away the old commands.
mParentCommands.Clear();
mItem->CreateWebRenderCommands(builder, aSc, mParentCommands, WrManager(),
GetDisplayListBuilder());
builder.Finalize(contentSize, mBuiltDisplayList);
} else {
--- a/gfx/layers/wr/WebRenderImageLayer.cpp
+++ b/gfx/layers/wr/WebRenderImageLayer.cpp
@@ -154,17 +154,17 @@ WebRenderImageLayer::RenderLayer(wr::Dis
// context need to be done manually and pushed over to the parent side,
// where it will be done when we build the display list for the iframe.
// That happens in WebRenderCompositableHolder.
LayerRect rect = ViewAs<LayerPixel>(bounds,
PixelCastJustification::MovingDownToChildren);
DumpLayerInfo("Image Layer async", rect);
- WrRect r = aSc.ToRelativeWrRect(rect);
+ wr::WrRect r = aSc.ToRelativeWrRect(rect);
aBuilder.PushIFrame(r, mPipelineId.ref());
gfx::Matrix4x4 scTransform = GetTransform();
// Translate is applied as part of PushIFrame()
scTransform.PostTranslate(-rect.x, -rect.y, 0);
// Adjust transform as to apply origin
LayerPoint scOrigin = Bounds().TopLeft();
scTransform.PreTranslate(-scOrigin.x, -scOrigin.y, 0);
@@ -218,21 +218,21 @@ WebRenderImageLayer::RenderLayer(wr::Dis
wr::ImageRendering filter = wr::ToImageRendering(mSamplingFilter);
DumpLayerInfo("Image Layer", rect);
if (gfxPrefs::LayersDump()) {
printf_stderr("ImageLayer %p texture-filter=%s \n",
GetLayer(),
Stringify(filter).c_str());
}
- WrRect r = sc.ToRelativeWrRect(rect);
+ wr::WrRect r = sc.ToRelativeWrRect(rect);
aBuilder.PushImage(r, r, filter, mKey.value());
}
-Maybe<WrImageMask>
+Maybe<wr::WrImageMask>
WebRenderImageLayer::RenderMaskLayer(const StackingContextHelper& aSc,
const gfx::Matrix4x4& aTransform)
{
if (!mContainer) {
return Nothing();
}
CompositableType type = GetImageClientType();
@@ -270,17 +270,17 @@ WebRenderImageLayer::RenderMaskLayer(con
mContainer,
mKey,
mExternalImageId.ref());
if (mKey.isNothing()) {
return Nothing();
}
gfx::IntSize size = image->GetSize();
- WrImageMask imageMask;
+ wr::WrImageMask imageMask;
imageMask.image = mKey.value();
Rect maskRect = aTransform.TransformBounds(Rect(0, 0, size.width, size.height));
imageMask.rect = aSc.ToRelativeWrRect(ViewAs<LayerPixel>(maskRect));
imageMask.repeat = false;
return Some(imageMask);
}
} // namespace layers
--- a/gfx/layers/wr/WebRenderImageLayer.h
+++ b/gfx/layers/wr/WebRenderImageLayer.h
@@ -28,18 +28,18 @@ public:
protected:
virtual ~WebRenderImageLayer();
public:
Layer* GetLayer() override { return this; }
void RenderLayer(wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aSc) override;
- Maybe<WrImageMask> RenderMaskLayer(const StackingContextHelper& aSc,
- const gfx::Matrix4x4& aTransform) override;
+ Maybe<wr::WrImageMask> RenderMaskLayer(const StackingContextHelper& aSc,
+ const gfx::Matrix4x4& aTransform) override;
protected:
CompositableType GetImageClientType();
void AddWRVideoImage(size_t aChannelNumber);
wr::MaybeExternalImageId mExternalImageId;
Maybe<wr::ImageKey> mKey;
--- a/gfx/layers/wr/WebRenderLayer.cpp
+++ b/gfx/layers/wr/WebRenderLayer.cpp
@@ -26,26 +26,26 @@ WebRenderLayer::WrManager()
}
WebRenderBridgeChild*
WebRenderLayer::WrBridge()
{
return WrManager()->WrBridge();
}
-WrImageKey
+wr::WrImageKey
WebRenderLayer::GetImageKey()
{
- WrImageKey key;
+ wr::WrImageKey key;
key.mNamespace = WrBridge()->GetNamespace();
key.mHandle = WrBridge()->GetNextResourceId();
return key;
}
-Maybe<WrImageMask>
+Maybe<wr::WrImageMask>
WebRenderLayer::BuildWrMaskLayer(const StackingContextHelper& aRelativeTo)
{
if (GetLayer()->GetMaskLayer()) {
WebRenderLayer* maskLayer = ToWebRenderLayer(GetLayer()->GetMaskLayer());
gfx::Matrix4x4 transform = maskLayer->GetLayer()->GetTransform();
return maskLayer->RenderMaskLayer(aRelativeTo, transform);
}
@@ -106,32 +106,32 @@ WebRenderLayer::UpdateImageKey(ImageClie
return aOldKey;
}
// Delete old key, we are generating a new key.
if (aOldKey.isSome()) {
WrManager()->AddImageKeyForDiscard(aOldKey.value());
}
- WrImageKey key = GetImageKey();
+ wr::WrImageKey key = GetImageKey();
WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(aExternalImageId, key));
return Some(key);
}
void
WebRenderLayer::DumpLayerInfo(const char* aLayerType, const LayerRect& aRect)
{
if (!gfxPrefs::LayersDump()) {
return;
}
Layer* layer = GetLayer();
Matrix4x4 transform = layer->GetTransform();
LayerRect bounds = Bounds();
- WrMixBlendMode mixBlendMode = wr::ToWrMixBlendMode(GetLayer()->GetMixBlendMode());
+ wr::WrMixBlendMode mixBlendMode = wr::ToWrMixBlendMode(GetLayer()->GetMixBlendMode());
printf_stderr("%s %p using bounds=%s, transform=%s, rect=%s, clip=%s, mix-blend-mode=%s\n",
aLayerType,
layer,
Stringify(bounds).c_str(),
Stringify(transform).c_str(),
Stringify(aRect).c_str(),
layer->GetClipRect() ? Stringify(layer->GetClipRect().value()).c_str() : "none",
--- a/gfx/layers/wr/WebRenderLayer.h
+++ b/gfx/layers/wr/WebRenderLayer.h
@@ -21,17 +21,17 @@ class WebRenderLayerManager;
typedef gfx::Matrix4x4Typed<LayerPixel, LayerPixel> BoundsTransformMatrix;
class WebRenderLayer
{
public:
virtual Layer* GetLayer() = 0;
virtual void RenderLayer(wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aSc) = 0;
- virtual Maybe<WrImageMask> RenderMaskLayer(const StackingContextHelper& aSc,
+ virtual Maybe<wr::WrImageMask> RenderMaskLayer(const StackingContextHelper& aSc,
const gfx::Matrix4x4& aTransform)
{
MOZ_ASSERT(false);
return Nothing();
}
virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() { return nullptr; }
static inline WebRenderLayer*
@@ -42,27 +42,27 @@ public:
Maybe<wr::ImageKey> UpdateImageKey(ImageClientSingle* aImageClient,
ImageContainer* aContainer,
Maybe<wr::ImageKey>& aOldKey,
wr::ExternalImageId& aExternalImageId);
WebRenderLayerManager* WrManager();
WebRenderBridgeChild* WrBridge();
- WrImageKey GetImageKey();
+ wr::WrImageKey GetImageKey();
LayerRect Bounds();
LayerRect BoundsForStackingContext();
// Builds a WrImageMask from the mask layer on this layer, if there is one.
// The |aRelativeTo| parameter should be a reference to the stacking context
// that we want this mask to be relative to. This is usually the stacking
// context of the *parent* layer of |this|, because that is what the mask
// is relative to in the layer tree.
- Maybe<WrImageMask> BuildWrMaskLayer(const StackingContextHelper& aRelativeTo);
+ Maybe<wr::WrImageMask> BuildWrMaskLayer(const StackingContextHelper& aRelativeTo);
protected:
BoundsTransformMatrix BoundsTransform();
void DumpLayerInfo(const char* aLayerType, const LayerRect& aRect);
};
} // namespace layers
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -421,17 +421,17 @@ WebRenderLayerManager::PushItemAsImage(n
}
// Update current bounds to fallback data
fallbackData->SetGeometry(Move(geometry));
fallbackData->SetBounds(clippedBounds);
MOZ_ASSERT(fallbackData->GetKey());
- WrRect dest = aSc.ToRelativeWrRect(imageRect + offset);
+ wr::WrRect dest = aSc.ToRelativeWrRect(imageRect + offset);
aBuilder.PushImage(dest,
dest,
wr::ImageRendering::Auto,
fallbackData->GetKey().value());
return true;
}
void
@@ -465,17 +465,17 @@ WebRenderLayerManager::EndTransactionInt
mAnimationReadyTime = TimeStamp::Now();
LayoutDeviceIntSize size = mWidget->GetClientSize();
if (!WrBridge()->DPBegin(size.ToUnknownSize())) {
return false;
}
DiscardCompositorAnimations();
- WrSize contentSize { (float)size.width, (float)size.height };
+ wr::WrSize contentSize { (float)size.width, (float)size.height };
wr::DisplayListBuilder builder(WrBridge()->GetPipeline(), contentSize);
if (mEndTransactionWithoutLayers) {
// aDisplayList being null here means this is an empty transaction following a layers-free
// transaction, so we reuse the previously built displaylist.
if (aDisplayList && aDisplayListBuilder) {
StackingContextHelper sc;
mParentCommands.Clear();
--- a/gfx/layers/wr/WebRenderMessageUtils.h
+++ b/gfx/layers/wr/WebRenderMessageUtils.h
@@ -101,132 +101,132 @@ struct ParamTraits<mozilla::wr::Pipeline
Read(const Message* aMsg, PickleIterator* aIter, mozilla::wr::PipelineId* aResult)
{
return ReadParam(aMsg, aIter, &aResult->mNamespace)
&& ReadParam(aMsg, aIter, &aResult->mHandle);
}
};
template<>
-struct ParamTraits<WrImageFormat>
+struct ParamTraits<mozilla::wr::WrImageFormat>
: public ContiguousEnumSerializer<
- WrImageFormat,
- WrImageFormat::Invalid,
- WrImageFormat::Sentinel>
+ mozilla::wr::WrImageFormat,
+ mozilla::wr::WrImageFormat::Invalid,
+ mozilla::wr::WrImageFormat::Sentinel>
{
};
template<>
-struct ParamTraits<WrSize>
+struct ParamTraits<mozilla::wr::WrSize>
{
static void
- Write(Message* aMsg, const WrSize& aParam)
+ Write(Message* aMsg, const mozilla::wr::WrSize& aParam)
{
WriteParam(aMsg, aParam.width);
WriteParam(aMsg, aParam.height);
}
static bool
- Read(const Message* aMsg, PickleIterator* aIter, WrSize* aResult)
+ Read(const Message* aMsg, PickleIterator* aIter, mozilla::wr::WrSize* aResult)
{
return ReadParam(aMsg, aIter, &aResult->width)
&& ReadParam(aMsg, aIter, &aResult->height);
}
};
template<>
-struct ParamTraits<WrRect>
+struct ParamTraits<mozilla::wr::WrRect>
{
static void
- Write(Message* aMsg, const WrRect& aParam)
+ Write(Message* aMsg, const mozilla::wr::WrRect& aParam)
{
WriteParam(aMsg, aParam.x);
WriteParam(aMsg, aParam.y);
WriteParam(aMsg, aParam.width);
WriteParam(aMsg, aParam.height);
}
static bool
- Read(const Message* aMsg, PickleIterator* aIter, WrRect* aResult)
+ Read(const Message* aMsg, PickleIterator* aIter, mozilla::wr::WrRect* aResult)
{
return ReadParam(aMsg, aIter, &aResult->x)
&& ReadParam(aMsg, aIter, &aResult->y)
&& ReadParam(aMsg, aIter, &aResult->width)
&& ReadParam(aMsg, aIter, &aResult->height);
}
};
template<>
-struct ParamTraits<WrPoint>
+struct ParamTraits<mozilla::wr::WrPoint>
{
static void
- Write(Message* aMsg, const WrPoint& aParam)
+ Write(Message* aMsg, const mozilla::wr::WrPoint& aParam)
{
WriteParam(aMsg, aParam.x);
WriteParam(aMsg, aParam.y);
}
static bool
- Read(const Message* aMsg, PickleIterator* aIter, WrPoint* aResult)
+ Read(const Message* aMsg, PickleIterator* aIter, mozilla::wr::WrPoint* aResult)
{
return ReadParam(aMsg, aIter, &aResult->x) &&
ReadParam(aMsg, aIter, &aResult->y);
}
};
template<>
-struct ParamTraits<WrImageMask>
+struct ParamTraits<mozilla::wr::WrImageMask>
{
static void
- Write(Message* aMsg, const WrImageMask& aParam)
+ Write(Message* aMsg, const mozilla::wr::WrImageMask& aParam)
{
WriteParam(aMsg, aParam.image);
WriteParam(aMsg, aParam.rect);
WriteParam(aMsg, aParam.repeat);
}
static bool
- Read(const Message* aMsg, PickleIterator* aIter, WrImageMask* aResult)
+ Read(const Message* aMsg, PickleIterator* aIter, mozilla::wr::WrImageMask* aResult)
{
return ReadParam(aMsg, aIter, &aResult->image)
&& ReadParam(aMsg, aIter, &aResult->rect)
&& ReadParam(aMsg, aIter, &aResult->repeat);
}
};
template<>
-struct ParamTraits<WrImageRendering>
+struct ParamTraits<mozilla::wr::WrImageRendering>
: public ContiguousEnumSerializer<
- WrImageRendering,
- WrImageRendering::Auto,
- WrImageRendering::Sentinel>
+ mozilla::wr::WrImageRendering,
+ mozilla::wr::WrImageRendering::Auto,
+ mozilla::wr::WrImageRendering::Sentinel>
{
};
template<>
-struct ParamTraits<WrMixBlendMode>
+struct ParamTraits<mozilla::wr::WrMixBlendMode>
: public ContiguousEnumSerializer<
- WrMixBlendMode,
- WrMixBlendMode::Normal,
- WrMixBlendMode::Sentinel>
+ mozilla::wr::WrMixBlendMode,
+ mozilla::wr::WrMixBlendMode::Normal,
+ mozilla::wr::WrMixBlendMode::Sentinel>
{
};
template<>
-struct ParamTraits<WrBuiltDisplayListDescriptor>
+struct ParamTraits<mozilla::wr::WrBuiltDisplayListDescriptor>
{
static void
- Write(Message* aMsg, const WrBuiltDisplayListDescriptor& aParam)
+ Write(Message* aMsg, const mozilla::wr::WrBuiltDisplayListDescriptor& aParam)
{
WriteParam(aMsg, aParam.builder_start_time);
WriteParam(aMsg, aParam.builder_finish_time);
}
static bool
- Read(const Message* aMsg, PickleIterator* aIter, WrBuiltDisplayListDescriptor* aResult)
+ Read(const Message* aMsg, PickleIterator* aIter, mozilla::wr::WrBuiltDisplayListDescriptor* aResult)
{
return ReadParam(aMsg, aIter, &aResult->builder_start_time)
&& ReadParam(aMsg, aIter, &aResult->builder_finish_time);
}
};
} // namespace IPC
--- a/gfx/layers/wr/WebRenderPaintedLayer.cpp
+++ b/gfx/layers/wr/WebRenderPaintedLayer.cpp
@@ -94,21 +94,21 @@ WebRenderPaintedLayer::CreateWebRenderDi
const StackingContextHelper& aSc)
{
ScrollingLayersHelper scroller(this, aBuilder, aSc);
StackingContextHelper sc(aSc, aBuilder, this);
LayerRect rect = Bounds();
DumpLayerInfo("PaintedLayer", rect);
- WrImageKey key = GetImageKey();
+ wr::WrImageKey key = GetImageKey();
WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(mExternalImageId.value(), key));
WrManager()->AddImageKeyForDiscard(key);
- WrRect r = sc.ToRelativeWrRect(rect);
+ wr::WrRect r = sc.ToRelativeWrRect(rect);
aBuilder.PushImage(r, r, wr::ImageRendering::Auto, key);
}
void
WebRenderPaintedLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aSc)
{
if (!SetupExternalImages()) {
--- a/gfx/layers/wr/WebRenderPaintedLayerBlob.h
+++ b/gfx/layers/wr/WebRenderPaintedLayerBlob.h
@@ -48,16 +48,16 @@ public:
mInvalidRegion.Add(aRegion);
UpdateValidRegionAfterInvalidRegionChanged();
}
Layer* GetLayer() override { return this; }
void RenderLayer(wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aSc) override;
private:
- Maybe<WrImageKey> mImageKey;
+ Maybe<wr::WrImageKey> mImageKey;
LayerIntRect mImageBounds;
};
} // namespace layers
} // namespace mozilla
#endif // GFX_WEBRENDERPAINTEDLAYERBLOB_H
--- a/gfx/layers/wr/WebRenderTextureHost.cpp
+++ b/gfx/layers/wr/WebRenderTextureHost.cpp
@@ -173,18 +173,18 @@ WebRenderTextureHost::AddWRImage(wr::Web
MOZ_ASSERT(mWrappedTextureHost);
MOZ_ASSERT(mExternalImageId == aExtID);
mWrappedTextureHost->AddWRImage(aAPI, aImageKeys, aExtID);
}
void
WebRenderTextureHost::PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const WrRect& aBounds,
- const WrRect& aClip,
+ const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys)
{
MOZ_ASSERT(mWrappedTextureHost);
MOZ_ASSERT(aImageKeys.length() > 0);
mWrappedTextureHost->PushExternalImage(aBuilder,
aBounds,
--- a/gfx/layers/wr/WebRenderTextureHost.h
+++ b/gfx/layers/wr/WebRenderTextureHost.h
@@ -68,18 +68,18 @@ public:
virtual void GetWRImageKeys(nsTArray<wr::ImageKey>& aImageKeys,
const std::function<wr::ImageKey()>& aImageKeyAllocator) override;
virtual void AddWRImage(wr::WebRenderAPI* aAPI,
Range<const wr::ImageKey>& aImageKeys,
const wr::ExternalImageId& aExtID) override;
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
- const WrRect& aBounds,
- const WrRect& aClip,
+ const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aImageKeys) override;
protected:
void CreateRenderTextureHost(const SurfaceDescriptor& aDesc, TextureHost* aTexture);
RefPtr<TextureHost> mWrappedTextureHost;
wr::ExternalImageId mExternalImageId;
--- a/gfx/layers/wr/WebRenderUserData.cpp
+++ b/gfx/layers/wr/WebRenderUserData.cpp
@@ -66,17 +66,17 @@ WebRenderImageData::UpdateImageKey(Image
return mKey;
}
// Delete old key, we are generating a new key.
if (mKey) {
mWRManager->AddImageKeyForDiscard(mKey.value());
}
- WrImageKey key = WrBridge()->GetNextImageKey();
+ wr::WrImageKey key = WrBridge()->GetNextImageKey();
mWRManager->WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(mExternalImageId.value(), key));
mKey = Some(key);
return mKey;
}
already_AddRefed<ImageClient>
WebRenderImageData::GetImageClient()
@@ -88,18 +88,18 @@ WebRenderImageData::GetImageClient()
void
WebRenderImageData::CreateAsyncImageWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
ImageContainer* aContainer,
const StackingContextHelper& aSc,
const LayerRect& aBounds,
const LayerRect& aSCBounds,
const Matrix4x4& aSCTransform,
const MaybeIntSize& aScaleToSize,
- const WrImageRendering& aFilter,
- const WrMixBlendMode& aMixBlendMode)
+ const wr::WrImageRendering& aFilter,
+ const wr::WrMixBlendMode& aMixBlendMode)
{
MOZ_ASSERT(aContainer->IsAsync());
if (!mPipelineId) {
// Alloc async image pipeline id.
mPipelineId = Some(WrBridge()->GetCompositorBridgeChild()->GetNextPipelineId());
WrBridge()->AddPipelineIdForAsyncCompositable(mPipelineId.ref(),
aContainer->GetAsyncContainerHandle());
}
@@ -109,17 +109,17 @@ WebRenderImageData::CreateAsyncImageWebR
// Push IFrame for async image pipeline.
//
// We don't push a stacking context for this async image pipeline here.
// Instead, we do it inside the iframe that hosts the image. As a result,
// a bunch of the calculations normally done as part of that stacking
// context need to be done manually and pushed over to the parent side,
// where it will be done when we build the display list for the iframe.
// That happens in WebRenderCompositableHolder.
- WrRect r = aSc.ToRelativeWrRect(aBounds);
+ wr::WrRect r = aSc.ToRelativeWrRect(aBounds);
aBuilder.PushIFrame(r, mPipelineId.ref());
WrBridge()->AddWebRenderParentCommand(OpUpdateAsyncImagePipeline(mPipelineId.value(),
aSCBounds,
aSCTransform,
aScaleToSize,
aFilter,
aMixBlendMode));
--- a/gfx/layers/wr/WebRenderUserData.h
+++ b/gfx/layers/wr/WebRenderUserData.h
@@ -62,18 +62,18 @@ public:
void CreateAsyncImageWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
ImageContainer* aContainer,
const StackingContextHelper& aSc,
const LayerRect& aBounds,
const LayerRect& aSCBounds,
const gfx::Matrix4x4& aSCTransform,
const gfx::MaybeIntSize& aScaleToSize,
- const WrImageRendering& aFilter,
- const WrMixBlendMode& aMixBlendMode);
+ const wr::WrImageRendering& aFilter,
+ const wr::WrMixBlendMode& aMixBlendMode);
void CreateImageClientIfNeeded();
protected:
void CreateExternalImageIfNeeded();
wr::MaybeExternalImageId mExternalImageId;
Maybe<wr::ImageKey> mKey;
--- a/gfx/webrender_bindings/Moz2DImageRenderer.cpp
+++ b/gfx/webrender_bindings/Moz2DImageRenderer.cpp
@@ -85,20 +85,20 @@ static bool Moz2DRenderCallback(const Ra
return ret;
}
} // namespace
} // namespace
extern "C" {
-bool wr_moz2d_render_cb(const WrByteSlice blob,
+bool wr_moz2d_render_cb(const mozilla::wr::WrByteSlice blob,
uint32_t width, uint32_t height,
mozilla::wr::ImageFormat aFormat,
- MutByteSlice output)
+ mozilla::wr::MutByteSlice output)
{
return mozilla::wr::Moz2DRenderCallback(mozilla::wr::ByteSliceToRange(blob),
mozilla::gfx::IntSize(width, height),
mozilla::wr::WrImageFormatToSurfaceFormat(aFormat),
mozilla::wr::MutByteSliceToRange(output));
}
} // extern
--- a/gfx/webrender_bindings/RenderThread.cpp
+++ b/gfx/webrender_bindings/RenderThread.cpp
@@ -185,22 +185,22 @@ RenderThread::RunEvent(wr::WindowId aWin
}
aEvent->Run(*this, aWindowId);
aEvent = nullptr;
}
static void
NotifyDidRender(layers::CompositorBridgeParentBase* aBridge,
- WrRenderedEpochs* aEpochs,
+ wr::WrRenderedEpochs* aEpochs,
TimeStamp aStart,
TimeStamp aEnd)
{
- WrPipelineId pipeline;
- WrEpoch epoch;
+ wr::WrPipelineId pipeline;
+ wr::WrEpoch epoch;
while (wr_rendered_epochs_next(aEpochs, &pipeline, &epoch)) {
aBridge->NotifyDidCompositeToPipeline(pipeline, epoch, aStart, aEnd);
}
wr_rendered_epochs_delete(aEpochs);
}
void
RenderThread::UpdateAndRender(wr::WindowId aWindowId)
@@ -347,17 +347,17 @@ RenderThread::UnregisterExternalImage(ui
void
RenderThread::DeferredRenderTextureHostDestroy(RefPtr<RenderTextureHost>)
{
// Do nothing. Just decrease the ref-count of RenderTextureHost.
}
RenderTextureHost*
-RenderThread::GetRenderTexture(WrExternalImageId aExternalImageId)
+RenderThread::GetRenderTexture(wr::WrExternalImageId aExternalImageId)
{
MOZ_ASSERT(IsInRenderThread());
MutexAutoLock lock(mRenderTextureMapLock);
MOZ_ASSERT(mRenderTextures.GetWeak(aExternalImageId.mHandle));
return mRenderTextures.GetWeak(aExternalImageId.mHandle);
}
@@ -371,31 +371,31 @@ WebRenderThreadPool::~WebRenderThreadPoo
wr_thread_pool_delete(mThreadPool);
}
} // namespace wr
} // namespace mozilla
extern "C" {
-void wr_notifier_new_frame_ready(WrWindowId aWindowId)
+void wr_notifier_new_frame_ready(mozilla::wr::WrWindowId aWindowId)
{
mozilla::wr::RenderThread::Get()->IncPendingFrameCount(aWindowId);
mozilla::wr::RenderThread::Get()->NewFrameReady(mozilla::wr::WindowId(aWindowId));
}
-void wr_notifier_new_scroll_frame_ready(WrWindowId aWindowId, bool aCompositeNeeded)
+void wr_notifier_new_scroll_frame_ready(mozilla::wr::WrWindowId aWindowId, bool aCompositeNeeded)
{
// It is not necessary to update rendering with new_scroll_frame_ready.
// WebRenderBridgeParent::CompositeToTarget() is implemented to call
// WebRenderAPI::GenerateFrame() if it is necessary to trigger UpdateAndRender().
// See Bug 1377688.
}
-void wr_notifier_external_event(WrWindowId aWindowId, size_t aRawEvent)
+void wr_notifier_external_event(mozilla::wr::WrWindowId aWindowId, size_t aRawEvent)
{
mozilla::UniquePtr<mozilla::wr::RendererEvent> evt(
reinterpret_cast<mozilla::wr::RendererEvent*>(aRawEvent));
mozilla::wr::RenderThread::Get()->RunEvent(mozilla::wr::WindowId(aWindowId),
mozilla::Move(evt));
}
} // extern C
--- a/gfx/webrender_bindings/RenderThread.h
+++ b/gfx/webrender_bindings/RenderThread.h
@@ -29,20 +29,20 @@ class RenderThread;
/// A rayon thread pool that is shared by all WebRender instances within a process.
class WebRenderThreadPool {
public:
WebRenderThreadPool();
~WebRenderThreadPool();
- WrThreadPool* Raw() { return mThreadPool; }
+ wr::WrThreadPool* Raw() { return mThreadPool; }
protected:
- WrThreadPool* mThreadPool;
+ wr::WrThreadPool* mThreadPool;
};
/// Base class for an event that can be scheduled to run on the render thread.
///
/// The event can be passed through the same channels as regular WebRender messages
/// to preserve ordering.
class RendererEvent
--- a/gfx/webrender_bindings/RendererOGL.cpp
+++ b/gfx/webrender_bindings/RendererOGL.cpp
@@ -11,17 +11,17 @@
#include "mozilla/layers/CompositorThread.h"
#include "mozilla/webrender/RenderBufferTextureHost.h"
#include "mozilla/webrender/RenderTextureHostOGL.h"
#include "mozilla/widget/CompositorWidget.h"
namespace mozilla {
namespace wr {
-WrExternalImage LockExternalImage(void* aObj, WrExternalImageId aId, uint8_t aChannelIndex)
+wr::WrExternalImage LockExternalImage(void* aObj, wr::WrExternalImageId aId, uint8_t aChannelIndex)
{
RendererOGL* renderer = reinterpret_cast<RendererOGL*>(aObj);
RenderTextureHost* texture = renderer->GetRenderTexture(aId);
if (texture->AsBufferTextureHost()) {
RenderBufferTextureHost* bufferTexture = texture->AsBufferTextureHost();
MOZ_ASSERT(bufferTexture);
bufferTexture->Lock();
@@ -39,29 +39,29 @@ WrExternalImage LockExternalImage(void*
gfx::IntSize size = textureOGL->GetSize(aChannelIndex);
return NativeTextureToWrExternalImage(textureOGL->GetGLHandle(aChannelIndex),
0, 0,
size.width, size.height);
}
}
-void UnlockExternalImage(void* aObj, WrExternalImageId aId, uint8_t aChannelIndex)
+void UnlockExternalImage(void* aObj, wr::WrExternalImageId aId, uint8_t aChannelIndex)
{
RendererOGL* renderer = reinterpret_cast<RendererOGL*>(aObj);
RenderTextureHost* texture = renderer->GetRenderTexture(aId);
MOZ_ASSERT(texture);
texture->Unlock();
}
RendererOGL::RendererOGL(RefPtr<RenderThread>&& aThread,
RefPtr<gl::GLContext>&& aGL,
RefPtr<widget::CompositorWidget>&& aWidget,
wr::WindowId aWindowId,
- WrRenderer* aWrRenderer,
+ wr::WrRenderer* aWrRenderer,
layers::CompositorBridgeParentBase* aBridge)
: mThread(aThread)
, mGL(aGL)
, mWidget(aWidget)
, mWrRenderer(aWrRenderer)
, mBridge(aBridge)
, mWindowId(aWindowId)
{
@@ -79,20 +79,20 @@ RendererOGL::~RendererOGL()
if (!mGL->MakeCurrent()) {
gfxCriticalNote << "Failed to make render context current during destroying.";
// Leak resources!
return;
}
wr_renderer_delete(mWrRenderer);
}
-WrExternalImageHandler
+wr::WrExternalImageHandler
RendererOGL::GetExternalImageHandler()
{
- return WrExternalImageHandler {
+ return wr::WrExternalImageHandler {
this,
LockExternalImage,
UnlockExternalImage,
};
}
void
RendererOGL::Update()
@@ -165,22 +165,22 @@ RendererOGL::Resume()
}
void
RendererOGL::SetProfilerEnabled(bool aEnabled)
{
wr_renderer_set_profiler_enabled(mWrRenderer, aEnabled);
}
-WrRenderedEpochs*
+wr::WrRenderedEpochs*
RendererOGL::FlushRenderedEpochs()
{
return wr_renderer_flush_rendered_epochs(mWrRenderer);
}
RenderTextureHost*
-RendererOGL::GetRenderTexture(WrExternalImageId aExternalImageId)
+RendererOGL::GetRenderTexture(wr::WrExternalImageId aExternalImageId)
{
return mThread->GetRenderTexture(aExternalImageId);
}
} // namespace wr
} // namespace mozilla
--- a/gfx/webrender_bindings/RendererOGL.h
+++ b/gfx/webrender_bindings/RendererOGL.h
@@ -35,21 +35,21 @@ class RenderTextureHost;
/// Owns the WebRender renderer and GL context.
///
/// There is one renderer per window, all owned by the render thread.
/// This class is a similar abstraction to CompositorOGL except that it is used
/// on the render thread instead of the compositor thread.
class RendererOGL
{
- friend WrExternalImage LockExternalImage(void* aObj, WrExternalImageId aId, uint8_t aChannelIndex);
- friend void UnlockExternalImage(void* aObj, WrExternalImageId aId, uint8_t aChannelIndex);
+ friend wr::WrExternalImage LockExternalImage(void* aObj, wr::WrExternalImageId aId, uint8_t aChannelIndex);
+ friend void UnlockExternalImage(void* aObj, wr::WrExternalImageId aId, uint8_t aChannelIndex);
public:
- WrExternalImageHandler GetExternalImageHandler();
+ wr::WrExternalImageHandler GetExternalImageHandler();
/// This can be called on the render thread only.
void Update();
/// This can be called on the render thread only.
bool Render();
/// This can be called on the render thread only.
@@ -61,39 +61,39 @@ public:
/// This can be called on the render thread only.
~RendererOGL();
/// This can be called on the render thread only.
RendererOGL(RefPtr<RenderThread>&& aThread,
RefPtr<gl::GLContext>&& aGL,
RefPtr<widget::CompositorWidget>&&,
wr::WindowId aWindowId,
- WrRenderer* aWrRenderer,
+ wr::WrRenderer* aWrRenderer,
layers::CompositorBridgeParentBase* aBridge);
/// This can be called on the render thread only.
void Pause();
/// This can be called on the render thread only.
bool Resume();
layers::CompositorBridgeParentBase* GetCompositorBridge() { return mBridge; }
- WrRenderedEpochs* FlushRenderedEpochs();
+ wr::WrRenderedEpochs* FlushRenderedEpochs();
- RenderTextureHost* GetRenderTexture(WrExternalImageId aExternalImageId);
+ RenderTextureHost* GetRenderTexture(wr::WrExternalImageId aExternalImageId);
- WrRenderer* GetWrRenderer() { return mWrRenderer; }
+ wr::WrRenderer* GetWrRenderer() { return mWrRenderer; }
protected:
RefPtr<RenderThread> mThread;
RefPtr<gl::GLContext> mGL;
RefPtr<widget::CompositorWidget> mWidget;
- WrRenderer* mWrRenderer;
+ wr::WrRenderer* mWrRenderer;
layers::CompositorBridgeParentBase* mBridge;
wr::WindowId mWindowId;
};
} // namespace wr
} // namespace mozilla
#endif
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -18,17 +18,17 @@
namespace mozilla {
namespace wr {
using layers::Stringify;
class NewRenderer : public RendererEvent
{
public:
- NewRenderer(WrAPI** aApi, layers::CompositorBridgeParentBase* aBridge,
+ NewRenderer(wr::WrAPI** aApi, layers::CompositorBridgeParentBase* aBridge,
GLint* aMaxTextureSize,
bool* aUseANGLE,
RefPtr<widget::CompositorWidget>&& aWidget,
layers::SynchronousTask* aTask,
bool aEnableProfiler,
LayoutDeviceIntSize aSize)
: mWrApi(aApi)
, mMaxTextureSize(aMaxTextureSize)
@@ -65,42 +65,42 @@ public:
if (!gl || !gl->MakeCurrent()) {
gfxCriticalNote << "Failed GL context creation for WebRender: " << gfx::hexa(gl.get());
return;
}
gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, mMaxTextureSize);
*mUseANGLE = gl->IsANGLE();
- WrRenderer* wrRenderer = nullptr;
+ wr::WrRenderer* wrRenderer = nullptr;
if (!wr_window_new(aWindowId, mSize.width, mSize.height, gl.get(),
aRenderThread.ThreadPool().Raw(),
this->mEnableProfiler, mWrApi, &wrRenderer)) {
// wr_window_new puts a message into gfxCriticalNote if it returns false
return;
}
MOZ_ASSERT(wrRenderer);
RefPtr<RenderThread> thread = &aRenderThread;
auto renderer = MakeUnique<RendererOGL>(Move(thread),
Move(gl),
Move(mCompositorWidget),
aWindowId,
wrRenderer,
mBridge);
if (wrRenderer && renderer) {
- WrExternalImageHandler handler = renderer->GetExternalImageHandler();
+ wr::WrExternalImageHandler handler = renderer->GetExternalImageHandler();
wr_renderer_set_external_image_handler(wrRenderer, &handler);
}
aRenderThread.AddRenderer(aWindowId, Move(renderer));
}
private:
- WrAPI** mWrApi;
+ wr::WrAPI** mWrApi;
GLint* mMaxTextureSize;
bool* mUseANGLE;
layers::CompositorBridgeParentBase* mBridge;
RefPtr<widget::CompositorWidget> mCompositorWidget;
layers::SynchronousTask* mTask;
bool mEnableProfiler;
LayoutDeviceIntSize mSize;
};
@@ -138,17 +138,17 @@ WebRenderAPI::Create(bool aEnableProfile
LayoutDeviceIntSize aSize)
{
MOZ_ASSERT(aBridge);
MOZ_ASSERT(aWidget);
static uint64_t sNextId = 1;
auto id = NewWindowId(sNextId++);
- WrAPI* wrApi = nullptr;
+ wr::WrAPI* wrApi = nullptr;
GLint maxTextureSize = 0;
bool useANGLE = false;
// Dispatch a synchronous task because the WrApi object needs to be created
// on the render thread. If need be we could delay waiting on this task until
// the next time we need to access the WrApi object.
layers::SynchronousTask task("Create Renderer");
auto event = MakeUnique<NewRenderer>(&wrApi, aBridge, &maxTextureSize, &useANGLE,
@@ -159,82 +159,82 @@ WebRenderAPI::Create(bool aEnableProfile
if (!wrApi) {
return nullptr;
}
return RefPtr<WebRenderAPI>(new WebRenderAPI(wrApi, id, maxTextureSize, useANGLE)).forget();
}
-WrIdNamespace
+wr::WrIdNamespace
WebRenderAPI::GetNamespace() {
return wr_api_get_namespace(mWrApi);
}
WebRenderAPI::~WebRenderAPI()
{
layers::SynchronousTask task("Destroy WebRenderAPI");
auto event = MakeUnique<RemoveRenderer>(&task);
RunOnRenderThread(Move(event));
task.Wait();
wr_api_delete(mWrApi);
}
void
-WebRenderAPI::UpdateScrollPosition(const WrPipelineId& aPipelineId,
+WebRenderAPI::UpdateScrollPosition(const wr::WrPipelineId& aPipelineId,
const layers::FrameMetrics::ViewID& aScrollId,
- const WrPoint& aScrollPosition)
+ const wr::WrPoint& aScrollPosition)
{
wr_scroll_layer_with_id(mWrApi, aPipelineId, aScrollId, aScrollPosition);
}
void
WebRenderAPI::GenerateFrame()
{
wr_api_generate_frame(mWrApi);
}
void
-WebRenderAPI::GenerateFrame(const nsTArray<WrOpacityProperty>& aOpacityArray,
- const nsTArray<WrTransformProperty>& aTransformArray)
+WebRenderAPI::GenerateFrame(const nsTArray<wr::WrOpacityProperty>& aOpacityArray,
+ const nsTArray<wr::WrTransformProperty>& aTransformArray)
{
wr_api_generate_frame_with_properties(mWrApi,
aOpacityArray.IsEmpty() ?
nullptr : aOpacityArray.Elements(),
aOpacityArray.Length(),
aTransformArray.IsEmpty() ?
nullptr : aTransformArray.Elements(),
aTransformArray.Length());
}
void
WebRenderAPI::SetRootDisplayList(gfx::Color aBgColor,
Epoch aEpoch,
LayerSize aViewportSize,
- WrPipelineId pipeline_id,
+ wr::WrPipelineId pipeline_id,
const WrSize& content_size,
- WrBuiltDisplayListDescriptor dl_descriptor,
+ wr::WrBuiltDisplayListDescriptor dl_descriptor,
uint8_t *dl_data,
size_t dl_size)
{
wr_api_set_root_display_list(mWrApi,
ToWrColor(aBgColor),
aEpoch,
aViewportSize.width, aViewportSize.height,
pipeline_id,
content_size,
dl_descriptor,
dl_data,
dl_size);
}
void
WebRenderAPI::ClearRootDisplayList(Epoch aEpoch,
- WrPipelineId pipeline_id)
+ wr::WrPipelineId pipeline_id)
{
wr_api_clear_root_display_list(mWrApi, aEpoch, pipeline_id);
}
void
WebRenderAPI::SetWindowParameters(LayoutDeviceIntSize size)
{
wr_api_set_window_parameters(mWrApi, size.width, size.height);
@@ -421,17 +421,17 @@ WebRenderAPI::AddBlobImage(ImageKey key,
&aDescriptor,
RangeToByteSlice(aBytes));
}
void
WebRenderAPI::AddExternalImage(ImageKey key,
const ImageDescriptor& aDescriptor,
ExternalImageId aExtID,
- WrExternalImageBufferType aBufferType,
+ wr::WrExternalImageBufferType aBufferType,
uint8_t aChannelIndex)
{
wr_api_add_external_image(mWrApi,
key,
&aDescriptor,
aExtID,
aBufferType,
aChannelIndex);
@@ -513,17 +513,17 @@ WebRenderAPI::SetProfilerEnabled(bool aE
void
WebRenderAPI::RunOnRenderThread(UniquePtr<RendererEvent> aEvent)
{
auto event = reinterpret_cast<uintptr_t>(aEvent.release());
wr_api_send_external_event(mWrApi, event);
}
DisplayListBuilder::DisplayListBuilder(PipelineId aId,
- const WrSize& aContentSize)
+ const wr::WrSize& aContentSize)
{
MOZ_COUNT_CTOR(DisplayListBuilder);
mWrState = wr_state_new(aId, aContentSize);
}
DisplayListBuilder::~DisplayListBuilder()
{
MOZ_COUNT_DTOR(DisplayListBuilder);
@@ -538,62 +538,62 @@ DisplayListBuilder::Begin(const LayerInt
void
DisplayListBuilder::End()
{
wr_dp_end(mWrState);
}
void
-DisplayListBuilder::Finalize(WrSize& aOutContentSize,
+DisplayListBuilder::Finalize(wr::WrSize& aOutContentSize,
BuiltDisplayList& aOutDisplayList)
{
wr_api_finalize_builder(mWrState,
&aOutContentSize,
&aOutDisplayList.dl_desc,
&aOutDisplayList.dl.inner);
}
void
-DisplayListBuilder::PushStackingContext(const WrRect& aBounds,
+DisplayListBuilder::PushStackingContext(const wr::WrRect& aBounds,
const uint64_t& aAnimationId,
const float* aOpacity,
const gfx::Matrix4x4* aTransform,
- WrTransformStyle aTransformStyle,
- const WrMixBlendMode& aMixBlendMode,
- const nsTArray<WrFilterOp>& aFilters)
+ wr::WrTransformStyle aTransformStyle,
+ const wr::WrMixBlendMode& aMixBlendMode,
+ const nsTArray<wr::WrFilterOp>& aFilters)
{
- WrMatrix matrix;
+ wr::WrMatrix matrix;
if (aTransform) {
matrix = ToWrMatrix(*aTransform);
}
- const WrMatrix* maybeTransform = aTransform ? &matrix : nullptr;
+ const wr::WrMatrix* maybeTransform = aTransform ? &matrix : nullptr;
WRDL_LOG("PushStackingContext b=%s t=%s\n", Stringify(aBounds).c_str(),
aTransform ? Stringify(*aTransform).c_str() : "none");
wr_dp_push_stacking_context(mWrState, aBounds, aAnimationId, aOpacity,
maybeTransform, aTransformStyle, aMixBlendMode,
aFilters.Elements(), aFilters.Length());
}
void
DisplayListBuilder::PopStackingContext()
{
WRDL_LOG("PopStackingContext\n");
wr_dp_pop_stacking_context(mWrState);
}
void
-DisplayListBuilder::PushClip(const WrRect& aClipRect,
- const WrImageMask* aMask)
+DisplayListBuilder::PushClip(const wr::WrRect& aClipRect,
+ const wr::WrImageMask* aMask)
{
uint64_t clip_id = wr_dp_push_clip(mWrState, aClipRect, nullptr, 0, aMask);
WRDL_LOG("PushClip id=%" PRIu64 " r=%s m=%p b=%s\n", clip_id,
Stringify(aClipRect).c_str(), aMask,
aMask ? Stringify(aMask->rect).c_str() : "none");
- mClipIdStack.push_back(WrClipId { clip_id });
+ mClipIdStack.push_back(wr::WrClipId { clip_id });
}
void
DisplayListBuilder::PopClip()
{
WRDL_LOG("PopClip id=%" PRIu64 "\n", mClipIdStack.back().id);
mClipIdStack.pop_back();
wr_dp_pop_clip(mWrState);
@@ -604,18 +604,18 @@ DisplayListBuilder::PushBuiltDisplayList
{
wr_dp_push_built_display_list(mWrState,
dl.dl_desc,
&dl.dl.inner);
}
void
DisplayListBuilder::PushScrollLayer(const layers::FrameMetrics::ViewID& aScrollId,
- const WrRect& aContentRect,
- const WrRect& aClipRect)
+ const wr::WrRect& aContentRect,
+ const wr::WrRect& aClipRect)
{
WRDL_LOG("PushScrollLayer id=%" PRIu64 " co=%s cl=%s\n",
aScrollId, Stringify(aContentRect).c_str(), Stringify(aClipRect).c_str());
wr_dp_push_scroll_layer(mWrState, aScrollId, aContentRect, aClipRect);
if (!mScrollIdStack.empty()) {
auto it = mScrollParents.insert({aScrollId, mScrollIdStack.back()});
if (!it.second) { // aScrollId was already a key in mScrollParents
// so check that the parent value is the same.
@@ -630,258 +630,258 @@ DisplayListBuilder::PopScrollLayer()
{
WRDL_LOG("PopScrollLayer id=%" PRIu64 "\n", mScrollIdStack.back());
mScrollIdStack.pop_back();
wr_dp_pop_scroll_layer(mWrState);
}
void
DisplayListBuilder::PushClipAndScrollInfo(const layers::FrameMetrics::ViewID& aScrollId,
- const WrClipId* aClipId)
+ const wr::WrClipId* aClipId)
{
WRDL_LOG("PushClipAndScroll s=%" PRIu64 " c=%s\n", aScrollId,
aClipId ? Stringify(aClipId->id).c_str() : "none");
wr_dp_push_clip_and_scroll_info(mWrState, aScrollId,
aClipId ? &(aClipId->id) : nullptr);
}
void
DisplayListBuilder::PopClipAndScrollInfo()
{
WRDL_LOG("PopClipAndScroll\n");
wr_dp_pop_clip_and_scroll_info(mWrState);
}
void
-DisplayListBuilder::PushRect(const WrRect& aBounds,
- const WrRect& aClip,
- const WrColor& aColor)
+DisplayListBuilder::PushRect(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
+ const wr::WrColor& aColor)
{
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);
}
void
-DisplayListBuilder::PushLinearGradient(const WrRect& aBounds,
- const WrRect& aClip,
- const WrPoint& aStartPoint,
- const WrPoint& aEndPoint,
- const nsTArray<WrGradientStop>& aStops,
+DisplayListBuilder::PushLinearGradient(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
+ const wr::WrPoint& aStartPoint,
+ const wr::WrPoint& aEndPoint,
+ const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
- const WrSize aTileSize,
- const WrSize aTileSpacing)
+ const wr::WrSize aTileSize,
+ const wr::WrSize aTileSpacing)
{
wr_dp_push_linear_gradient(mWrState,
aBounds, aClip,
aStartPoint, aEndPoint,
aStops.Elements(), aStops.Length(),
aExtendMode,
aTileSize, aTileSpacing);
}
void
-DisplayListBuilder::PushRadialGradient(const WrRect& aBounds,
- const WrRect& aClip,
- const WrPoint& aCenter,
- const WrSize& aRadius,
- const nsTArray<WrGradientStop>& aStops,
+DisplayListBuilder::PushRadialGradient(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
+ const wr::WrPoint& aCenter,
+ const wr::WrSize& aRadius,
+ const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
- const WrSize aTileSize,
- const WrSize aTileSpacing)
+ const wr::WrSize aTileSize,
+ const wr::WrSize aTileSpacing)
{
wr_dp_push_radial_gradient(mWrState,
aBounds, aClip,
aCenter, aRadius,
aStops.Elements(), aStops.Length(),
aExtendMode,
aTileSize, aTileSpacing);
}
void
-DisplayListBuilder::PushImage(const WrRect& aBounds,
- const WrRect& aClip,
+DisplayListBuilder::PushImage(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageRendering aFilter,
wr::ImageKey aImage)
{
- WrSize size;
+ wr::WrSize size;
size.width = aBounds.width;
size.height = aBounds.height;
PushImage(aBounds, aClip, size, size, aFilter, aImage);
}
void
-DisplayListBuilder::PushImage(const WrRect& aBounds,
- const WrRect& aClip,
- const WrSize& aStretchSize,
- const WrSize& aTileSpacing,
+DisplayListBuilder::PushImage(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
+ const wr::WrSize& aStretchSize,
+ const wr::WrSize& aTileSpacing,
wr::ImageRendering aFilter,
wr::ImageKey aImage)
{
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, aClip, aStretchSize, aTileSpacing, aFilter, aImage);
}
void
-DisplayListBuilder::PushYCbCrPlanarImage(const WrRect& aBounds,
- const WrRect& aClip,
+DisplayListBuilder::PushYCbCrPlanarImage(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageKey aImageChannel0,
wr::ImageKey aImageChannel1,
wr::ImageKey aImageChannel2,
- WrYuvColorSpace aColorSpace,
+ wr::WrYuvColorSpace aColorSpace,
wr::ImageRendering aRendering)
{
wr_dp_push_yuv_planar_image(mWrState,
aBounds,
aClip,
aImageChannel0,
aImageChannel1,
aImageChannel2,
aColorSpace,
aRendering);
}
void
-DisplayListBuilder::PushNV12Image(const WrRect& aBounds,
- const WrRect& aClip,
+DisplayListBuilder::PushNV12Image(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageKey aImageChannel0,
wr::ImageKey aImageChannel1,
- WrYuvColorSpace aColorSpace,
+ wr::WrYuvColorSpace aColorSpace,
wr::ImageRendering aRendering)
{
wr_dp_push_yuv_NV12_image(mWrState,
aBounds,
aClip,
aImageChannel0,
aImageChannel1,
aColorSpace,
aRendering);
}
void
-DisplayListBuilder::PushYCbCrInterleavedImage(const WrRect& aBounds,
- const WrRect& aClip,
+DisplayListBuilder::PushYCbCrInterleavedImage(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageKey aImageChannel0,
- WrYuvColorSpace aColorSpace,
+ wr::WrYuvColorSpace aColorSpace,
wr::ImageRendering aRendering)
{
wr_dp_push_yuv_interleaved_image(mWrState,
aBounds,
aClip,
aImageChannel0,
aColorSpace,
aRendering);
}
void
-DisplayListBuilder::PushIFrame(const WrRect& aBounds,
+DisplayListBuilder::PushIFrame(const wr::WrRect& aBounds,
PipelineId aPipeline)
{
wr_dp_push_iframe(mWrState, aBounds, aPipeline);
}
void
-DisplayListBuilder::PushBorder(const WrRect& aBounds,
- const WrRect& aClip,
- const WrBorderWidths& aWidths,
- const Range<const WrBorderSide>& aSides,
- const WrBorderRadius& aRadius)
+DisplayListBuilder::PushBorder(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
+ const wr::WrBorderWidths& aWidths,
+ const Range<const wr::WrBorderSide>& aSides,
+ const wr::WrBorderRadius& aRadius)
{
MOZ_ASSERT(aSides.length() == 4);
if (aSides.length() != 4) {
return;
}
wr_dp_push_border(mWrState, aBounds, aClip,
aWidths, aSides[0], aSides[1], aSides[2], aSides[3], aRadius);
}
void
-DisplayListBuilder::PushBorderImage(const WrRect& aBounds,
- const WrRect& aClip,
- const WrBorderWidths& aWidths,
+DisplayListBuilder::PushBorderImage(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
+ const wr::WrBorderWidths& aWidths,
wr::ImageKey aImage,
- const WrNinePatchDescriptor& aPatch,
- const WrSideOffsets2Df32& aOutset,
- const WrRepeatMode& aRepeatHorizontal,
- const WrRepeatMode& aRepeatVertical)
+ const wr::WrNinePatchDescriptor& aPatch,
+ const wr::WrSideOffsets2Df32& aOutset,
+ const wr::WrRepeatMode& aRepeatHorizontal,
+ const wr::WrRepeatMode& aRepeatVertical)
{
wr_dp_push_border_image(mWrState, aBounds, aClip,
aWidths, aImage, aPatch, aOutset,
aRepeatHorizontal, aRepeatVertical);
}
void
-DisplayListBuilder::PushBorderGradient(const WrRect& aBounds,
- const WrRect& aClip,
- const WrBorderWidths& aWidths,
- const WrPoint& aStartPoint,
- const WrPoint& aEndPoint,
- const nsTArray<WrGradientStop>& aStops,
+DisplayListBuilder::PushBorderGradient(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
+ const wr::WrBorderWidths& aWidths,
+ const wr::WrPoint& aStartPoint,
+ const wr::WrPoint& aEndPoint,
+ const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
- const WrSideOffsets2Df32& aOutset)
+ const wr::WrSideOffsets2Df32& aOutset)
{
wr_dp_push_border_gradient(mWrState, aBounds, aClip,
aWidths, aStartPoint, aEndPoint,
aStops.Elements(), aStops.Length(),
aExtendMode, aOutset);
}
void
-DisplayListBuilder::PushBorderRadialGradient(const WrRect& aBounds,
- const WrRect& aClip,
- const WrBorderWidths& aWidths,
- const WrPoint& aCenter,
- const WrSize& aRadius,
- const nsTArray<WrGradientStop>& aStops,
+DisplayListBuilder::PushBorderRadialGradient(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
+ const wr::WrBorderWidths& aWidths,
+ const wr::WrPoint& aCenter,
+ const wr::WrSize& aRadius,
+ const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
- const WrSideOffsets2Df32& aOutset)
+ const wr::WrSideOffsets2Df32& aOutset)
{
wr_dp_push_border_radial_gradient(
mWrState, aBounds, aClip, aWidths, aCenter,
aRadius, aStops.Elements(), aStops.Length(),
aExtendMode, aOutset);
}
void
-DisplayListBuilder::PushText(const WrRect& aBounds,
- const WrRect& aClip,
+DisplayListBuilder::PushText(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
const gfx::Color& aColor,
wr::FontKey aFontKey,
- Range<const WrGlyphInstance> aGlyphBuffer,
+ Range<const wr::WrGlyphInstance> aGlyphBuffer,
float aGlyphSize)
{
wr_dp_push_text(mWrState, aBounds, aClip,
ToWrColor(aColor),
aFontKey,
&aGlyphBuffer[0], aGlyphBuffer.length(),
aGlyphSize);
}
void
-DisplayListBuilder::PushBoxShadow(const WrRect& aRect,
- const WrRect& aClip,
- const WrRect& aBoxBounds,
- const WrPoint& aOffset,
- const WrColor& aColor,
+DisplayListBuilder::PushBoxShadow(const wr::WrRect& aRect,
+ const wr::WrRect& aClip,
+ const wr::WrRect& aBoxBounds,
+ const wr::WrPoint& aOffset,
+ const wr::WrColor& aColor,
const float& aBlurRadius,
const float& aSpreadRadius,
const float& aBorderRadius,
- const WrBoxShadowClipMode& aClipMode)
+ const wr::WrBoxShadowClipMode& aClipMode)
{
wr_dp_push_box_shadow(mWrState, aRect, aClip,
aBoxBounds, aOffset, aColor,
aBlurRadius, aSpreadRadius, aBorderRadius,
aClipMode);
}
-Maybe<WrClipId>
+Maybe<wr::WrClipId>
DisplayListBuilder::TopmostClipId()
{
if (mClipIdStack.empty()) {
return Nothing();
}
return Some(mClipIdStack.back());
}
--- a/gfx/webrender_bindings/WebRenderAPI.h
+++ b/gfx/webrender_bindings/WebRenderAPI.h
@@ -43,36 +43,36 @@ public:
/// This can be called on the compositor thread only.
static already_AddRefed<WebRenderAPI> Create(bool aEnableProfiler,
layers::CompositorBridgeParentBase* aBridge,
RefPtr<widget::CompositorWidget>&& aWidget,
LayoutDeviceIntSize aSize);
wr::WindowId GetId() const { return mId; }
- void UpdateScrollPosition(const WrPipelineId& aPipelineId,
+ void UpdateScrollPosition(const wr::WrPipelineId& aPipelineId,
const layers::FrameMetrics::ViewID& aScrollId,
- const WrPoint& aScrollPosition);
+ const wr::WrPoint& aScrollPosition);
void GenerateFrame();
- void GenerateFrame(const nsTArray<WrOpacityProperty>& aOpacityArray,
- const nsTArray<WrTransformProperty>& aTransformArray);
+ void GenerateFrame(const nsTArray<wr::WrOpacityProperty>& aOpacityArray,
+ const nsTArray<wr::WrTransformProperty>& aTransformArray);
void SetWindowParameters(LayoutDeviceIntSize size);
void SetRootDisplayList(gfx::Color aBgColor,
Epoch aEpoch,
LayerSize aViewportSize,
- WrPipelineId pipeline_id,
- const WrSize& content_size,
- WrBuiltDisplayListDescriptor dl_descriptor,
+ wr::WrPipelineId pipeline_id,
+ const wr::WrSize& content_size,
+ wr::WrBuiltDisplayListDescriptor dl_descriptor,
uint8_t *dl_data,
size_t dl_size);
void ClearRootDisplayList(Epoch aEpoch,
- WrPipelineId pipeline_id);
+ wr::WrPipelineId pipeline_id);
void SetRootPipeline(wr::PipelineId aPipeline);
void AddImage(wr::ImageKey aKey,
const ImageDescriptor& aDescriptor,
Range<uint8_t> aBytes);
void AddBlobImage(wr::ImageKey aKey,
@@ -102,218 +102,218 @@ public:
void SetProfilerEnabled(bool aEnabled);
void RunOnRenderThread(UniquePtr<RendererEvent> aEvent);
void Readback(gfx::IntSize aSize, uint8_t *aBuffer, uint32_t aBufferSize);
void Pause();
bool Resume();
- WrIdNamespace GetNamespace();
+ wr::WrIdNamespace GetNamespace();
GLint GetMaxTextureSize() const { return mMaxTextureSize; }
bool GetUseANGLE() const { return mUseANGLE; }
protected:
- WebRenderAPI(WrAPI* aRawApi, wr::WindowId aId, GLint aMaxTextureSize, bool aUseANGLE)
+ WebRenderAPI(wr::WrAPI* aRawApi, wr::WindowId aId, GLint aMaxTextureSize, bool aUseANGLE)
: mWrApi(aRawApi)
, mId(aId)
, mMaxTextureSize(aMaxTextureSize)
, mUseANGLE(aUseANGLE)
{}
~WebRenderAPI();
// Should be used only for shutdown handling
void WaitFlushed();
- WrAPI* mWrApi;
+ wr::WrAPI* mWrApi;
wr::WindowId mId;
GLint mMaxTextureSize;
bool mUseANGLE;
friend class DisplayListBuilder;
friend class layers::WebRenderBridgeParent;
};
/// This is a simple C++ wrapper around WrState defined in the rust bindings.
/// We may want to turn this into a direct wrapper on top of WebRenderFrameBuilder
/// instead, so the interface may change a bit.
class DisplayListBuilder {
public:
explicit DisplayListBuilder(wr::PipelineId aId,
- const WrSize& aContentSize);
+ const wr::WrSize& aContentSize);
DisplayListBuilder(DisplayListBuilder&&) = default;
~DisplayListBuilder();
void Begin(const LayerIntSize& aSize);
void End();
- void Finalize(WrSize& aOutContentSize,
+ void Finalize(wr::WrSize& aOutContentSize,
wr::BuiltDisplayList& aOutDisplayList);
- void PushStackingContext(const WrRect& aBounds, // TODO: We should work with strongly typed rects
+ void PushStackingContext(const wr::WrRect& aBounds, // TODO: We should work with strongly typed rects
const uint64_t& aAnimationId,
const float* aOpacity,
const gfx::Matrix4x4* aTransform,
- WrTransformStyle aTransformStyle,
- const WrMixBlendMode& aMixBlendMode,
- const nsTArray<WrFilterOp>& aFilters);
+ wr::WrTransformStyle aTransformStyle,
+ const wr::WrMixBlendMode& aMixBlendMode,
+ const nsTArray<wr::WrFilterOp>& aFilters);
void PopStackingContext();
- void PushClip(const WrRect& aClipRect,
- const WrImageMask* aMask);
+ void PushClip(const wr::WrRect& aClipRect,
+ const wr::WrImageMask* aMask);
void PopClip();
void PushBuiltDisplayList(wr::BuiltDisplayList &dl);
void PushScrollLayer(const layers::FrameMetrics::ViewID& aScrollId,
- const WrRect& aContentRect, // TODO: We should work with strongly typed rects
- const WrRect& aClipRect);
+ const wr::WrRect& aContentRect, // TODO: We should work with strongly typed rects
+ const wr::WrRect& aClipRect);
void PopScrollLayer();
void PushClipAndScrollInfo(const layers::FrameMetrics::ViewID& aScrollId,
- const WrClipId* aClipId);
+ const wr::WrClipId* aClipId);
void PopClipAndScrollInfo();
- void PushRect(const WrRect& aBounds,
- const WrRect& aClip,
- const WrColor& aColor);
+ void PushRect(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
+ const wr::WrColor& aColor);
- void PushLinearGradient(const WrRect& aBounds,
- const WrRect& aClip,
- const WrPoint& aStartPoint,
- const WrPoint& aEndPoint,
- const nsTArray<WrGradientStop>& aStops,
+ void PushLinearGradient(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
+ const wr::WrPoint& aStartPoint,
+ const wr::WrPoint& aEndPoint,
+ const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
- const WrSize aTileSize,
- const WrSize aTileSpacing);
+ const wr::WrSize aTileSize,
+ const wr::WrSize aTileSpacing);
- void PushRadialGradient(const WrRect& aBounds,
- const WrRect& aClip,
- const WrPoint& aCenter,
- const WrSize& aRadius,
- const nsTArray<WrGradientStop>& aStops,
+ void PushRadialGradient(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
+ const wr::WrPoint& aCenter,
+ const wr::WrSize& aRadius,
+ const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
- const WrSize aTileSize,
- const WrSize aTileSpacing);
+ const wr::WrSize aTileSize,
+ const wr::WrSize aTileSpacing);
- void PushImage(const WrRect& aBounds,
- const WrRect& aClip,
+ void PushImage(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageRendering aFilter,
wr::ImageKey aImage);
- void PushImage(const WrRect& aBounds,
- const WrRect& aClip,
- const WrSize& aStretchSize,
- const WrSize& aTileSpacing,
+ void PushImage(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
+ const wr::WrSize& aStretchSize,
+ const wr::WrSize& aTileSpacing,
wr::ImageRendering aFilter,
wr::ImageKey aImage);
- void PushYCbCrPlanarImage(const WrRect& aBounds,
- const WrRect& aClip,
+ void PushYCbCrPlanarImage(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageKey aImageChannel0,
wr::ImageKey aImageChannel1,
wr::ImageKey aImageChannel2,
- WrYuvColorSpace aColorSpace,
+ wr::WrYuvColorSpace aColorSpace,
wr::ImageRendering aFilter);
- void PushNV12Image(const WrRect& aBounds,
- const WrRect& aClip,
+ void PushNV12Image(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageKey aImageChannel0,
wr::ImageKey aImageChannel1,
- WrYuvColorSpace aColorSpace,
+ wr::WrYuvColorSpace aColorSpace,
wr::ImageRendering aFilter);
- void PushYCbCrInterleavedImage(const WrRect& aBounds,
- const WrRect& aClip,
+ void PushYCbCrInterleavedImage(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
wr::ImageKey aImageChannel0,
- WrYuvColorSpace aColorSpace,
+ wr::WrYuvColorSpace aColorSpace,
wr::ImageRendering aFilter);
- void PushIFrame(const WrRect& aBounds,
+ void PushIFrame(const wr::WrRect& aBounds,
wr::PipelineId aPipeline);
// XXX WrBorderSides are passed with Range.
// It is just to bypass compiler bug. See Bug 1357734.
- void PushBorder(const WrRect& aBounds,
- const WrRect& aClip,
- const WrBorderWidths& aWidths,
- const Range<const WrBorderSide>& aSides,
- const WrBorderRadius& aRadius);
+ void PushBorder(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
+ const wr::WrBorderWidths& aWidths,
+ const Range<const wr::WrBorderSide>& aSides,
+ const wr::WrBorderRadius& aRadius);
- void PushBorderImage(const WrRect& aBounds,
- const WrRect& aClip,
- const WrBorderWidths& aWidths,
+ void PushBorderImage(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
+ const wr::WrBorderWidths& aWidths,
wr::ImageKey aImage,
- const WrNinePatchDescriptor& aPatch,
- const WrSideOffsets2Df32& aOutset,
- const WrRepeatMode& aRepeatHorizontal,
- const WrRepeatMode& aRepeatVertical);
+ const wr::WrNinePatchDescriptor& aPatch,
+ const wr::WrSideOffsets2Df32& aOutset,
+ const wr::WrRepeatMode& aRepeatHorizontal,
+ const wr::WrRepeatMode& aRepeatVertical);
- void PushBorderGradient(const WrRect& aBounds,
- const WrRect& aClip,
- const WrBorderWidths& aWidths,
- const WrPoint& aStartPoint,
- const WrPoint& aEndPoint,
- const nsTArray<WrGradientStop>& aStops,
+ void PushBorderGradient(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
+ const wr::WrBorderWidths& aWidths,
+ const wr::WrPoint& aStartPoint,
+ const wr::WrPoint& aEndPoint,
+ const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
- const WrSideOffsets2Df32& aOutset);
+ const wr::WrSideOffsets2Df32& aOutset);
- void PushBorderRadialGradient(const WrRect& aBounds,
- const WrRect& aClip,
- const WrBorderWidths& aWidths,
- const WrPoint& aCenter,
- const WrSize& aRadius,
- const nsTArray<WrGradientStop>& aStops,
+ void PushBorderRadialGradient(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
+ const wr::WrBorderWidths& aWidths,
+ const wr::WrPoint& aCenter,
+ const wr::WrSize& aRadius,
+ const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
- const WrSideOffsets2Df32& aOutset);
+ const wr::WrSideOffsets2Df32& aOutset);
- void PushText(const WrRect& aBounds,
- const WrRect& aClip,
+ void PushText(const wr::WrRect& aBounds,
+ const wr::WrRect& aClip,
const gfx::Color& aColor,
wr::FontKey aFontKey,
- Range<const WrGlyphInstance> aGlyphBuffer,
+ Range<const wr::WrGlyphInstance> aGlyphBuffer,
float aGlyphSize);
- void PushBoxShadow(const WrRect& aRect,
- const WrRect& aClip,
- const WrRect& aBoxBounds,
- const WrPoint& aOffset,
- const WrColor& aColor,
+ void PushBoxShadow(const wr::WrRect& aRect,
+ const wr::WrRect& aClip,
+ const wr::WrRect& aBoxBounds,
+ const wr::WrPoint& aOffset,
+ const wr::WrColor& aColor,
const float& aBlurRadius,
const float& aSpreadRadius,
const float& aBorderRadius,
- const WrBoxShadowClipMode& aClipMode);
+ const wr::WrBoxShadowClipMode& aClipMode);
// 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.
- Maybe<WrClipId> TopmostClipId();
+ Maybe<wr::WrClipId> TopmostClipId();
// Returns the scroll id that was pushed just before the given scroll id. This
// function returns Nothing() if the given scrollid has not been encountered,
// or if it is the rootmost scroll id (and therefore has no ancestor).
Maybe<layers::FrameMetrics::ViewID> ParentScrollIdFor(layers::FrameMetrics::ViewID aScrollId);
// Try to avoid using this when possible.
- WrState* Raw() { return mWrState; }
+ wr::WrState* Raw() { return mWrState; }
protected:
- WrState* mWrState;
+ wr::WrState* mWrState;
// Track the stack of clip ids and scroll layer ids that have been pushed
// (by PushClip and PushScrollLayer, respectively) and are still active.
// This is helpful for knowing e.g. what the ancestor scroll id of a particular
// scroll id is, and doing other "queries" of current state.
- std::vector<WrClipId> mClipIdStack;
+ std::vector<wr::WrClipId> mClipIdStack;
std::vector<layers::FrameMetrics::ViewID> mScrollIdStack;
// Track the parent scroll id of each scroll id that we encountered.
std::unordered_map<layers::FrameMetrics::ViewID, layers::FrameMetrics::ViewID> mScrollParents;
friend class WebRenderAPI;
};
-Maybe<WrImageFormat>
+Maybe<wr::WrImageFormat>
SurfaceFormatToWrImageFormat(gfx::SurfaceFormat aFormat);
} // namespace wr
} // namespace mozilla
#endif
--- a/gfx/webrender_bindings/WebRenderTypes.h
+++ b/gfx/webrender_bindings/WebRenderTypes.h
@@ -12,65 +12,64 @@
#include "mozilla/gfx/Types.h"
#include "mozilla/gfx/Tools.h"
#include "mozilla/layers/LayersTypes.h"
#include "mozilla/Range.h"
#include "Units.h"
#include "RoundedRect.h"
#include "nsStyleConsts.h"
-typedef mozilla::Maybe<WrImageMask> MaybeImageMask;
-
namespace mozilla {
namespace wr {
-typedef WrGradientExtendMode GradientExtendMode;
-typedef WrMixBlendMode MixBlendMode;
-typedef WrImageRendering ImageRendering;
-typedef WrImageFormat ImageFormat;
-typedef WrWindowId WindowId;
-typedef WrPipelineId PipelineId;
-typedef WrImageKey ImageKey;
-typedef WrFontKey FontKey;
-typedef WrEpoch Epoch;
-typedef WrExternalImageId ExternalImageId;
+typedef wr::WrGradientExtendMode GradientExtendMode;
+typedef wr::WrMixBlendMode MixBlendMode;
+typedef wr::WrImageRendering ImageRendering;
+typedef wr::WrImageFormat ImageFormat;
+typedef wr::WrWindowId WindowId;
+typedef wr::WrPipelineId PipelineId;
+typedef wr::WrImageKey ImageKey;
+typedef wr::WrFontKey FontKey;
+typedef wr::WrEpoch Epoch;
+typedef wr::WrExternalImageId ExternalImageId;
+typedef mozilla::Maybe<mozilla::wr::WrImageMask> MaybeImageMask;
typedef Maybe<ExternalImageId> MaybeExternalImageId;
inline WindowId NewWindowId(uint64_t aId) {
WindowId id;
id.mHandle = aId;
return id;
}
inline Epoch NewEpoch(uint32_t aEpoch) {
Epoch e;
e.mHandle = aEpoch;
return e;
}
-inline Maybe<WrImageFormat>
+inline Maybe<wr::WrImageFormat>
SurfaceFormatToWrImageFormat(gfx::SurfaceFormat aFormat) {
switch (aFormat) {
case gfx::SurfaceFormat::R8G8B8X8:
// TODO: use RGBA + opaque flag
- return Some(WrImageFormat::BGRA8);
+ return Some(wr::WrImageFormat::BGRA8);
case gfx::SurfaceFormat::B8G8R8X8:
// TODO: WebRender will have a BGRA + opaque flag for this but does not
// have it yet (cf. issue #732).
case gfx::SurfaceFormat::B8G8R8A8:
- return Some(WrImageFormat::BGRA8);
+ return Some(wr::WrImageFormat::BGRA8);
case gfx::SurfaceFormat::B8G8R8:
- return Some(WrImageFormat::RGB8);
+ return Some(wr::WrImageFormat::RGB8);
case gfx::SurfaceFormat::A8:
- return Some(WrImageFormat::A8);
+ return Some(wr::WrImageFormat::A8);
case gfx::SurfaceFormat::R8G8:
- return Some(WrImageFormat::RG8);
+ return Some(wr::WrImageFormat::RG8);
case gfx::SurfaceFormat::UNKNOWN:
- return Some(WrImageFormat::Invalid);
+ return Some(wr::WrImageFormat::Invalid);
default:
return Nothing();
}
}
inline gfx::SurfaceFormat
WrImageFormatToSurfaceFormat(ImageFormat aFormat) {
switch (aFormat) {
@@ -80,17 +79,17 @@ WrImageFormatToSurfaceFormat(ImageFormat
return gfx::SurfaceFormat::A8;
case ImageFormat::RGB8:
return gfx::SurfaceFormat::B8G8R8;
default:
return gfx::SurfaceFormat::UNKNOWN;
}
}
-struct ImageDescriptor: public WrImageDescriptor {
+struct ImageDescriptor: public wr::WrImageDescriptor {
ImageDescriptor(const gfx::IntSize& aSize, gfx::SurfaceFormat aFormat)
{
format = SurfaceFormatToWrImageFormat(aFormat).value();
width = aSize.width;
height = aSize.height;
stride = 0;
is_opaque = gfx::IsOpaqueFormat(aFormat);
}
@@ -189,316 +188,316 @@ static inline MixBlendMode ToWrMixBlendM
return MixBlendMode::Color;
case gfx::CompositionOp::OP_LUMINOSITY:
return MixBlendMode::Luminosity;
default:
return MixBlendMode::Normal;
}
}
-static inline WrColor ToWrColor(const gfx::Color& color)
+static inline wr::WrColor ToWrColor(const gfx::Color& color)
{
- WrColor c;
+ wr::WrColor c;
c.r = color.r;
c.g = color.g;
c.b = color.b;
c.a = color.a;
return c;
}
template<class T>
-static inline WrPoint ToWrPoint(const gfx::PointTyped<T>& point)
+static inline wr::WrPoint ToWrPoint(const gfx::PointTyped<T>& point)
{
- WrPoint p;
+ wr::WrPoint p;
p.x = point.x;
p.y = point.y;
return p;
}
template<class T>
-static inline WrPoint ToWrPoint(const gfx::IntPointTyped<T>& point)
+static inline wr::WrPoint ToWrPoint(const gfx::IntPointTyped<T>& point)
{
return ToWrPoint(IntPointToPoint(point));
}
-static inline WrPoint ToWrPoint(const gfx::Point& point)
+static inline wr::WrPoint ToWrPoint(const gfx::Point& point)
{
- WrPoint p;
+ wr::WrPoint p;
p.x = point.x;
p.y = point.y;
return p;
}
template<class T>
-static inline WrRect ToWrRect(const gfx::RectTyped<T>& rect)
+static inline wr::WrRect ToWrRect(const gfx::RectTyped<T>& rect)
{
- WrRect r;
+ wr::WrRect r;
r.x = rect.x;
r.y = rect.y;
r.width = rect.width;
r.height = rect.height;
return r;
}
-static inline WrRect ToWrRect(const gfxRect rect)
+static inline wr::WrRect ToWrRect(const gfxRect rect)
{
- WrRect r;
+ wr::WrRect r;
r.x = rect.x;
r.y = rect.y;
r.width = rect.width;
r.height = rect.height;
return r;
}
template<class T>
-static inline WrRect ToWrRect(const gfx::IntRectTyped<T>& rect)
+static inline wr::WrRect ToWrRect(const gfx::IntRectTyped<T>& rect)
{
return ToWrRect(IntRectToRect(rect));
}
template<class T>
-static inline WrSize ToWrSize(const gfx::SizeTyped<T>& size)
+static inline wr::WrSize ToWrSize(const gfx::SizeTyped<T>& size)
{
- WrSize ls;
+ wr::WrSize ls;
ls.width = size.width;
ls.height = size.height;
return ls;
}
-static inline WrComplexClipRegion ToWrComplexClipRegion(const RoundedRect& rect)
+static inline wr::WrComplexClipRegion ToWrComplexClipRegion(const RoundedRect& rect)
{
- WrComplexClipRegion ret;
+ wr::WrComplexClipRegion ret;
ret.rect = ToWrRect(rect.rect);
ret.radii.top_left = ToWrSize(rect.corners.radii[mozilla::eCornerTopLeft]);
ret.radii.top_right = ToWrSize(rect.corners.radii[mozilla::eCornerTopRight]);
ret.radii.bottom_left = ToWrSize(rect.corners.radii[mozilla::eCornerBottomLeft]);
ret.radii.bottom_right = ToWrSize(rect.corners.radii[mozilla::eCornerBottomRight]);
return ret;
}
template<class T>
-static inline WrSize ToWrSize(const gfx::IntSizeTyped<T>& size)
+static inline wr::WrSize ToWrSize(const gfx::IntSizeTyped<T>& size)
{
return ToWrSize(IntSizeToSize(size));
}
template<class S, class T>
-static inline WrMatrix ToWrMatrix(const gfx::Matrix4x4Typed<S, T>& m)
+static inline wr::WrMatrix ToWrMatrix(const gfx::Matrix4x4Typed<S, T>& m)
{
- WrMatrix transform;
+ wr::WrMatrix transform;
static_assert(sizeof(m.components) == sizeof(transform.values),
"Matrix components size mismatch!");
memcpy(transform.values, m.components, sizeof(transform.values));
return transform;
}
-static inline WrBorderStyle ToWrBorderStyle(const uint8_t& style)
+static inline wr::WrBorderStyle ToWrBorderStyle(const uint8_t& style)
{
switch (style) {
case NS_STYLE_BORDER_STYLE_NONE:
- return WrBorderStyle::None;
+ return wr::WrBorderStyle::None;
case NS_STYLE_BORDER_STYLE_SOLID:
- return WrBorderStyle::Solid;
+ return wr::WrBorderStyle::Solid;
case NS_STYLE_BORDER_STYLE_DOUBLE:
- return WrBorderStyle::Double;
+ return wr::WrBorderStyle::Double;
case NS_STYLE_BORDER_STYLE_DOTTED:
- return WrBorderStyle::Dotted;
+ return wr::WrBorderStyle::Dotted;
case NS_STYLE_BORDER_STYLE_DASHED:
- return WrBorderStyle::Dashed;
+ return wr::WrBorderStyle::Dashed;
case NS_STYLE_BORDER_STYLE_HIDDEN:
- return WrBorderStyle::Hidden;
+ return wr::WrBorderStyle::Hidden;
case NS_STYLE_BORDER_STYLE_GROOVE:
- return WrBorderStyle::Groove;
+ return wr::WrBorderStyle::Groove;
case NS_STYLE_BORDER_STYLE_RIDGE:
- return WrBorderStyle::Ridge;
+ return wr::WrBorderStyle::Ridge;
case NS_STYLE_BORDER_STYLE_INSET:
- return WrBorderStyle::Inset;
+ return wr::WrBorderStyle::Inset;
case NS_STYLE_BORDER_STYLE_OUTSET:
- return WrBorderStyle::Outset;
+ return wr::WrBorderStyle::Outset;
default:
MOZ_ASSERT(false);
}
- return WrBorderStyle::None;
+ return wr::WrBorderStyle::None;
}
-static inline WrBorderSide ToWrBorderSide(const gfx::Color& color, const uint8_t& style)
+static inline wr::WrBorderSide ToWrBorderSide(const gfx::Color& color, const uint8_t& style)
{
- WrBorderSide bs;
+ wr::WrBorderSide bs;
bs.color = ToWrColor(color);
bs.style = ToWrBorderStyle(style);
return bs;
}
-static inline WrBorderRadius ToWrUniformBorderRadius(const LayerSize& aSize)
+static inline wr::WrBorderRadius ToWrUniformBorderRadius(const LayerSize& aSize)
{
- WrBorderRadius br;
+ wr::WrBorderRadius br;
br.top_left = ToWrSize(aSize);
br.top_right = ToWrSize(aSize);
br.bottom_left = ToWrSize(aSize);
br.bottom_right = ToWrSize(aSize);
return br;
}
-static inline WrBorderRadius ToWrBorderRadius(const LayerSize& topLeft, const LayerSize& topRight,
- const LayerSize& bottomLeft, const LayerSize& bottomRight)
+static inline wr::WrBorderRadius ToWrBorderRadius(const LayerSize& topLeft, const LayerSize& topRight,
+ const LayerSize& bottomLeft, const LayerSize& bottomRight)
{
- WrBorderRadius br;
+ wr::WrBorderRadius br;
br.top_left = ToWrSize(topLeft);
br.top_right = ToWrSize(topRight);
br.bottom_left = ToWrSize(bottomLeft);
br.bottom_right = ToWrSize(bottomRight);
return br;
}
-static inline WrBorderWidths ToWrBorderWidths(float top, float right, float bottom, float left)
+static inline wr::WrBorderWidths ToWrBorderWidths(float top, float right, float bottom, float left)
{
- WrBorderWidths bw;
+ wr::WrBorderWidths bw;
bw.top = top;
bw.right = right;
bw.bottom = bottom;
bw.left = left;
return bw;
}
-static inline WrNinePatchDescriptor ToWrNinePatchDescriptor(uint32_t width, uint32_t height,
- const WrSideOffsets2Du32& slice)
+static inline wr::WrNinePatchDescriptor ToWrNinePatchDescriptor(uint32_t width, uint32_t height,
+ const wr::WrSideOffsets2Du32& slice)
{
WrNinePatchDescriptor patch;
patch.width = width;
patch.height = height;
patch.slice = slice;
return patch;
}
-static inline WrSideOffsets2Du32 ToWrSideOffsets2Du32(uint32_t top, uint32_t right, uint32_t bottom, uint32_t left)
+static inline wr::WrSideOffsets2Du32 ToWrSideOffsets2Du32(uint32_t top, uint32_t right, uint32_t bottom, uint32_t left)
{
WrSideOffsets2Du32 offset;
offset.top = top;
offset.right = right;
offset.bottom = bottom;
offset.left = left;
return offset;
}
-static inline WrSideOffsets2Df32 ToWrSideOffsets2Df32(float top, float right, float bottom, float left)
+static inline wr::WrSideOffsets2Df32 ToWrSideOffsets2Df32(float top, float right, float bottom, float left)
{
WrSideOffsets2Df32 offset;
offset.top = top;
offset.right = right;
offset.bottom = bottom;
offset.left = left;
return offset;
}
-static inline WrRepeatMode ToWrRepeatMode(uint8_t repeatMode)
+static inline wr::WrRepeatMode ToWrRepeatMode(uint8_t repeatMode)
{
switch (repeatMode) {
case NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH:
- return WrRepeatMode::Stretch;
+ return wr::WrRepeatMode::Stretch;
case NS_STYLE_BORDER_IMAGE_REPEAT_REPEAT:
- return WrRepeatMode::Repeat;
+ return wr::WrRepeatMode::Repeat;
case NS_STYLE_BORDER_IMAGE_REPEAT_ROUND:
- return WrRepeatMode::Round;
+ return wr::WrRepeatMode::Round;
case NS_STYLE_BORDER_IMAGE_REPEAT_SPACE:
- return WrRepeatMode::Space;
+ return wr::WrRepeatMode::Space;
default:
MOZ_ASSERT(false);
}
- return WrRepeatMode::Stretch;
+ return wr::WrRepeatMode::Stretch;
}
template<class S, class T>
-static inline WrTransformProperty ToWrTransformProperty(uint64_t id,
- const gfx::Matrix4x4Typed<S, T>& transform)
+static inline wr::WrTransformProperty ToWrTransformProperty(uint64_t id,
+ const gfx::Matrix4x4Typed<S, T>& transform)
{
- WrTransformProperty prop;
+ wr::WrTransformProperty prop;
prop.id = id;
prop.transform = ToWrMatrix(transform);
return prop;
}
-static inline WrOpacityProperty ToWrOpacityProperty(uint64_t id, const float opacity)
+static inline wr::WrOpacityProperty ToWrOpacityProperty(uint64_t id, const float opacity)
{
- WrOpacityProperty prop;
+ wr::WrOpacityProperty prop;
prop.id = id;
prop.opacity = opacity;
return prop;
}
-static inline WrComplexClipRegion ToWrComplexClipRegion(const WrRect& rect,
- const LayerSize& size)
+static inline wr::WrComplexClipRegion ToWrComplexClipRegion(const wr::WrRect& rect,
+ const LayerSize& size)
{
- WrComplexClipRegion complex_clip;
+ wr::WrComplexClipRegion complex_clip;
complex_clip.rect = rect;
complex_clip.radii = wr::ToWrUniformBorderRadius(size);
return complex_clip;
}
template<class T>
-static inline WrComplexClipRegion ToWrComplexClipRegion(const gfx::RectTyped<T>& rect,
- const LayerSize& size)
+static inline wr::WrComplexClipRegion ToWrComplexClipRegion(const gfx::RectTyped<T>& rect,
+ const LayerSize& size)
{
return ToWrComplexClipRegion(wr::ToWrRect(rect), size);
}
// Whenever possible, use wr::ExternalImageId instead of manipulating uint64_t.
inline uint64_t AsUint64(const ExternalImageId& aId) {
return static_cast<uint64_t>(aId.mHandle);
}
static inline ExternalImageId ToExternalImageId(uint64_t aID)
{
ExternalImageId Id;
Id.mHandle = aID;
return Id;
}
-static inline WrExternalImage RawDataToWrExternalImage(const uint8_t* aBuff,
- size_t size)
+static inline wr::WrExternalImage RawDataToWrExternalImage(const uint8_t* aBuff,
+ size_t size)
{
- return WrExternalImage {
- WrExternalImageType::RawData,
+ return wr::WrExternalImage {
+ wr::WrExternalImageType::RawData,
0, 0.0f, 0.0f, 0.0f, 0.0f,
aBuff, size
};
}
-static inline WrExternalImage NativeTextureToWrExternalImage(uint32_t aHandle,
- float u0, float v0,
- float u1, float v1)
+static inline wr::WrExternalImage NativeTextureToWrExternalImage(uint32_t aHandle,
+ float u0, float v0,
+ float u1, float v1)
{
- return WrExternalImage {
- WrExternalImageType::NativeTexture,
+ return wr::WrExternalImage {
+ wr::WrExternalImageType::NativeTexture,
aHandle, u0, v0, u1, v1,
nullptr, 0
};
}
struct VecU8 {
- WrVecU8 inner;
+ wr::WrVecU8 inner;
VecU8() {
SetEmpty();
}
VecU8(VecU8&) = delete;
VecU8(VecU8&& src) {
inner = src.inner;
src.SetEmpty();
}
VecU8&
operator=(VecU8&& src) {
inner = src.inner;
src.SetEmpty();
return *this;
}
- WrVecU8
+ wr::WrVecU8
Extract() {
- WrVecU8 ret = inner;
+ wr::WrVecU8 ret = inner;
SetEmpty();
return ret;
}
void
SetEmpty() {
inner.data = (uint8_t*)1;
inner.capacity = 0;
@@ -572,59 +571,59 @@ struct ByteBuffer
!(memcmp(mData, other.mData, mLength));
}
size_t mLength;
uint8_t* mData;
bool mOwned;
};
-inline WrByteSlice RangeToByteSlice(mozilla::Range<uint8_t> aRange) {
- return WrByteSlice { aRange.begin().get(), aRange.length() };
+inline wr::WrByteSlice RangeToByteSlice(mozilla::Range<uint8_t> aRange) {
+ return wr::WrByteSlice { aRange.begin().get(), aRange.length() };
}
-inline mozilla::Range<const uint8_t> ByteSliceToRange(WrByteSlice aWrSlice) {
+inline mozilla::Range<const uint8_t> ByteSliceToRange(wr::WrByteSlice aWrSlice) {
return mozilla::Range<const uint8_t>(aWrSlice.buffer, aWrSlice.len);
}
-inline mozilla::Range<uint8_t> MutByteSliceToRange(MutByteSlice aWrSlice) {
+inline mozilla::Range<uint8_t> MutByteSliceToRange(wr::MutByteSlice aWrSlice) {
return mozilla::Range<uint8_t>(aWrSlice.buffer, aWrSlice.len);
}
struct BuiltDisplayList {
- VecU8 dl;
- WrBuiltDisplayListDescriptor dl_desc;
+ wr::VecU8 dl;
+ wr::WrBuiltDisplayListDescriptor dl_desc;
};
-static inline WrFilterOpType ToWrFilterOpType(const layers::CSSFilterType type) {
+static inline wr::WrFilterOpType ToWrFilterOpType(const layers::CSSFilterType type) {
switch (type) {
case layers::CSSFilterType::BLUR:
- return WrFilterOpType::Blur;
+ return wr::WrFilterOpType::Blur;
case layers::CSSFilterType::BRIGHTNESS:
- return WrFilterOpType::Brightness;
+ return wr::WrFilterOpType::Brightness;
case layers::CSSFilterType::CONTRAST:
- return WrFilterOpType::Contrast;
+ return wr::WrFilterOpType::Contrast;
case layers::CSSFilterType::GRAYSCALE:
- return WrFilterOpType::Grayscale;
+ return wr::WrFilterOpType::Grayscale;
case layers::CSSFilterType::HUE_ROTATE:
- return WrFilterOpType::HueRotate;
+ return wr::WrFilterOpType::HueRotate;
case layers::CSSFilterType::INVERT:
- return WrFilterOpType::Invert;
+ return wr::WrFilterOpType::Invert;
case layers::CSSFilterType::OPACITY:
- return WrFilterOpType::Opacity;
+ return wr::WrFilterOpType::Opacity;
case layers::CSSFilterType::SATURATE:
- return WrFilterOpType::Saturate;
+ return wr::WrFilterOpType::Saturate;
case layers::CSSFilterType::SEPIA:
- return WrFilterOpType::Sepia;
+ return wr::WrFilterOpType::Sepia;
}
MOZ_ASSERT_UNREACHABLE("Tried to convert unknown filter type.");
- return WrFilterOpType::Grayscale;
+ return wr::WrFilterOpType::Grayscale;
}
-static inline WrFilterOp ToWrFilterOp(const layers::CSSFilter& filter) {
+static inline wr::WrFilterOp ToWrFilterOp(const layers::CSSFilter& filter) {
return {
ToWrFilterOpType(filter.type),
filter.argument,
};
}
// Corresponds to an "internal" webrender clip id. That is, a
// ClipId::Clip(x,pipeline_id) maps to a WrClipId{x}. We use a struct wrapper
--- a/gfx/webrender_bindings/cbindgen.toml
+++ b/gfx/webrender_bindings/cbindgen.toml
@@ -7,16 +7,17 @@ autogen_warning = """/* DO NOT MODIFY TH
* a. Alternatively, you can clone `https://github.com/rlhunt/cbindgen` and use a tagged release
* 2. Run `cbindgen toolkit/library/rust/ --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
*/"""
include_version = true
braces = "SameLine"
line_length = 100
tab_width = 2
language = "C++"
+namespaces = ["mozilla", "wr"]
[parse]
parse_deps = true
include = ["webrender", "webrender_api"]
[fn]
prefix = "WR_INLINE"
postfix = "WR_FUNC"
--- a/gfx/webrender_bindings/webrender_ffi.h
+++ b/gfx/webrender_bindings/webrender_ffi.h
@@ -43,31 +43,37 @@ void* get_proc_address_from_glcontext(vo
# define WR_DESTRUCTOR_SAFE_FUNC {}
#endif
#include "webrender_ffi_generated.h"
#undef WR_FUNC
#undef WR_DESTRUCTOR_SAFE_FUNC
+namespace mozilla {
+namespace wr {
+
struct WrGlyphArray
{
mozilla::gfx::Color color;
- nsTArray<WrGlyphInstance> glyphs;
+ nsTArray<wr::WrGlyphInstance> glyphs;
- bool operator==(const WrGlyphArray& other) const
+ bool operator==(const wr::WrGlyphArray& other) const
{
if (!(color == other.color) ||
(glyphs.Length() != other.glyphs.Length())) {
return false;
}
for (size_t i = 0; i < glyphs.Length(); i++) {
if (!(glyphs[i] == other.glyphs[i])) {
return false;
}
}
return true;
}
};
+} // namespace wr
+} // namespace mozilla
+
#endif // WR_h
--- a/gfx/webrender_bindings/webrender_ffi_generated.h
+++ b/gfx/webrender_bindings/webrender_ffi_generated.h
@@ -1,26 +1,29 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-/* Generated with cbindgen:0.1.13 */
+/* Generated with cbindgen:0.1.14 */
/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
* To generate this file:
* 1. Get the latest cbindgen using `cargo install --force cbindgen`
* a. Alternatively, you can clone `https://github.com/rlhunt/cbindgen` and use a tagged release
* 2. Run `cbindgen toolkit/library/rust/ --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
*/
#include <cstdint>
#include <cstdlib>
extern "C" {
+namespace mozilla {
+namespace wr {
+
enum class WrBorderStyle : uint32_t {
None = 0,
Solid = 1,
Double = 2,
Dotted = 3,
Dashed = 4,
Hidden = 5,
Groove = 6,
@@ -950,16 +953,19 @@ bool wr_window_new(WrWindowId aWindowId,
uint32_t aWindowHeight,
void *aGlContext,
WrThreadPool *aThreadPool,
bool aEnableProfiler,
WrAPI **aOutApi,
WrRenderer **aOutRenderer)
WR_FUNC;
+} // namespace wr
+} // namespace mozilla
+
} // extern "C"
/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
* To generate this file:
* 1. Get the latest cbindgen using `cargo install --force cbindgen`
* a. Alternatively, you can clone `https://github.com/rlhunt/cbindgen` and use a tagged release
* 2. Run `cbindgen toolkit/library/rust/ --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
*/
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -467,21 +467,21 @@ BulletRenderer::CreateWebRenderCommandsF
gfx::IntSize size;
Maybe<wr::ImageKey> key = aManager->CreateImageKey(aItem, container, aBuilder, aSc, size);
if (key.isNothing()) {
return;
}
const int32_t appUnitsPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel();
LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits(mDest, appUnitsPerDevPixel);
- WrRect dest = aSc.ToRelativeWrRectRounded(destRect);
+ wr::WrRect dest = aSc.ToRelativeWrRectRounded(destRect);
aBuilder.PushImage(dest,
dest,
- WrImageRendering::Auto,
+ wr::WrImageRendering::Auto,
key.value());
}
void
BulletRenderer::CreateWebRenderCommandsForPath(nsDisplayItem* aItem,
wr::DisplayListBuilder& aBuilder,
const layers::StackingContextHelper& aSc,
nsTArray<layers::WebRenderParentCommand>& aParentCommands,
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -322,17 +322,17 @@ nsDisplayCanvasBackgroundColor::CreateWe
nsCanvasFrame *frame = static_cast<nsCanvasFrame *>(mFrame);
nsPoint offset = ToReferenceFrame();
nsRect bgClipRect = frame->CanvasArea() + offset;
int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
LayoutDeviceRect rect = LayoutDeviceRect::FromAppUnits(
bgClipRect, appUnitsPerDevPixel);
- WrRect transformedRect = aSc.ToRelativeWrRect(rect);
+ wr::WrRect transformedRect = aSc.ToRelativeWrRect(rect);
aBuilder.PushRect(transformedRect,
transformedRect,
wr::ToWrColor(ToDeviceColor(mColor)));
return true;
}
#ifdef MOZ_DUMP_PAINTING
void
--- a/layout/painting/nsCSSRenderingBorders.cpp
+++ b/layout/painting/nsCSSRenderingBorders.cpp
@@ -3550,27 +3550,27 @@ nsCSSBorderRenderer::CanCreateWebRenderC
return true;
}
void
nsCSSBorderRenderer::CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder,
const layers::StackingContextHelper& aSc)
{
LayoutDeviceRect outerRect = LayoutDeviceRect::FromUnknownRect(mOuterRect);
- WrRect transformedRect = aSc.ToRelativeWrRect(outerRect);
- WrBorderSide side[4];
+ wr::WrRect transformedRect = aSc.ToRelativeWrRect(outerRect);
+ wr::WrBorderSide side[4];
NS_FOR_CSS_SIDES(i) {
side[i] = wr::ToWrBorderSide(ToDeviceColor(mBorderColors[i]), mBorderStyles[i]);
}
- 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));
- Range<const WrBorderSide> wrsides(side, 4);
+ wr::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));
+ Range<const wr::WrBorderSide> wrsides(side, 4);
aBuilder.PushBorder(transformedRect,
transformedRect,
wr::ToWrBorderWidths(mBorderWidths[0], mBorderWidths[1], mBorderWidths[2], mBorderWidths[3]),
wrsides,
borderRadius);
}
/* static */Maybe<nsCSSBorderImageRenderer>
--- a/layout/painting/nsCSSRenderingGradients.cpp
+++ b/layout/painting/nsCSSRenderingGradients.cpp
@@ -996,23 +996,23 @@ nsCSSGradientRenderer::Paint(gfxContext&
aContext.Fill();
aContext.SetMatrix(ctm);
}
}
}
void
nsCSSGradientRenderer::BuildWebRenderParameters(float aOpacity,
- WrGradientExtendMode& aMode,
- nsTArray<WrGradientStop>& aStops,
+ wr::WrGradientExtendMode& aMode,
+ nsTArray<wr::WrGradientStop>& aStops,
LayoutDevicePoint& aLineStart,
LayoutDevicePoint& aLineEnd,
LayoutDeviceSize& aGradientRadius)
{
- aMode = mGradient->mRepeating ? WrGradientExtendMode::Repeat : WrGradientExtendMode::Clamp;
+ aMode = mGradient->mRepeating ? wr::WrGradientExtendMode::Repeat : wr::WrGradientExtendMode::Clamp;
aStops.SetLength(mStops.Length());
for(uint32_t i = 0; i < mStops.Length(); i++) {
aStops[i].color.r = mStops[i].mColor.r;
aStops[i].color.g = mStops[i].mColor.g;
aStops[i].color.b = mStops[i].mColor.b;
aStops[i].color.a = mStops[i].mColor.a * aOpacity;
aStops[i].offset = mStops[i].mPosition;
@@ -1032,18 +1032,18 @@ nsCSSGradientRenderer::BuildWebRenderDis
const nsSize& aRepeatSize,
const CSSIntRect& aSrc,
float aOpacity)
{
if (aDest.IsEmpty() || aFillArea.IsEmpty()) {
return;
}
- WrGradientExtendMode extendMode;
- nsTArray<WrGradientStop> stops;
+ wr::WrGradientExtendMode extendMode;
+ nsTArray<wr::WrGradientStop> stops;
LayoutDevicePoint lineStart;
LayoutDevicePoint lineEnd;
LayoutDeviceSize gradientRadius;
BuildWebRenderParameters(aOpacity, extendMode, stops, lineStart, lineEnd, gradientRadius);
nscoord appUnitsPerDevPixel = mPresContext->AppUnitsPerDevPixel();
nsPoint firstTile = nsPoint(FindTileStart(aFillArea.x, aDest.x, aRepeatSize.width),
@@ -1059,20 +1059,20 @@ nsCSSGradientRenderer::BuildWebRenderDis
LayoutDevicePoint tileToClip = clipBounds.BottomRight() - firstTileBounds.TopLeft();
LayoutDeviceRect gradientBounds = LayoutDeviceRect(firstTileBounds.TopLeft(),
LayoutDeviceSize(tileToClip.x, tileToClip.y));
// Calculate the tile spacing, which is the repeat size minus the tile size
LayoutDeviceSize tileSpacing = tileRepeat - firstTileBounds.Size();
// Make the rects relative to the parent stacking context
- WrRect wrClipBounds = aSc.ToRelativeWrRect(clipBounds);
+ wr::WrRect wrClipBounds = aSc.ToRelativeWrRect(clipBounds);
LayerSize layerFirstTileSize = ViewAs<LayerPixel>(firstTileBounds.Size(),
PixelCastJustification::WebRenderHasUnitResolution);
- WrRect wrGradientBounds = aSc.ToRelativeWrRect(gradientBounds);
+ wr::WrRect wrGradientBounds = aSc.ToRelativeWrRect(gradientBounds);
// srcTransform is used for scaling the gradient to match aSrc
LayoutDeviceRect srcTransform = LayoutDeviceRect(mPresContext->CSSPixelsToAppUnits(aSrc.x),
mPresContext->CSSPixelsToAppUnits(aSrc.y),
aDest.width / ((float)mPresContext->CSSPixelsToAppUnits(aSrc.width)),
aDest.height / ((float)mPresContext->CSSPixelsToAppUnits(aSrc.height)));
lineStart.x = (lineStart.x - srcTransform.x) * srcTransform.width;
--- a/layout/painting/nsCSSRenderingGradients.h
+++ b/layout/painting/nsCSSRenderingGradients.h
@@ -60,18 +60,18 @@ public:
const mozilla::CSSIntRect& aSrc,
const nsRect& aDirtyRect,
float aOpacity = 1.0);
/**
* Collect the gradient parameters
*/
void BuildWebRenderParameters(float aOpacity,
- WrGradientExtendMode& aMode,
- nsTArray<WrGradientStop>& aStops,
+ wr::WrGradientExtendMode& aMode,
+ nsTArray<wr::WrGradientStop>& aStops,
LayoutDevicePoint& aLineStart,
LayoutDevicePoint& aLineEnd,
LayoutDeviceSize& aGradientRadius);
/**
* Build display items for the gradient
* aLayer - the layer to make this display item relative to
* aDest - where the first tile of gradient is
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -4171,17 +4171,17 @@ nsDisplayBackgroundColor::CreateWebRende
}
if (mColor == Color()) {
return true;
}
LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(
mBackgroundRect, mFrame->PresContext()->AppUnitsPerDevPixel());
- WrRect transformedRect = aSc.ToRelativeWrRect(bounds);
+ wr::WrRect transformedRect = aSc.ToRelativeWrRect(bounds);
aBuilder.PushRect(transformedRect,
transformedRect,
wr::ToWrColor(ToDeviceColor(mColor)));
return true;
}
@@ -4685,18 +4685,18 @@ nsDisplayCaret::CreateWebRenderCommands(
mCaret->ComputeCaretRects(frame, contentOffset, &caretRect, &hookRect);
gfx::Color color = ToDeviceColor(frame->GetCaretColorAt(contentOffset));
LayoutDeviceRect devCaretRect = LayoutDeviceRect::FromAppUnits(
caretRect + ToReferenceFrame(), appUnitsPerDevPixel);
LayoutDeviceRect devHookRect = LayoutDeviceRect::FromAppUnits(
hookRect + ToReferenceFrame(), appUnitsPerDevPixel);
- WrRect caret = aSc.ToRelativeWrRectRounded(devCaretRect);
- WrRect hook = aSc.ToRelativeWrRectRounded(devHookRect);
+ wr::WrRect caret = aSc.ToRelativeWrRectRounded(devCaretRect);
+ wr::WrRect hook = aSc.ToRelativeWrRectRounded(devHookRect);
// Note, WR will pixel snap anything that is layout aligned.
aBuilder.PushRect(caret,
caret,
wr::ToWrColor(color));
if (!devHookRect.IsEmpty()) {
aBuilder.PushRect(hook,
@@ -4964,19 +4964,19 @@ nsDisplayBorder::CreateBorderImageWebRen
NS_FOR_CSS_SIDES(i) {
slice[i] = (float)(mBorderImageRenderer->mSlice.Side(i)) / appUnitsPerDevPixel;
widths[i] = (float)(mBorderImageRenderer->mWidths.Side(i)) / appUnitsPerDevPixel;
outset[i] = (float)(mBorderImageRenderer->mImageOutset.Side(i)) / appUnitsPerDevPixel;
}
LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits(
mBorderImageRenderer->mArea, appUnitsPerDevPixel);
- WrRect dest = aSc.ToRelativeWrRectRounded(destRect);
-
- WrRect clip = dest;
+ wr::WrRect dest = aSc.ToRelativeWrRectRounded(destRect);
+
+ wr::WrRect clip = dest;
if (!mBorderImageRenderer->mClip.IsEmpty()) {
LayoutDeviceRect clipRect = LayoutDeviceRect::FromAppUnits(
mBorderImageRenderer->mClip, appUnitsPerDevPixel);
clip = aSc.ToRelativeWrRectRounded(clipRect);
}
switch (mBorderImageRenderer->mImageRenderer.GetType()) {
case eStyleImageType_Image:
@@ -5012,18 +5012,18 @@ nsDisplayBorder::CreateBorderImageWebRen
}
case eStyleImageType_Gradient:
{
RefPtr<nsStyleGradient> gradientData = mBorderImageRenderer->mImageRenderer.GetGradientData();
nsCSSGradientRenderer renderer =
nsCSSGradientRenderer::Create(mFrame->PresContext(), gradientData,
mBorderImageRenderer->mImageSize);
- WrGradientExtendMode extendMode;
- nsTArray<WrGradientStop> stops;
+ wr::WrGradientExtendMode extendMode;
+ nsTArray<wr::WrGradientStop> stops;
LayoutDevicePoint lineStart;
LayoutDevicePoint lineEnd;
LayoutDeviceSize gradientRadius;
renderer.BuildWebRenderParameters(1.0, extendMode, stops, lineStart, lineEnd, gradientRadius);
if (gradientData->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) {
LayerPoint startPoint = LayerPoint(dest.x, dest.y);
startPoint = startPoint + ViewAs<LayerPixel>(lineStart, PixelCastJustification::WebRenderHasUnitResolution);
@@ -5345,33 +5345,33 @@ nsDisplayBoxShadowOuter::CreateWebRender
// Now translate everything to device pixels.
nsRect shadowRect = frameRect;
Point shadowOffset;
shadowOffset.x = (shadow->mXOffset / appUnitsPerDevPixel);
shadowOffset.y = (shadow->mYOffset / appUnitsPerDevPixel);
LayoutDeviceRect deviceBox = LayoutDeviceRect::FromAppUnits(
shadowRect, appUnitsPerDevPixel);
- WrRect deviceBoxRect = aSc.ToRelativeWrRectRounded(deviceBox);
- WrRect deviceClipRect = aSc.ToRelativeWrRect(clipRect);
+ wr::WrRect deviceBoxRect = aSc.ToRelativeWrRectRounded(deviceBox);
+ wr::WrRect deviceClipRect = aSc.ToRelativeWrRect(clipRect);
// TODO: support non-uniform border radius.
float borderRadius = hasBorderRadius ? borderRadii.TopLeft().width
: 0.0;
float spreadRadius = float(shadow->mSpread) / float(appUnitsPerDevPixel);
aBuilder.PushBoxShadow(deviceBoxRect,
deviceClipRect,
deviceBoxRect,
wr::ToWrPoint(shadowOffset),
wr::ToWrColor(shadowColor),
blurRadius,
spreadRadius,
borderRadius,
- WrBoxShadowClipMode::Outset);
+ wr::WrBoxShadowClipMode::Outset);
}
}
return true;
}
void
nsDisplayBoxShadowOuter::ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
@@ -5498,17 +5498,17 @@ nsDisplayBoxShadowInner::CreateInsetBoxS
nsRect shadowRect =
nsCSSRendering::GetBoxShadowInnerPaddingRect(aFrame, aBorderRect);
RectCornerRadii innerRadii;
nsCSSRendering::GetShadowInnerRadii(aFrame, aBorderRect, innerRadii);
// Now translate everything to device pixels.
Rect deviceBoxRect = LayoutDeviceRect::FromAppUnits(
shadowRect, appUnitsPerDevPixel).ToUnknownRect();
- WrRect deviceClipRect = aSc.ToRelativeWrRect(clipRect);
+ wr::WrRect deviceClipRect = aSc.ToRelativeWrRect(clipRect);
Color shadowColor = nsCSSRendering::GetShadowColor(shadowItem, aFrame, 1.0);
Point shadowOffset;
shadowOffset.x = (shadowItem->mXOffset / appUnitsPerDevPixel);
shadowOffset.y = (shadowItem->mYOffset / appUnitsPerDevPixel);
float blurRadius = float(shadowItem->mRadius) / float(appUnitsPerDevPixel);
// TODO: WR doesn't support non-uniform border radii
@@ -5519,17 +5519,17 @@ nsDisplayBoxShadowInner::CreateInsetBoxS
aBuilder.PushBoxShadow(wr::ToWrRect(deviceBoxRect),
deviceClipRect,
wr::ToWrRect(deviceBoxRect),
wr::ToWrPoint(shadowOffset),
wr::ToWrColor(shadowColor),
blurRadius,
spreadRadius,
borderRadius,
- WrBoxShadowClipMode::Inset
+ wr::WrBoxShadowClipMode::Inset
);
}
}
}
bool
nsDisplayBoxShadowInner::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aSc,
@@ -7578,17 +7578,17 @@ nsDisplayTransform::CreateWebRenderComma
boundTransform._43 = 0.0f;
if (!boundTransform.IsIdentity()) {
// WR will only apply the 'translate' of the transform, so we need to do the scale/rotation manually.
bounds.MoveTo(boundTransform.TransformPoint(bounds.TopLeft()));
}
// TODO: generate animationsId for OMTA.
uint64_t animationsId = 0;
- nsTArray<WrFilterOp> filters;
+ nsTArray<wr::WrFilterOp> filters;
StackingContextHelper sc(aSc,
aBuilder,
bounds,
origin,
animationsId,
nullptr,
transformForSC,
filters);
--- a/layout/painting/nsImageRenderer.cpp
+++ b/layout/painting/nsImageRenderer.cpp
@@ -646,18 +646,18 @@ nsImageRenderer::BuildWebRenderDisplayIt
nsPoint firstTilePos = nsLayoutUtils::GetBackgroundFirstTilePos(aDest.TopLeft(),
aFill.TopLeft(),
aRepeatSize);
LayoutDeviceRect fillRect = LayoutDeviceRect::FromAppUnits(
nsRect(firstTilePos.x, firstTilePos.y,
aFill.XMost() - firstTilePos.x, aFill.YMost() - firstTilePos.y),
appUnitsPerDevPixel);
- WrRect fill = aSc.ToRelativeWrRect(fillRect);
- WrRect clip = aSc.ToRelativeWrRect(
+ wr::WrRect fill = aSc.ToRelativeWrRect(fillRect);
+ wr::WrRect clip = aSc.ToRelativeWrRect(
LayoutDeviceRect::FromAppUnits(aFill, appUnitsPerDevPixel));
LayoutDeviceSize gapSize = LayoutDeviceSize::FromAppUnits(
aRepeatSize - aDest.Size(), appUnitsPerDevPixel);
aBuilder.PushImage(fill, clip,
wr::ToWrSize(destRect.Size()), wr::ToWrSize(gapSize),
wr::ImageRendering::Auto, key.value());
break;
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -7439,33 +7439,33 @@ BCBlockDirSeg::CreateWebRenderCommands(B
if (param.isNothing()) {
return;
}
//TODO: Currently, we don't support border with m{Start,End}Bevel{Side,Offset} attributes.
LayoutDeviceRect borderRect = LayoutDeviceRect::FromUnknownRect(NSRectToRect(param->mBorderRect + aOffset,
param->mAppUnitsPerDevPixel));
- WrRect transformedRect = aSc.ToRelativeWrRect(borderRect);
- WrBorderSide wrSide[4];
+ wr::WrRect transformedRect = aSc.ToRelativeWrRect(borderRect);
+ wr::WrBorderSide wrSide[4];
NS_FOR_CSS_SIDES(i) {
wrSide[i] = wr::ToWrBorderSide(ToDeviceColor(param->mBorderColor), NS_STYLE_BORDER_STYLE_NONE);
}
wrSide[eSideLeft] = wr::ToWrBorderSide(ToDeviceColor(param->mBorderColor), param->mBorderStyle);
- WrBorderRadius borderRadii = wr::ToWrBorderRadius( {0, 0}, {0, 0}, {0, 0}, {0, 0} );
+ wr::WrBorderRadius borderRadii = wr::ToWrBorderRadius( {0, 0}, {0, 0}, {0, 0}, {0, 0} );
// All border style is set to none except left side. So setting the widths of
// each side to width of rect is fine.
- WrBorderWidths borderWidths = wr::ToWrBorderWidths(transformedRect.width,
- transformedRect.width,
- transformedRect.width,
- transformedRect.width);
+ wr::WrBorderWidths borderWidths = wr::ToWrBorderWidths(transformedRect.width,
+ transformedRect.width,
+ transformedRect.width,
+ transformedRect.width);
transformedRect.width *= 2.0f;
- Range<const WrBorderSide> wrsides(wrSide, 4);
+ Range<const wr::WrBorderSide> wrsides(wrSide, 4);
aBuilder.PushBorder(transformedRect,
transformedRect,
borderWidths,
wrsides,
borderRadii);
}
/**
@@ -7697,33 +7697,33 @@ BCInlineDirSeg::CreateWebRenderCommands(
if (param.isNothing()) {
return;
}
//TODO: Currently, we don't support border with m{Start,End}Bevel{Side,Offset} attributes.
LayoutDeviceRect borderRect = LayoutDeviceRect::FromUnknownRect(NSRectToRect(param->mBorderRect + aPt,
param->mAppUnitsPerDevPixel));
- WrRect transformedRect = aSc.ToRelativeWrRect(borderRect);
- WrBorderSide wrSide[4];
+ wr::WrRect transformedRect = aSc.ToRelativeWrRect(borderRect);
+ wr::WrBorderSide wrSide[4];
NS_FOR_CSS_SIDES(i) {
wrSide[i] = wr::ToWrBorderSide(ToDeviceColor(param->mBorderColor), NS_STYLE_BORDER_STYLE_NONE);
}
wrSide[eSideTop] = wr::ToWrBorderSide(ToDeviceColor(param->mBorderColor), param->mBorderStyle);
- WrBorderRadius borderRadii = wr::ToWrBorderRadius( {0, 0}, {0, 0}, {0, 0}, {0, 0} );
+ wr::WrBorderRadius borderRadii = wr::ToWrBorderRadius( {0, 0}, {0, 0}, {0, 0}, {0, 0} );
// All border style is set to none except top side. So setting the widths of
// each side to height of rect is fine.
- WrBorderWidths borderWidths = wr::ToWrBorderWidths(transformedRect.height,
- transformedRect.height,
- transformedRect.height,
- transformedRect.height);
+ wr::WrBorderWidths borderWidths = wr::ToWrBorderWidths(transformedRect.height,
+ transformedRect.height,
+ transformedRect.height,
+ transformedRect.height);
transformedRect.height *= 2.0f;
- Range<const WrBorderSide> wrsides(wrSide, 4);
+ Range<const wr::WrBorderSide> wrsides(wrSide, 4);
aBuilder.PushBorder(transformedRect,
transformedRect,
borderWidths,
wrsides,
borderRadii);
}
/**
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -2109,18 +2109,18 @@ nsChildView::AddWindowOverlayWebRenderCo
mTitlebarImageSize = size;
updatedTitlebarRegion.SetEmpty();
}
if (!updatedTitlebarRegion.IsEmpty()) {
aWrBridge->SendUpdateImage(*mTitlebarImageKey, size, format, buffer);
}
- WrRect rect = wr::ToWrRect(mTitlebarRect);
- aBuilder.PushImage(WrRect{ 0, 0, float(size.width), float(size.height) },
+ wr::WrRect rect = wr::ToWrRect(mTitlebarRect);
+ aBuilder.PushImage(wr::WrRect{ 0, 0, float(size.width), float(size.height) },
rect, wr::ImageRendering::Auto, *mTitlebarImageKey);
}
}
void
nsChildView::CleanupWebRenderWindowOverlay(layers::WebRenderBridgeChild* aWrBridge)
{
if (mTitlebarImageKey) {