Bug 1382128 part 4 - Remove WrGlyphInstance. r?kats
MozReview-Commit-ID: 2CpW51FKUoK
--- a/gfx/layers/wr/WebRenderBridgeChild.cpp
+++ b/gfx/layers/wr/WebRenderBridgeChild.cpp
@@ -207,30 +207,30 @@ WebRenderBridgeChild::PushGlyphs(wr::Dis
wr::WrFontKey key = GetFontKeyForScaledFont(aFont);
MOZ_ASSERT(key.mNamespace && key.mHandle);
for (size_t i = 0; i < aGlyphs.Length(); i++) {
GlyphArray glyph_array = aGlyphs[i];
nsTArray<gfx::Glyph>& glyphs = glyph_array.glyphs();
- nsTArray<wr::WrGlyphInstance> wr_glyph_instances;
+ nsTArray<wr::GlyphInstance> wr_glyph_instances;
wr_glyph_instances.SetLength(glyphs.Length());
for (size_t j = 0; j < glyphs.Length(); j++) {
wr_glyph_instances[j].index = glyphs[j].mIndex;
wr_glyph_instances[j].point = aSc.ToRelativeLayoutPoint(
LayerPoint::FromUnknownPoint(glyphs[j].mPosition));
}
aBuilder.PushText(aSc.ToRelativeLayoutRect(aBounds),
aSc.ToRelativeLayoutRect(aClip),
glyph_array.color().value(),
key,
- Range<const wr::WrGlyphInstance>(wr_glyph_instances.Elements(), wr_glyph_instances.Length()),
+ Range<const wr::GlyphInstance>(wr_glyph_instances.Elements(), wr_glyph_instances.Length()),
aFont->GetSize());
}
}
wr::FontKey
WebRenderBridgeChild::GetFontKeyForScaledFont(gfx::ScaledFont* aScaledFont)
{
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -844,17 +844,17 @@ DisplayListBuilder::PushBorderRadialGrad
aExtendMode, aOutset);
}
void
DisplayListBuilder::PushText(const wr::LayoutRect& aBounds,
const wr::LayoutRect& aClip,
const gfx::Color& aColor,
wr::FontKey aFontKey,
- Range<const wr::WrGlyphInstance> aGlyphBuffer,
+ Range<const wr::GlyphInstance> aGlyphBuffer,
float aGlyphSize)
{
wr_dp_push_text(mWrState, aBounds, aClip,
ToColorF(aColor),
aFontKey,
&aGlyphBuffer[0], aGlyphBuffer.length(),
aGlyphSize);
}
--- a/gfx/webrender_bindings/WebRenderAPI.h
+++ b/gfx/webrender_bindings/WebRenderAPI.h
@@ -265,17 +265,17 @@ public:
const nsTArray<wr::WrGradientStop>& aStops,
wr::GradientExtendMode aExtendMode,
const wr::SideOffsets2D_f32& aOutset);
void PushText(const wr::LayoutRect& aBounds,
const wr::LayoutRect& aClip,
const gfx::Color& aColor,
wr::FontKey aFontKey,
- Range<const wr::WrGlyphInstance> aGlyphBuffer,
+ Range<const wr::GlyphInstance> aGlyphBuffer,
float aGlyphSize);
void PushBoxShadow(const wr::LayoutRect& aRect,
const wr::LayoutRect& aClip,
const wr::LayoutRect& aBoxBounds,
const wr::LayoutVector2D& aOffset,
const wr::ColorF& aColor,
const float& aBlurRadius,
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -153,32 +153,16 @@ impl Into<ExtendMode> for WrGradientExte
WrGradientExtendMode::Clamp => ExtendMode::Clamp,
WrGradientExtendMode::Repeat => ExtendMode::Repeat,
}
}
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
-pub struct WrGlyphInstance {
- index: u32,
- point: LayoutPoint,
-}
-
-impl<'a> Into<GlyphInstance> for &'a WrGlyphInstance {
- fn into(self) -> GlyphInstance {
- GlyphInstance {
- index: self.index,
- point: self.point.into(),
- }
- }
-}
-
-#[repr(C)]
-#[derive(Debug, Clone, Copy)]
pub struct WrGradientStop {
offset: f32,
color: ColorF,
}
impl<'a> Into<GradientStop> for &'a WrGradientStop {
fn into(self) -> GradientStop {
GradientStop {
@@ -1309,32 +1293,31 @@ pub extern "C" fn wr_dp_push_yuv_interle
}
#[no_mangle]
pub extern "C" fn wr_dp_push_text(state: &mut WrState,
bounds: LayoutRect,
clip: LayoutRect,
color: ColorF,
font_key: WrFontKey,
- glyphs: *const WrGlyphInstance,
+ glyphs: *const GlyphInstance,
glyph_count: u32,
glyph_size: f32) {
assert!(unsafe { is_in_main_thread() });
let glyph_slice = make_slice(glyphs, glyph_count as usize);
- let glyph_vector: Vec<_> = glyph_slice.iter().map(|x| x.into()).collect();
let colorf = ColorF::new(color.r, color.g, color.b, color.a);
let glyph_options = None; // TODO
state.frame_builder
.dl_builder
.push_text(bounds.into(),
Some(LocalClip::Rect(clip.into())),
- &glyph_vector,
+ &glyph_slice,
font_key,
colorf,
Au::from_f32_px(glyph_size),
glyph_options);
}
#[no_mangle]
pub extern "C" fn wr_dp_push_border(state: &mut WrState,
--- a/gfx/webrender_bindings/webrender_ffi.h
+++ b/gfx/webrender_bindings/webrender_ffi.h
@@ -43,37 +43,9 @@ void* get_proc_address_from_glcontext(vo
# define WR_DESTRUCTOR_SAFE_FUNC {}
#endif
#include "webrender_ffi_generated.h"
#undef WR_FUNC
#undef WR_DESTRUCTOR_SAFE_FUNC
-namespace mozilla {
-namespace wr {
-
-struct WrGlyphArray
-{
- mozilla::gfx::Color color;
- nsTArray<wr::WrGlyphInstance> glyphs;
-
- bool operator==(const wr::WrGlyphArray& other) const
- {
- if (!(color == other.color) ||
- (glyphs.Length() != other.glyphs.Length())) {
- return false;
- }
-
- for (size_t i = 0; i < glyphs.Length(); i++) {
- if (!(glyphs[i] == other.glyphs[i])) {
- return false;
- }
- }
-
- return true;
- }
-};
-
-} // namespace wr
-} // namespace mozilla
-
#endif // WR_h
--- a/gfx/webrender_bindings/webrender_ffi_generated.h
+++ b/gfx/webrender_bindings/webrender_ffi_generated.h
@@ -428,44 +428,44 @@ struct WrGradientStop {
ColorF color;
bool operator==(const WrGradientStop& aOther) const {
return offset == aOther.offset &&
color == aOther.color;
}
};
+struct SideOffsets2D_u32 {
+ uint32_t top;
+ uint32_t right;
+ uint32_t bottom;
+ uint32_t left;
+
+ bool operator==(const SideOffsets2D_u32& aOther) const {
+ return top == aOther.top &&
+ right == aOther.right &&
+ bottom == aOther.bottom &&
+ left == aOther.left;
+ }
+};
+
struct SideOffsets2D_f32 {
float top;
float right;
float bottom;
float left;
bool operator==(const SideOffsets2D_f32& aOther) const {
return top == aOther.top &&
right == aOther.right &&
bottom == aOther.bottom &&
left == aOther.left;
}
};
-struct SideOffsets2D_u32 {
- uint32_t top;
- uint32_t right;
- uint32_t bottom;
- uint32_t left;
-
- bool operator==(const SideOffsets2D_u32& aOther) const {
- return top == aOther.top &&
- right == aOther.right &&
- bottom == aOther.bottom &&
- left == aOther.left;
- }
-};
-
struct WrNinePatchDescriptor {
uint32_t width;
uint32_t height;
SideOffsets2D_u32 slice;
bool operator==(const WrNinePatchDescriptor& aOther) const {
return width == aOther.width &&
height == aOther.height &&
@@ -510,21 +510,21 @@ struct WrFilterOp {
float argument;
bool operator==(const WrFilterOp& aOther) const {
return filter_type == aOther.filter_type &&
argument == aOther.argument;
}
};
-struct WrGlyphInstance {
+struct GlyphInstance {
uint32_t index;
LayoutPoint point;
- bool operator==(const WrGlyphInstance& aOther) const {
+ bool operator==(const GlyphInstance& aOther) const {
return index == aOther.index &&
point == aOther.point;
}
};
struct MutByteSlice {
uint8_t *buffer;
size_t len;
@@ -889,17 +889,17 @@ void wr_dp_push_stacking_context(WrState
WR_FUNC;
WR_INLINE
void wr_dp_push_text(WrState *aState,
LayoutRect aBounds,
LayoutRect aClip,
ColorF aColor,
WrFontKey aFontKey,
- const WrGlyphInstance *aGlyphs,
+ const GlyphInstance *aGlyphs,
uint32_t aGlyphCount,
float aGlyphSize)
WR_FUNC;
WR_INLINE
void wr_dp_push_yuv_NV12_image(WrState *aState,
LayoutRect aBounds,
LayoutRect aClip,