diff --git a/gfx/webrender_bindings/src/bindings.rs b/gfx/webrender_bindings/src/bindings.rs index 9c8fb6975c73..e44be7245cf5 100644 --- a/gfx/webrender_bindings/src/bindings.rs +++ b/gfx/webrender_bindings/src/bindings.rs @@ -23,7 +23,6 @@ type WrBuiltDisplayListDescriptor = BuiltDisplayListDescriptor; type WrEpoch = Epoch; type WrExternalImageId = ExternalImageId; type WrFontKey = FontKey; -type WrGlyphInstance = GlyphInstance; type WrIdNamespace = IdNamespace; type WrImageFormat = ImageFormat; type WrImageRendering = ImageRendering; @@ -155,6 +154,7 @@ impl From for WrItemRange { } #[repr(C)] +#[derive(Debug, Clone)] pub struct WrPoint { x: f32, y: f32, @@ -234,6 +234,25 @@ impl WrColor { } } +#[repr(C)] +#[derive(Debug, Clone)] +pub struct WrGlyphInstance { + index: u32, + point: WrPoint, +} + +impl WrGlyphInstance { + pub fn to_glyph_instance(&self) -> GlyphInstance { + GlyphInstance { + index: self.index, + point: self.point.to_point(), + } + } + pub fn to_glyph_instances(glyphs: &[WrGlyphInstance]) -> Vec { + glyphs.iter().map(|x| x.to_glyph_instance()).collect() + } +} + #[repr(C)] pub struct WrGradientStop { offset: f32, @@ -1211,7 +1230,7 @@ pub extern "C" fn wr_dp_push_text(state: &mut WrState, let glyph_slice = unsafe { slice::from_raw_parts(glyphs, glyph_count as usize) }; let mut glyph_vector = Vec::new(); - glyph_vector.extend_from_slice(&glyph_slice); + glyph_vector.extend_from_slice(&WrGlyphInstance::to_glyph_instances(glyph_slice)); let colorf = ColorF::new(color.r, color.g, color.b, color.a); diff --git a/gfx/webrender_bindings/webrender_ffi.h b/gfx/webrender_bindings/webrender_ffi.h index 3091b59f93b8..09c973bd7b23 100644 --- a/gfx/webrender_bindings/webrender_ffi.h +++ b/gfx/webrender_bindings/webrender_ffi.h @@ -78,7 +78,6 @@ void* get_proc_address_from_glcontext(void* glcontext_ptr, const char* procname) // ----- typedef uint64_t WrExternalImageId; -typedef mozilla::gfx::Point Point2D; // TODO: get rid of this somehow // Some useful defines to stub out webrender binding functions for when we // build gecko without webrender. We try to tell the compiler these functions diff --git a/gfx/webrender_bindings/webrender_ffi_generated.h b/gfx/webrender_bindings/webrender_ffi_generated.h index 4e1cf8bae195..b1e51d73c02a 100644 --- a/gfx/webrender_bindings/webrender_ffi_generated.h +++ b/gfx/webrender_bindings/webrender_ffi_generated.h @@ -257,9 +257,19 @@ enum class WrImageRendering: uint32_t { Sentinel /* this must be last for serialization purposes. */ }; +struct WrPoint { + float x; + float y; + + bool operator==(const WrPoint& aOther) const { + return x == aOther.x && + y == aOther.y; + } +}; + struct WrGlyphInstance { uint32_t index; - Point2D point; + WrPoint point; bool operator==(const WrGlyphInstance& aOther) const { return index == aOther.index && @@ -372,16 +382,6 @@ struct WrGradientStop { } }; -struct WrPoint { - float x; - float y; - - bool operator==(const WrPoint& aOther) const { - return x == aOther.x && - y == aOther.y; - } -}; - enum class WrBoxShadowClipMode: uint32_t { None = 0, Outset = 1,