Bug 1347062 - P2: use WrImageDescriptor for wr_api_add_external_image_handle(). r=nical,sotaro

MozReview-Commit-ID: 1dNQRZGeKaA
This commit is contained in:
JerryShih
2017-03-31 22:29:14 +08:00
parent 9d5de27a3c
commit 857444c0cf
4 changed files with 11 additions and 22 deletions

View File

@@ -46,10 +46,10 @@ public:
layers::AutoCompleteTask complete(mTask);
RefPtr<gl::GLContext> gl;
if (gfxVars::UseWebRenderANGLE()) {
if (gfx::gfxVars::UseWebRenderANGLE()) {
gl = gl::GLContextProviderEGL::CreateForCompositorWidget(mCompositorWidget, true);
if (!gl || !gl->IsANGLE()) {
gfxCriticalNote << "Failed ANGLE GL context creation for WebRender: " << hexa(gl.get());
gfxCriticalNote << "Failed ANGLE GL context creation for WebRender: " << gfx::hexa(gl.get());
return;
}
}
@@ -57,7 +57,7 @@ public:
gl = gl::GLContextProvider::CreateForCompositorWidget(mCompositorWidget, true);
}
if (!gl || !gl->MakeCurrent()) {
gfxCriticalNote << "Failed GL context creation for WebRender: " << hexa(gl.get());
gfxCriticalNote << "Failed GL context creation for WebRender: " << gfx::hexa(gl.get());
return;
}
@@ -327,14 +327,12 @@ WebRenderAPI::AddBlobImage(ImageKey key, const ImageDescriptor& aDescriptor,
void
WebRenderAPI::AddExternalImageHandle(ImageKey key,
gfx::IntSize aSize,
gfx::SurfaceFormat aFormat,
const ImageDescriptor& aDescriptor,
uint64_t aHandle)
{
auto format = SurfaceFormatToWrImageFormat(aFormat).value();
wr_api_add_external_image_handle(mWrApi,
key,
aSize.width, aSize.height, format,
&aDescriptor,
aHandle);
}

View File

@@ -72,8 +72,7 @@ public:
Range<uint8_t> aBytes);
void AddExternalImageHandle(ImageKey key,
gfx::IntSize aSize,
gfx::SurfaceFormat aFormat,
const ImageDescriptor& aDescriptor,
uint64_t aHandle);
void AddExternalImageBuffer(ImageKey key,

View File

@@ -804,20 +804,11 @@ pub extern "C" fn wr_api_add_blob_image(api: &mut RenderApi,
#[no_mangle]
pub extern "C" fn wr_api_add_external_image_handle(api: &mut RenderApi,
image_key: ImageKey,
width: u32,
height: u32,
format: ImageFormat,
descriptor: &WrImageDescriptor,
external_image_id: u64) {
assert!(unsafe { is_in_compositor_thread() });
api.add_image(image_key,
ImageDescriptor {
width: width,
height: height,
stride: None,
format: format,
is_opaque: false,
offset: 0,
},
descriptor.to_descriptor(),
ImageData::ExternalHandle(ExternalImageId(external_image_id)),
None);
}

View File

@@ -545,8 +545,9 @@ wr_api_add_blob_image(WrAPI* api, WrImageKey key, const WrImageDescriptor* descr
WR_FUNC;
WR_INLINE void
wr_api_add_external_image_handle(WrAPI* api, WrImageKey key, uint32_t width, uint32_t height,
WrImageFormat format, uint64_t external_image_id)
wr_api_add_external_image_handle(WrAPI* api, WrImageKey key,
const WrImageDescriptor* descriptor,
uint64_t external_image_id)
WR_FUNC;
WR_INLINE void