diff --git a/gfx/2d/ScaledFontMac.h b/gfx/2d/ScaledFontMac.h index c141f96b26cd..37e730d46c91 100644 --- a/gfx/2d/ScaledFontMac.h +++ b/gfx/2d/ScaledFontMac.h @@ -50,6 +50,7 @@ public: #endif virtual already_AddRefed GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget); virtual bool GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton); + virtual bool CanSerialize() override { return true; } #ifdef USE_CAIRO_SCALED_FONT cairo_font_face_t* GetCairoFontFace(); diff --git a/gfx/layers/wr/WebRenderBridgeParent.cpp b/gfx/layers/wr/WebRenderBridgeParent.cpp index e41482076983..4f0f01c90539 100644 --- a/gfx/layers/wr/WebRenderBridgeParent.cpp +++ b/gfx/layers/wr/WebRenderBridgeParent.cpp @@ -359,13 +359,13 @@ WebRenderBridgeParent::ProcessWebrenderCommands(InfallibleTArray& glyph_array = op.glyph_array(); + // TODO: We are leaking the key + wr::FontKey fontKey; + auto slice = Range(op.font_buffer().mData, op.font_buffer_length()); + fontKey = mApi->AddRawFont(slice); + for (size_t i = 0; i < glyph_array.Length(); i++) { const nsTArray& glyphs = glyph_array[i].glyphs; - - // TODO: We are leaking the key - wr::FontKey fontKey; - auto slice = Range(op.font_buffer().mData, op.font_buffer_length()); - fontKey = mApi->AddRawFont(slice); builder.PushText(op.bounds(), op.clip(), glyph_array[i].color, diff --git a/gfx/layers/wr/WebRenderTextLayer.cpp b/gfx/layers/wr/WebRenderTextLayer.cpp index bd229d3d7562..41bdf53e5947 100644 --- a/gfx/layers/wr/WebRenderTextLayer.cpp +++ b/gfx/layers/wr/WebRenderTextLayer.cpp @@ -16,9 +16,9 @@ namespace layers { using namespace mozilla::gfx; static void -DWriteFontFileData(const uint8_t* aData, uint32_t aLength, uint32_t aIndex, - float aGlyphSize, uint32_t aVariationCount, - const ScaledFont::VariationSetting* aVariations, void* aBaton) +WriteFontFileData(const uint8_t* aData, uint32_t aLength, uint32_t aIndex, + float aGlyphSize, uint32_t aVariationCount, + const ScaledFont::VariationSetting* aVariations, void* aBaton) { WebRenderTextLayer* layer = static_cast(aBaton); @@ -46,8 +46,9 @@ WebRenderTextLayer::RenderLayer() clip = rect; } - MOZ_ASSERT(mFont->GetType() == FontType::DWRITE); - mFont->GetFontFileData(&DWriteFontFileData, this); + MOZ_ASSERT((mFont->GetType() == FontType::DWRITE) || + (mFont->GetType() == FontType::MAC)); + mFont->GetFontFileData(&WriteFontFileData, this); wr::ByteBuffer fontBuffer(mFontDataLength, mFontData); nsTArray wr_glyphs;