Guest User

Untitled

a guest
Oct 17th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. diff --git a/gfx/webrender_bindings/src/bindings.rs b/gfx/webrender_bindings/src/bindings.rs
  2. index 1747b57e08dd..1708aa539065 100644
  3. --- a/gfx/webrender_bindings/src/bindings.rs
  4. +++ b/gfx/webrender_bindings/src/bindings.rs
  5. @@ -1419,6 +1419,12 @@ pub extern "C" fn wr_dp_push_yuv_interleaved_image(state: &mut WrState,
  6. image_rendering);
  7. }
  8.  
  9. +#[repr(C)]
  10. +struct GeckoGlyph {
  11. + mIndex: u32,
  12. + mPosition: LayoutPoint, // Absolute space, need to apply element's origin offset
  13. +}
  14. +
  15. #[no_mangle]
  16. pub extern "C" fn wr_dp_push_text(state: &mut WrState,
  17. bounds: LayoutRect,
  18. @@ -1426,19 +1432,28 @@ pub extern "C" fn wr_dp_push_text(state: &mut WrState,
  19. is_backface_visible: bool,
  20. color: ColorF,
  21. font_key: WrFontInstanceKey,
  22. - glyphs: *const GlyphInstance,
  23. + origin_offset: LayoutVector2D,
  24. + glyphs: *const GeckoGlyph,
  25. glyph_count: u32,
  26. glyph_options: *const GlyphOptions) {
  27. debug_assert!(unsafe { is_in_main_thread() });
  28.  
  29. let glyph_slice = make_slice(glyphs, glyph_count as usize);
  30.  
  31. + // Need to map gecko glyphs into element-relative space for wr
  32. + let glyph_iter = glyph_slice.iter().map(|src| {
  33. + GlyphInstance {
  34. + index: src.mIndex,
  35. + point: src.mPosition - origin_offset,
  36. + }
  37. + });
  38. +
  39. let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(bounds, clip.into());
  40. prim_info.is_backface_visible = is_backface_visible;
  41. state.frame_builder
  42. .dl_builder
  43. .push_text(&prim_info,
  44. - &glyph_slice,
  45. + glyph_iter,
  46. font_key,
  47. color,
  48. unsafe { glyph_options.as_ref().cloned() });
Add Comment
Please, Sign In to add comment