зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1337616 - Stop adding a new font key for every glyph array. r=jmuizelaar
This commit is contained in:
Родитель
f9c6425844
Коммит
78c642ecdc
|
@ -50,6 +50,7 @@ public:
|
||||||
#endif
|
#endif
|
||||||
virtual already_AddRefed<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget);
|
virtual already_AddRefed<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget);
|
||||||
virtual bool GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton);
|
virtual bool GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton);
|
||||||
|
virtual bool CanSerialize() override { return true; }
|
||||||
|
|
||||||
#ifdef USE_CAIRO_SCALED_FONT
|
#ifdef USE_CAIRO_SCALED_FONT
|
||||||
cairo_font_face_t* GetCairoFontFace();
|
cairo_font_face_t* GetCairoFontFace();
|
||||||
|
|
|
@ -359,13 +359,13 @@ WebRenderBridgeParent::ProcessWebrenderCommands(InfallibleTArray<WebRenderComman
|
||||||
const OpDPPushText& op = cmd.get_OpDPPushText();
|
const OpDPPushText& op = cmd.get_OpDPPushText();
|
||||||
const nsTArray<WrGlyphArray>& glyph_array = op.glyph_array();
|
const nsTArray<WrGlyphArray>& glyph_array = op.glyph_array();
|
||||||
|
|
||||||
|
// TODO: We are leaking the key
|
||||||
|
wr::FontKey fontKey;
|
||||||
|
auto slice = Range<uint8_t>(op.font_buffer().mData, op.font_buffer_length());
|
||||||
|
fontKey = mApi->AddRawFont(slice);
|
||||||
|
|
||||||
for (size_t i = 0; i < glyph_array.Length(); i++) {
|
for (size_t i = 0; i < glyph_array.Length(); i++) {
|
||||||
const nsTArray<WrGlyphInstance>& glyphs = glyph_array[i].glyphs;
|
const nsTArray<WrGlyphInstance>& glyphs = glyph_array[i].glyphs;
|
||||||
|
|
||||||
// TODO: We are leaking the key
|
|
||||||
wr::FontKey fontKey;
|
|
||||||
auto slice = Range<uint8_t>(op.font_buffer().mData, op.font_buffer_length());
|
|
||||||
fontKey = mApi->AddRawFont(slice);
|
|
||||||
builder.PushText(op.bounds(),
|
builder.PushText(op.bounds(),
|
||||||
op.clip(),
|
op.clip(),
|
||||||
glyph_array[i].color,
|
glyph_array[i].color,
|
||||||
|
|
|
@ -16,9 +16,9 @@ namespace layers {
|
||||||
using namespace mozilla::gfx;
|
using namespace mozilla::gfx;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DWriteFontFileData(const uint8_t* aData, uint32_t aLength, uint32_t aIndex,
|
WriteFontFileData(const uint8_t* aData, uint32_t aLength, uint32_t aIndex,
|
||||||
float aGlyphSize, uint32_t aVariationCount,
|
float aGlyphSize, uint32_t aVariationCount,
|
||||||
const ScaledFont::VariationSetting* aVariations, void* aBaton)
|
const ScaledFont::VariationSetting* aVariations, void* aBaton)
|
||||||
{
|
{
|
||||||
WebRenderTextLayer* layer = static_cast<WebRenderTextLayer*>(aBaton);
|
WebRenderTextLayer* layer = static_cast<WebRenderTextLayer*>(aBaton);
|
||||||
|
|
||||||
|
@ -46,8 +46,9 @@ WebRenderTextLayer::RenderLayer()
|
||||||
clip = rect;
|
clip = rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(mFont->GetType() == FontType::DWRITE);
|
MOZ_ASSERT((mFont->GetType() == FontType::DWRITE) ||
|
||||||
mFont->GetFontFileData(&DWriteFontFileData, this);
|
(mFont->GetType() == FontType::MAC));
|
||||||
|
mFont->GetFontFileData(&WriteFontFileData, this);
|
||||||
wr::ByteBuffer fontBuffer(mFontDataLength, mFontData);
|
wr::ByteBuffer fontBuffer(mFontDataLength, mFontData);
|
||||||
|
|
||||||
nsTArray<WrGlyphArray> wr_glyphs;
|
nsTArray<WrGlyphArray> wr_glyphs;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче