Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Generate webrender_ffi_generated with cbindgen:0.3.3 (bug 1428142, r=…
Browse files Browse the repository at this point in the history
…nical)
  • Loading branch information
eqrion committed Jan 4, 2018
1 parent 441fb8d commit ff7c04f
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 216 deletions.
13 changes: 0 additions & 13 deletions gfx/layers/LayersLogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,6 @@

namespace mozilla {

namespace wr {
struct ColorF;

struct TypedSize2D_f32__LayerPixel;
typedef TypedSize2D_f32__LayerPixel LayerSize;
typedef LayerSize LayoutSize;

struct TypedRect_f32__LayerPixel;
typedef TypedRect_f32__LayerPixel LayerRect;
typedef LayerRect LayoutRect;

} // namespace wr

namespace gfx {
template <class units, class F> struct RectTyped;
} // namespace gfx
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/wr/AsyncImagePipelineManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ AsyncImagePipelineManager::UpdateWithoutExternalImage(wr::ResourceUpdateQueue& a
wr::ImageDescriptor descriptor(size, map.mStride, dSurf->GetFormat());

// Costly copy right here...
wr::Vec_u8 bytes;
wr::Vec<uint8_t> bytes;
bytes.PushBytes(Range<uint8_t>(map.mData, size.height * map.mStride));

if (aOp == TextureHost::UPDATE_IMAGE) {
Expand Down
4 changes: 2 additions & 2 deletions gfx/layers/wr/IpcResourceUpdateQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ ShmSegmentsReader::ShmSegmentsReader(const nsTArray<ipc::Shmem>& aSmallShmems,
}

bool
ShmSegmentsReader::ReadLarge(const layers::OffsetRange& aRange, wr::Vec_u8& aInto)
ShmSegmentsReader::ReadLarge(const layers::OffsetRange& aRange, wr::Vec<uint8_t>& aInto)
{
// source = zero is for small allocs.
MOZ_RELEASE_ASSERT(aRange.source() != 0);
Expand All @@ -193,7 +193,7 @@ ShmSegmentsReader::ReadLarge(const layers::OffsetRange& aRange, wr::Vec_u8& aInt
}

bool
ShmSegmentsReader::Read(const layers::OffsetRange& aRange, wr::Vec_u8& aInto)
ShmSegmentsReader::Read(const layers::OffsetRange& aRange, wr::Vec<uint8_t>& aInto)
{
if (aRange.length() == 0) {
return true;
Expand Down
4 changes: 2 additions & 2 deletions gfx/layers/wr/IpcResourceUpdateQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class ShmSegmentsReader {
ShmSegmentsReader(const nsTArray<ipc::Shmem>& aSmallShmems,
const nsTArray<ipc::Shmem>& aLargeShmems);

bool Read(const layers::OffsetRange& aRange, wr::Vec_u8& aInto);
bool Read(const layers::OffsetRange& aRange, wr::Vec<uint8_t>& aInto);

protected:
bool ReadLarge(const layers::OffsetRange& aRange, wr::Vec_u8& aInto);
bool ReadLarge(const layers::OffsetRange& aRange, wr::Vec<uint8_t>& aInto);

const nsTArray<ipc::Shmem>& mSmallAllocs;
const nsTArray<ipc::Shmem>& mLargeAllocs;
Expand Down
18 changes: 9 additions & 9 deletions gfx/layers/wr/WebRenderBridgeParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ WebRenderBridgeParent::UpdateResources(const nsTArray<OpUpdateResource>& aResour
switch (cmd.type()) {
case OpUpdateResource::TOpAddImage: {
const auto& op = cmd.get_OpAddImage();
wr::Vec_u8 bytes;
wr::Vec<uint8_t> bytes;
if (!reader.Read(op.bytes(), bytes)) {
return false;
}
Expand All @@ -298,7 +298,7 @@ WebRenderBridgeParent::UpdateResources(const nsTArray<OpUpdateResource>& aResour
}
case OpUpdateResource::TOpUpdateImage: {
const auto& op = cmd.get_OpUpdateImage();
wr::Vec_u8 bytes;
wr::Vec<uint8_t> bytes;
if (!reader.Read(op.bytes(), bytes)) {
return false;
}
Expand All @@ -307,7 +307,7 @@ WebRenderBridgeParent::UpdateResources(const nsTArray<OpUpdateResource>& aResour
}
case OpUpdateResource::TOpAddBlobImage: {
const auto& op = cmd.get_OpAddBlobImage();
wr::Vec_u8 bytes;
wr::Vec<uint8_t> bytes;
if (!reader.Read(op.bytes(), bytes)) {
return false;
}
Expand All @@ -316,7 +316,7 @@ WebRenderBridgeParent::UpdateResources(const nsTArray<OpUpdateResource>& aResour
}
case OpUpdateResource::TOpUpdateBlobImage: {
const auto& op = cmd.get_OpUpdateBlobImage();
wr::Vec_u8 bytes;
wr::Vec<uint8_t> bytes;
if (!reader.Read(op.bytes(), bytes)) {
return false;
}
Expand All @@ -332,7 +332,7 @@ WebRenderBridgeParent::UpdateResources(const nsTArray<OpUpdateResource>& aResour
}
case OpUpdateResource::TOpAddRawFont: {
const auto& op = cmd.get_OpAddRawFont();
wr::Vec_u8 bytes;
wr::Vec<uint8_t> bytes;
if (!reader.Read(op.bytes(), bytes)) {
return false;
}
Expand All @@ -341,7 +341,7 @@ WebRenderBridgeParent::UpdateResources(const nsTArray<OpUpdateResource>& aResour
}
case OpUpdateResource::TOpAddFontDescriptor: {
const auto& op = cmd.get_OpAddFontDescriptor();
wr::Vec_u8 bytes;
wr::Vec<uint8_t> bytes;
if (!reader.Read(op.bytes(), bytes)) {
return false;
}
Expand All @@ -350,7 +350,7 @@ WebRenderBridgeParent::UpdateResources(const nsTArray<OpUpdateResource>& aResour
}
case OpUpdateResource::TOpAddFontInstance: {
const auto& op = cmd.get_OpAddFontInstance();
wr::Vec_u8 variations;
wr::Vec<uint8_t> variations;
if (!reader.Read(op.variations(), variations)) {
return false;
}
Expand Down Expand Up @@ -440,7 +440,7 @@ WebRenderBridgeParent::AddExternalImage(wr::ExternalImageId aExtId, wr::ImageKey

IntSize size = dSurf->GetSize();
wr::ImageDescriptor descriptor(size, map.mStride, dSurf->GetFormat());
wr::Vec_u8 data;
wr::Vec<uint8_t> data;
data.PushBytes(Range<uint8_t>(map.mData, size.height * map.mStride));
aResources.AddImage(keys[0], descriptor, data);
dSurf->Unmap();
Expand Down Expand Up @@ -611,7 +611,7 @@ WebRenderBridgeParent::RecvSetDisplayList(const gfx::IntSize& aSize,
}


wr::Vec_u8 dlData(Move(dl));
wr::Vec<uint8_t> dlData(Move(dl));

// If id namespaces do not match, it means the command is obsolete, probably
// because the tab just moved to a new window.
Expand Down
22 changes: 11 additions & 11 deletions gfx/webrender_bindings/WebRenderAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ WebRenderAPI::SetDisplayList(gfx::Color aBgColor,
wr::WrPipelineId pipeline_id,
const LayoutSize& content_size,
wr::BuiltDisplayListDescriptor dl_descriptor,
wr::Vec_u8& dl_data,
wr::Vec<uint8_t>& dl_data,
ResourceUpdateQueue& aResources)
{
wr_api_set_display_list(mDocHandle,
Expand Down Expand Up @@ -505,7 +505,7 @@ ResourceUpdateQueue::Clear()

void
ResourceUpdateQueue::AddImage(ImageKey key, const ImageDescriptor& aDescriptor,
wr::Vec_u8& aBytes)
wr::Vec<uint8_t>& aBytes)
{
wr_resource_updates_add_image(mUpdates,
key,
Expand All @@ -515,7 +515,7 @@ ResourceUpdateQueue::AddImage(ImageKey key, const ImageDescriptor& aDescriptor,

void
ResourceUpdateQueue::AddBlobImage(ImageKey key, const ImageDescriptor& aDescriptor,
wr::Vec_u8& aBytes)
wr::Vec<uint8_t>& aBytes)
{
wr_resource_updates_add_blob_image(mUpdates,
key,
Expand Down Expand Up @@ -552,7 +552,7 @@ ResourceUpdateQueue::AddExternalImageBuffer(ImageKey aKey,
void
ResourceUpdateQueue::UpdateImageBuffer(ImageKey aKey,
const ImageDescriptor& aDescriptor,
wr::Vec_u8& aBytes)
wr::Vec<uint8_t>& aBytes)
{
wr_resource_updates_update_image(mUpdates,
aKey,
Expand All @@ -563,7 +563,7 @@ ResourceUpdateQueue::UpdateImageBuffer(ImageKey aKey,
void
ResourceUpdateQueue::UpdateBlobImage(ImageKey aKey,
const ImageDescriptor& aDescriptor,
wr::Vec_u8& aBytes,
wr::Vec<uint8_t>& aBytes,
const wr::DeviceUintRect& aDirtyRect)
{
wr_resource_updates_update_blob_image(mUpdates,
Expand Down Expand Up @@ -595,13 +595,13 @@ ResourceUpdateQueue::DeleteImage(ImageKey aKey)
}

void
ResourceUpdateQueue::AddRawFont(wr::FontKey aKey, wr::Vec_u8& aBytes, uint32_t aIndex)
ResourceUpdateQueue::AddRawFont(wr::FontKey aKey, wr::Vec<uint8_t>& aBytes, uint32_t aIndex)
{
wr_resource_updates_add_raw_font(mUpdates, aKey, &aBytes.inner, aIndex);
}

void
ResourceUpdateQueue::AddFontDescriptor(wr::FontKey aKey, wr::Vec_u8& aBytes, uint32_t aIndex)
ResourceUpdateQueue::AddFontDescriptor(wr::FontKey aKey, wr::Vec<uint8_t>& aBytes, uint32_t aIndex)
{
wr_resource_updates_add_font_descriptor(mUpdates, aKey, &aBytes.inner, aIndex);
}
Expand All @@ -618,7 +618,7 @@ ResourceUpdateQueue::AddFontInstance(wr::FontInstanceKey aKey,
float aGlyphSize,
const wr::FontInstanceOptions* aOptions,
const wr::FontInstancePlatformOptions* aPlatformOptions,
wr::Vec_u8& aVariations)
wr::Vec<uint8_t>& aVariations)
{
wr_resource_updates_add_font_instance(mUpdates, aKey, aFontKey, aGlyphSize,
aOptions, aPlatformOptions,
Expand Down Expand Up @@ -1131,7 +1131,7 @@ DisplayListBuilder::PushBorderImage(const wr::LayoutRect& aBounds,
const wr::BorderWidths& aWidths,
wr::ImageKey aImage,
const wr::NinePatchDescriptor& aPatch,
const wr::SideOffsets2D_f32& aOutset,
const wr::SideOffsets2D<float>& aOutset,
const wr::RepeatMode& aRepeatHorizontal,
const wr::RepeatMode& aRepeatVertical)
{
Expand All @@ -1149,7 +1149,7 @@ DisplayListBuilder::PushBorderGradient(const wr::LayoutRect& aBounds,
const wr::LayoutPoint& aEndPoint,
const nsTArray<wr::GradientStop>& aStops,
wr::ExtendMode aExtendMode,
const wr::SideOffsets2D_f32& aOutset)
const wr::SideOffsets2D<float>& aOutset)
{
wr_dp_push_border_gradient(mWrState, aBounds, aClip, aIsBackfaceVisible,
aWidths, aStartPoint, aEndPoint,
Expand All @@ -1166,7 +1166,7 @@ DisplayListBuilder::PushBorderRadialGradient(const wr::LayoutRect& aBounds,
const wr::LayoutSize& aRadius,
const nsTArray<wr::GradientStop>& aStops,
wr::ExtendMode aExtendMode,
const wr::SideOffsets2D_f32& aOutset)
const wr::SideOffsets2D<float>& aOutset)
{
wr_dp_push_border_radial_gradient(
mWrState, aBounds, aClip, aIsBackfaceVisible, aWidths, aCenter,
Expand Down
22 changes: 11 additions & 11 deletions gfx/webrender_bindings/WebRenderAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ class ResourceUpdateQueue {

void AddImage(wr::ImageKey aKey,
const ImageDescriptor& aDescriptor,
wr::Vec_u8& aBytes);
wr::Vec<uint8_t>& aBytes);

void AddBlobImage(wr::ImageKey aKey,
const ImageDescriptor& aDescriptor,
wr::Vec_u8& aBytes);
wr::Vec<uint8_t>& aBytes);

void AddExternalImageBuffer(ImageKey key,
const ImageDescriptor& aDescriptor,
Expand All @@ -81,11 +81,11 @@ class ResourceUpdateQueue {

void UpdateImageBuffer(wr::ImageKey aKey,
const ImageDescriptor& aDescriptor,
wr::Vec_u8& aBytes);
wr::Vec<uint8_t>& aBytes);

void UpdateBlobImage(wr::ImageKey aKey,
const ImageDescriptor& aDescriptor,
wr::Vec_u8& aBytes,
wr::Vec<uint8_t>& aBytes,
const wr::DeviceUintRect& aDirtyRect);

void UpdateExternalImage(ImageKey aKey,
Expand All @@ -96,9 +96,9 @@ class ResourceUpdateQueue {

void DeleteImage(wr::ImageKey aKey);

void AddRawFont(wr::FontKey aKey, wr::Vec_u8& aBytes, uint32_t aIndex);
void AddRawFont(wr::FontKey aKey, wr::Vec<uint8_t>& aBytes, uint32_t aIndex);

void AddFontDescriptor(wr::FontKey aKey, wr::Vec_u8& aBytes, uint32_t aIndex);
void AddFontDescriptor(wr::FontKey aKey, wr::Vec<uint8_t>& aBytes, uint32_t aIndex);

void DeleteFont(wr::FontKey aKey);

Expand All @@ -107,7 +107,7 @@ class ResourceUpdateQueue {
float aGlyphSize,
const wr::FontInstanceOptions* aOptions,
const wr::FontInstancePlatformOptions* aPlatformOptions,
wr::Vec_u8& aVariations);
wr::Vec<uint8_t>& aVariations);

void DeleteFontInstance(wr::FontInstanceKey aKey);

Expand Down Expand Up @@ -161,7 +161,7 @@ class WebRenderAPI
wr::WrPipelineId pipeline_id,
const wr::LayoutSize& content_size,
wr::BuiltDisplayListDescriptor dl_descriptor,
wr::Vec_u8& dl_data,
wr::Vec<uint8_t>& dl_data,
ResourceUpdateQueue& aResources);

void ClearDisplayList(Epoch aEpoch, wr::WrPipelineId pipeline_id);
Expand Down Expand Up @@ -361,7 +361,7 @@ class DisplayListBuilder {
const wr::BorderWidths& aWidths,
wr::ImageKey aImage,
const wr::NinePatchDescriptor& aPatch,
const wr::SideOffsets2D_f32& aOutset,
const wr::SideOffsets2D<float>& aOutset,
const wr::RepeatMode& aRepeatHorizontal,
const wr::RepeatMode& aRepeatVertical);

Expand All @@ -373,7 +373,7 @@ class DisplayListBuilder {
const wr::LayoutPoint& aEndPoint,
const nsTArray<wr::GradientStop>& aStops,
wr::ExtendMode aExtendMode,
const wr::SideOffsets2D_f32& aOutset);
const wr::SideOffsets2D<float>& aOutset);

void PushBorderRadialGradient(const wr::LayoutRect& aBounds,
const wr::LayoutRect& aClip,
Expand All @@ -383,7 +383,7 @@ class DisplayListBuilder {
const wr::LayoutSize& aRadius,
const nsTArray<wr::GradientStop>& aStops,
wr::ExtendMode aExtendMode,
const wr::SideOffsets2D_f32& aOutset);
const wr::SideOffsets2D<float>& aOutset);

void PushText(const wr::LayoutRect& aBounds,
const wr::LayoutRect& aClip,
Expand Down
16 changes: 9 additions & 7 deletions gfx/webrender_bindings/WebRenderTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
namespace mozilla {
namespace wr {

Vec_u8::Vec_u8(mozilla::ipc::ByteBuf&& aSrc) {
inner.data = aSrc.mData;
inner.length = aSrc.mLen;
inner.capacity = aSrc.mCapacity;
aSrc.mData = nullptr;
aSrc.mLen = 0;
aSrc.mCapacity = 0;
void
Assign_WrVecU8(wr::WrVecU8& aVec, mozilla::ipc::ByteBuf&& aOther)
{
aVec.data = aOther.mData;
aVec.length = aOther.mLen;
aVec.capacity = aOther.mCapacity;
aOther.mData = nullptr;
aOther.mLen = 0;
aOther.mCapacity = 0;
}

} // namespace wr
Expand Down
Loading

0 comments on commit ff7c04f

Please sign in to comment.