Bug 1382128 part 4 - Remove WrGlyphInstance. r=kats

MozReview-Commit-ID: 2CpW51FKUoK

--HG--
extra : rebase_source : d24e596dbd1a114d660e0b0ec1657f3efc11965d
This commit is contained in:
Ryan Hunt 2017-07-18 18:53:09 -04:00
Родитель 9b7f455eef
Коммит f082c1791e
6 изменённых файлов: 23 добавлений и 68 удалений

Просмотреть файл

@ -213,7 +213,7 @@ WebRenderBridgeChild::PushGlyphs(wr::DisplayListBuilder& aBuilder, const nsTArra
GlyphArray glyph_array = aGlyphs[i]; GlyphArray glyph_array = aGlyphs[i];
nsTArray<gfx::Glyph>& glyphs = glyph_array.glyphs(); 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()); wr_glyph_instances.SetLength(glyphs.Length());
for (size_t j = 0; j < glyphs.Length(); j++) { for (size_t j = 0; j < glyphs.Length(); j++) {
@ -226,7 +226,7 @@ WebRenderBridgeChild::PushGlyphs(wr::DisplayListBuilder& aBuilder, const nsTArra
aSc.ToRelativeLayoutRect(aClip), aSc.ToRelativeLayoutRect(aClip),
glyph_array.color().value(), glyph_array.color().value(),
key, 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()); aFont->GetSize());
} }

Просмотреть файл

@ -849,7 +849,7 @@ DisplayListBuilder::PushText(const wr::LayoutRect& aBounds,
const wr::LayoutRect& aClip, const wr::LayoutRect& aClip,
const gfx::Color& aColor, const gfx::Color& aColor,
wr::FontKey aFontKey, wr::FontKey aFontKey,
Range<const wr::WrGlyphInstance> aGlyphBuffer, Range<const wr::GlyphInstance> aGlyphBuffer,
float aGlyphSize) float aGlyphSize)
{ {
wr_dp_push_text(mWrState, aBounds, aClip, wr_dp_push_text(mWrState, aBounds, aClip,

Просмотреть файл

@ -270,7 +270,7 @@ public:
const wr::LayoutRect& aClip, const wr::LayoutRect& aClip,
const gfx::Color& aColor, const gfx::Color& aColor,
wr::FontKey aFontKey, wr::FontKey aFontKey,
Range<const wr::WrGlyphInstance> aGlyphBuffer, Range<const wr::GlyphInstance> aGlyphBuffer,
float aGlyphSize); float aGlyphSize);
void PushBoxShadow(const wr::LayoutRect& aRect, void PushBoxShadow(const wr::LayoutRect& aRect,

Просмотреть файл

@ -156,22 +156,6 @@ impl Into<ExtendMode> for WrGradientExtendMode {
} }
} }
#[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)] #[repr(C)]
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub struct WrGradientStop { pub struct WrGradientStop {
@ -1314,13 +1298,12 @@ pub extern "C" fn wr_dp_push_text(state: &mut WrState,
clip: LayoutRect, clip: LayoutRect,
color: ColorF, color: ColorF,
font_key: WrFontKey, font_key: WrFontKey,
glyphs: *const WrGlyphInstance, glyphs: *const GlyphInstance,
glyph_count: u32, glyph_count: u32,
glyph_size: f32) { glyph_size: f32) {
assert!(unsafe { is_in_main_thread() }); assert!(unsafe { is_in_main_thread() });
let glyph_slice = make_slice(glyphs, glyph_count as usize); 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 colorf = ColorF::new(color.r, color.g, color.b, color.a);
@ -1329,7 +1312,7 @@ pub extern "C" fn wr_dp_push_text(state: &mut WrState,
.dl_builder .dl_builder
.push_text(bounds.into(), .push_text(bounds.into(),
Some(LocalClip::Rect(clip.into())), Some(LocalClip::Rect(clip.into())),
&glyph_vector, &glyph_slice,
font_key, font_key,
colorf, colorf,
Au::from_f32_px(glyph_size), Au::from_f32_px(glyph_size),

Просмотреть файл

@ -48,32 +48,4 @@ void* get_proc_address_from_glcontext(void* glcontext_ptr, const char* procname)
#undef WR_FUNC #undef WR_FUNC
#undef WR_DESTRUCTOR_SAFE_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 #endif // WR_h

Просмотреть файл

@ -433,20 +433,6 @@ struct WrGradientStop {
} }
}; };
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 { struct SideOffsets2D_u32 {
uint32_t top; uint32_t top;
uint32_t right; uint32_t right;
@ -461,6 +447,20 @@ struct SideOffsets2D_u32 {
} }
}; };
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 WrNinePatchDescriptor { struct WrNinePatchDescriptor {
uint32_t width; uint32_t width;
uint32_t height; uint32_t height;
@ -515,11 +515,11 @@ struct WrFilterOp {
} }
}; };
struct WrGlyphInstance { struct GlyphInstance {
uint32_t index; uint32_t index;
LayoutPoint point; LayoutPoint point;
bool operator==(const WrGlyphInstance& aOther) const { bool operator==(const GlyphInstance& aOther) const {
return index == aOther.index && return index == aOther.index &&
point == aOther.point; point == aOther.point;
} }
@ -894,7 +894,7 @@ void wr_dp_push_text(WrState *aState,
LayoutRect aClip, LayoutRect aClip,
ColorF aColor, ColorF aColor,
WrFontKey aFontKey, WrFontKey aFontKey,
const WrGlyphInstance *aGlyphs, const GlyphInstance *aGlyphs,
uint32_t aGlyphCount, uint32_t aGlyphCount,
float aGlyphSize) float aGlyphSize)
WR_FUNC; WR_FUNC;