Bug 1383786 - Changes to the ffi boundary. r=sotaro

This commit is contained in:
Nicolas Silva 2017-07-28 14:08:11 +02:00
Родитель ef3943612a
Коммит 230106d30b
4 изменённых файлов: 95 добавлений и 29 удалений

Просмотреть файл

@ -438,14 +438,14 @@ WebRenderAPI::AddExternalImage(ImageKey key,
}
void
WebRenderAPI::AddExternalImageBuffer(ImageKey key,
WebRenderAPI::AddExternalImageBuffer(ImageKey aKey,
const ImageDescriptor& aDescriptor,
ExternalImageId aHandle)
{
wr_api_add_external_image_buffer(mRenderApi,
key,
&aDescriptor,
aHandle);
auto channelIndex = 0;
AddExternalImage(aKey, aDescriptor, aHandle,
wr::WrExternalImageBufferType::ExternalBuffer,
channelIndex);
}
void
@ -459,6 +459,32 @@ WebRenderAPI::UpdateImageBuffer(ImageKey aKey,
RangeToByteSlice(aBytes));
}
void
WebRenderAPI::UpdateBlobImage(ImageKey aKey,
const ImageDescriptor& aDescriptor,
Range<uint8_t> aBytes)
{
wr_api_update_blob_image(mRenderApi,
aKey,
&aDescriptor,
RangeToByteSlice(aBytes));
}
void
WebRenderAPI::UpdateExternalImage(ImageKey aKey,
const ImageDescriptor& aDescriptor,
ExternalImageId aExtID,
wr::WrExternalImageBufferType aBufferType,
uint8_t aChannelIndex)
{
wr_api_update_external_image(mRenderApi,
aKey,
&aDescriptor,
aExtID,
aBufferType,
aChannelIndex);
}
void
WebRenderAPI::DeleteImage(ImageKey aKey)
{

Просмотреть файл

@ -87,12 +87,22 @@ public:
const ImageDescriptor& aDescriptor,
ExternalImageId aExtID,
WrExternalImageBufferType aBufferType,
uint8_t aChannelIndex);
uint8_t aChannelIndex = 0);
void UpdateImageBuffer(wr::ImageKey aKey,
const ImageDescriptor& aDescriptor,
Range<uint8_t> aBytes);
void UpdateBlobImage(wr::ImageKey aKey,
const ImageDescriptor& aDescriptor,
Range<uint8_t> aBytes);
void UpdateExternalImage(ImageKey aKey,
const ImageDescriptor& aDescriptor,
ExternalImageId aExtID,
wr::WrExternalImageBufferType aBufferType,
uint8_t aChannelIndex = 0);
void DeleteImage(wr::ImageKey aKey);
void AddRawFont(wr::FontKey aKey, Range<uint8_t> aBytes, uint32_t aIndex);

Просмотреть файл

@ -643,22 +643,6 @@ pub extern "C" fn wr_api_add_external_image(api: &mut RenderApi,
None);
}
#[no_mangle]
pub extern "C" fn wr_api_add_external_image_buffer(api: &mut RenderApi,
image_key: WrImageKey,
descriptor: &WrImageDescriptor,
external_image_id: WrExternalImageId) {
assert!(unsafe { is_in_compositor_thread() });
api.add_image(image_key,
descriptor.into(),
ImageData::External(ExternalImageData {
id: external_image_id.into(),
channel_index: 0,
image_type: ExternalImageType::ExternalBuffer,
}),
None);
}
#[no_mangle]
pub extern "C" fn wr_api_update_image(api: &mut RenderApi,
key: WrImageKey,
@ -670,6 +654,43 @@ pub extern "C" fn wr_api_update_image(api: &mut RenderApi,
api.update_image(key, descriptor.into(), ImageData::new(copied_bytes), None);
}
#[no_mangle]
pub extern "C" fn wr_api_update_external_image(
api: &mut RenderApi,
key: WrImageKey,
descriptor: &WrImageDescriptor,
external_image_id: WrExternalImageId,
image_type: WrExternalImageBufferType,
channel_index: u8
) {
assert!(unsafe { is_in_compositor_thread() });
let data = ImageData::External(
ExternalImageData {
id: external_image_id.into(),
channel_index,
image_type,
}
);
api.update_image(key, descriptor.into(), data, None);
}
#[no_mangle]
pub extern "C" fn wr_api_update_blob_image(api: &mut RenderApi,
image_key: WrImageKey,
descriptor: &WrImageDescriptor,
bytes: ByteSlice) {
assert!(unsafe { is_in_compositor_thread() });
let copied_bytes = bytes.as_slice().to_owned();
api.update_image(
image_key,
descriptor.into(),
ImageData::new_blob_image(copied_bytes),
None
);
}
#[no_mangle]
pub extern "C" fn wr_api_delete_image(api: &mut RenderApi,
key: WrImageKey) {

Просмотреть файл

@ -636,13 +636,6 @@ void wr_api_add_external_image(RenderApi *aApi,
uint8_t aChannelIndex)
WR_FUNC;
WR_INLINE
void wr_api_add_external_image_buffer(RenderApi *aApi,
WrImageKey aImageKey,
const WrImageDescriptor *aDescriptor,
WrExternalImageId aExternalImageId)
WR_FUNC;
WR_INLINE
void wr_api_add_image(RenderApi *aApi,
WrImageKey aImageKey,
@ -730,6 +723,22 @@ void wr_api_set_window_parameters(RenderApi *aApi,
int32_t aHeight)
WR_FUNC;
WR_INLINE
void wr_api_update_blob_image(RenderApi *aApi,
WrImageKey aImageKey,
const WrImageDescriptor *aDescriptor,
ByteSlice aBytes)
WR_FUNC;
WR_INLINE
void wr_api_update_external_image(RenderApi *aApi,
WrImageKey aKey,
const WrImageDescriptor *aDescriptor,
WrExternalImageId aExternalImageId,
WrExternalImageBufferType aImageType,
uint8_t aChannelIndex)
WR_FUNC;
WR_INLINE
void wr_api_update_image(RenderApi *aApi,
WrImageKey aKey,