зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1356371 - Create a WrExternalImageId because ExternalImageId is not repr(C) r=kats
This is only temporary as ExternalImageId has been made repr(C) upstream. MozReview-Commit-ID: 1On7fRbNI4o --HG-- extra : rebase_source : 91cb93829de5ccf0a6f0a05ed0d2169268b6c18c
This commit is contained in:
Родитель
d2799c4902
Коммит
422ca37abb
|
@ -241,11 +241,11 @@ RenderThread::UnregisterExternalImage(uint64_t aExternalImageId)
|
|||
}
|
||||
|
||||
RenderTextureHost*
|
||||
RenderThread::GetRenderTexture(uint64_t aExternalImageId)
|
||||
RenderThread::GetRenderTexture(WrExternalImageId aExternalImageId)
|
||||
{
|
||||
MutexAutoLock lock(mRenderTextureMapLock);
|
||||
MOZ_ASSERT(mRenderTextures.Get(aExternalImageId).get());
|
||||
return mRenderTextures.Get(aExternalImageId).get();
|
||||
MOZ_ASSERT(mRenderTextures.Get(aExternalImageId.mHandle).get());
|
||||
return mRenderTextures.Get(aExternalImageId.mHandle).get();
|
||||
}
|
||||
|
||||
} // namespace wr
|
||||
|
|
|
@ -109,7 +109,7 @@ public:
|
|||
|
||||
void UnregisterExternalImage(uint64_t aExternalImageId);
|
||||
|
||||
RenderTextureHost* GetRenderTexture(uint64_t aExternalImageId);
|
||||
RenderTextureHost* GetRenderTexture(WrExternalImageId aExternalImageId);
|
||||
|
||||
private:
|
||||
explicit RenderThread(base::Thread* aThread);
|
||||
|
|
|
@ -174,7 +174,7 @@ RendererOGL::FlushRenderedEpochs()
|
|||
}
|
||||
|
||||
RenderTextureHost*
|
||||
RendererOGL::GetRenderTexture(uint64_t aExternalImageId)
|
||||
RendererOGL::GetRenderTexture(WrExternalImageId aExternalImageId)
|
||||
{
|
||||
return mThread->GetRenderTexture(aExternalImageId);
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
|
||||
WrRenderedEpochs* FlushRenderedEpochs();
|
||||
|
||||
RenderTextureHost* GetRenderTexture(uint64_t aExternalImageId);
|
||||
RenderTextureHost* GetRenderTexture(WrExternalImageId aExternalImageId);
|
||||
|
||||
WrRenderer* GetWrRenderer() { return mWrRenderer; }
|
||||
|
||||
|
|
|
@ -365,7 +365,9 @@ static inline WrComplexClipRegion ToWrComplexClipRegion(const gfx::RectTyped<T>&
|
|||
|
||||
static inline WrExternalImageId ToWrExternalImageId(uint64_t aID)
|
||||
{
|
||||
return aID;
|
||||
WrExternalImageId Id;
|
||||
Id.mHandle = aID;
|
||||
return Id;
|
||||
}
|
||||
|
||||
static inline WrExternalImage RawDataToWrExternalImage(const uint8_t* aBuff,
|
||||
|
|
|
@ -21,7 +21,6 @@ type WrBorderStyle = BorderStyle;
|
|||
type WrBoxShadowClipMode = BoxShadowClipMode;
|
||||
type WrBuiltDisplayListDescriptor = BuiltDisplayListDescriptor;
|
||||
type WrEpoch = Epoch;
|
||||
type WrExternalImageId = ExternalImageId;
|
||||
type WrFontKey = FontKey;
|
||||
type WrIdNamespace = IdNamespace;
|
||||
type WrImageFormat = ImageFormat;
|
||||
|
@ -40,6 +39,21 @@ type WrSideOffsets2Df32 = WrSideOffsets2D<f32>;
|
|||
// by commenting out the path that adds an external image ID
|
||||
static ENABLE_RECORDING: bool = false;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct WrExternalImageId(pub u64);
|
||||
|
||||
impl Into<ExternalImageId> for WrExternalImageId {
|
||||
fn into(self) -> ExternalImageId {
|
||||
ExternalImageId(self.0)
|
||||
}
|
||||
}
|
||||
impl Into<WrExternalImageId> for ExternalImageId {
|
||||
fn into(self) -> WrExternalImageId {
|
||||
WrExternalImageId(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
// This macro adds some checks to make sure we notice when the memory representation of
|
||||
// types change.
|
||||
macro_rules! check_ffi_type {
|
||||
|
@ -519,8 +533,8 @@ pub struct WrExternalImageHandler {
|
|||
}
|
||||
|
||||
impl ExternalImageHandler for WrExternalImageHandler {
|
||||
fn lock(&mut self, id: WrExternalImageId) -> ExternalImage {
|
||||
let image = (self.lock_func)(self.external_image_obj, id);
|
||||
fn lock(&mut self, id: ExternalImageId) -> ExternalImage {
|
||||
let image = (self.lock_func)(self.external_image_obj, id.into());
|
||||
|
||||
match image.image_type {
|
||||
WrExternalImageType::NativeTexture => {
|
||||
|
@ -547,12 +561,12 @@ impl ExternalImageHandler for WrExternalImageHandler {
|
|||
}
|
||||
}
|
||||
|
||||
fn unlock(&mut self, id: WrExternalImageId) {
|
||||
(self.unlock_func)(self.external_image_obj, id);
|
||||
fn unlock(&mut self, id: ExternalImageId) {
|
||||
(self.unlock_func)(self.external_image_obj, id.into());
|
||||
}
|
||||
|
||||
fn release(&mut self, id: WrExternalImageId) {
|
||||
(self.release_func)(self.external_image_obj, id);
|
||||
fn release(&mut self, id: ExternalImageId) {
|
||||
(self.release_func)(self.external_image_obj, id.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ extern "C" {
|
|||
WR_DECL_FFI_1(WrEpoch, uint32_t)
|
||||
WR_DECL_FFI_1(WrIdNamespace, uint32_t)
|
||||
WR_DECL_FFI_1(WrWindowId, uint64_t)
|
||||
WR_DECL_FFI_1(WrExternalImageId, uint64_t)
|
||||
|
||||
WR_DECL_FFI_2(WrPipelineId, uint32_t, uint32_t)
|
||||
WR_DECL_FFI_2(WrImageKey, uint32_t, uint32_t)
|
||||
|
@ -73,12 +74,6 @@ bool is_glcontext_egl(void* glcontext_ptr);
|
|||
void gfx_critical_note(const char* msg);
|
||||
void* get_proc_address_from_glcontext(void* glcontext_ptr, const char* procname);
|
||||
|
||||
// -----
|
||||
// Typedefs for struct fields and function signatures below.
|
||||
// -----
|
||||
|
||||
typedef uint64_t WrExternalImageId;
|
||||
|
||||
// Some useful defines to stub out webrender binding functions for when we
|
||||
// build gecko without webrender. We try to tell the compiler these functions
|
||||
// are unreachable in that case, but VC++ emits a warning if it finds any
|
||||
|
|
Загрузка…
Ссылка в новой задаче