зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1347062 - P1: add WrExternalImage binding utility function. r=nical,sotaro
MozReview-Commit-ID: 4oJvybXRuTX
This commit is contained in:
Родитель
f480fd6ca6
Коммит
55f4c680b1
|
@ -21,8 +21,8 @@ WrExternalImage LockExternalImage(void* aObj, WrExternalImageId aId)
|
|||
RenderTextureHost* texture = renderer->GetRenderTexture(aId.id);
|
||||
MOZ_ASSERT(texture);
|
||||
texture->Lock();
|
||||
return WrExternalImage { WrExternalImageIdType::RawData, 0.0f, 0.0f, 0.0f, 0.0f, 0,
|
||||
texture->GetDataForRender(), texture->GetBufferSizeForRender() };
|
||||
|
||||
return RawDataToWrExternalImage(texture->GetDataForRender(), texture->GetBufferSizeForRender());
|
||||
}
|
||||
|
||||
void UnlockExternalImage(void* aObj, WrExternalImageId aId)
|
||||
|
|
|
@ -350,6 +350,27 @@ static inline WrExternalImageId ToWrExternalImageId(uint64_t aID)
|
|||
return id;
|
||||
}
|
||||
|
||||
static inline WrExternalImage RawDataToWrExternalImage(const uint8_t* aBuff,
|
||||
size_t size)
|
||||
{
|
||||
return WrExternalImage {
|
||||
WrExternalImageIdType::RawData,
|
||||
0, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
aBuff, size
|
||||
};
|
||||
}
|
||||
|
||||
static inline WrExternalImage NativeTextureToWrExternalImage(uint8_t aHandle,
|
||||
float u0, float v0,
|
||||
float u1, float v1)
|
||||
{
|
||||
return WrExternalImage {
|
||||
WrExternalImageIdType::NativeTexture,
|
||||
aHandle, u0, v0, u1, v1,
|
||||
nullptr, 0
|
||||
};
|
||||
}
|
||||
|
||||
struct VecU8 {
|
||||
WrVecU8 inner;
|
||||
VecU8() {
|
||||
|
|
|
@ -434,16 +434,15 @@ enum WrExternalImageType {
|
|||
struct WrExternalImageStruct {
|
||||
image_type: WrExternalImageType,
|
||||
|
||||
// Texture coordinate
|
||||
// external texture handle
|
||||
handle: u32,
|
||||
// external texture coordinate
|
||||
u0: f32,
|
||||
v0: f32,
|
||||
u1: f32,
|
||||
v1: f32,
|
||||
|
||||
// external buffer handle
|
||||
handle: u32,
|
||||
|
||||
// handle RawData.
|
||||
// external image buffer
|
||||
buff: *const u8,
|
||||
size: usize,
|
||||
}
|
||||
|
|
|
@ -413,15 +413,14 @@ struct WrExternalImage
|
|||
{
|
||||
WrExternalImageIdType type;
|
||||
|
||||
// Texture coordinate
|
||||
// external texture handle
|
||||
uint32_t handle;
|
||||
// external texture coordinate
|
||||
float u0, v0;
|
||||
float u1, v1;
|
||||
|
||||
// external buffer handle
|
||||
uint32_t handle;
|
||||
|
||||
// handle RawData.
|
||||
uint8_t* buff;
|
||||
// external image buffer
|
||||
const uint8_t* buff;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче