diff --git a/gfx/thebes/gfxDWriteFonts.cpp b/gfx/thebes/gfxDWriteFonts.cpp index 249e846f79ce..43fc3325d738 100644 --- a/gfx/thebes/gfxDWriteFonts.cpp +++ b/gfx/thebes/gfxDWriteFonts.cpp @@ -126,11 +126,11 @@ gfxDWriteFont::UpdateClearTypeUsage() mUseClearType = UsingClearType(); } -gfxFont* +UniquePtr gfxDWriteFont::CopyWithAntialiasOption(AntialiasOption anAAOption) { - return new gfxDWriteFont(static_cast(mFontEntry.get()), - &mStyle, mNeedsBold, anAAOption); + auto entry = static_cast(mFontEntry.get()); + return MakeUnique(entry, &mStyle, mNeedsBold, anAAOption); } const gfxFont::Metrics& diff --git a/gfx/thebes/gfxDWriteFonts.h b/gfx/thebes/gfxDWriteFonts.h index e8d4e4e1eb30..cc39f6c20d96 100644 --- a/gfx/thebes/gfxDWriteFonts.h +++ b/gfx/thebes/gfxDWriteFonts.h @@ -31,7 +31,7 @@ public: static void UpdateClearTypeUsage(); - virtual gfxFont* + mozilla::UniquePtr CopyWithAntialiasOption(AntialiasOption anAAOption) override; virtual uint32_t GetSpaceGlyph() override; diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 21c1d9f4b060..59965bbcb3bb 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -2305,7 +2305,7 @@ gfxFont::Measure(const gfxTextRun *aTextRun, if (aBoundingBoxType == TIGHT_HINTED_OUTLINE_EXTENTS && mAntialiasOption != kAntialiasNone) { if (!mNonAAFont) { - mNonAAFont.reset(CopyWithAntialiasOption(kAntialiasNone)); + mNonAAFont = Move(CopyWithAntialiasOption(kAntialiasNone)); } // if font subclass doesn't implement CopyWithAntialiasOption(), // it will return null and we'll proceed to use the existing font diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index e58b21ad1e02..c9ec10e5eded 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -1430,7 +1430,8 @@ public: virtual cairo_scaled_font_t* GetCairoScaledFont() { return mScaledFont; } - virtual gfxFont* CopyWithAntialiasOption(AntialiasOption anAAOption) { + virtual mozilla::UniquePtr + CopyWithAntialiasOption(AntialiasOption anAAOption) { // platforms where this actually matters should override return nullptr; } diff --git a/gfx/thebes/gfxGDIFont.cpp b/gfx/thebes/gfxGDIFont.cpp index e6ceeaf6d8b4..0db13f422a61 100644 --- a/gfx/thebes/gfxGDIFont.cpp +++ b/gfx/thebes/gfxGDIFont.cpp @@ -72,11 +72,11 @@ gfxGDIFont::~gfxGDIFont() delete mMetrics; } -gfxFont* +UniquePtr gfxGDIFont::CopyWithAntialiasOption(AntialiasOption anAAOption) { - return new gfxGDIFont(static_cast(mFontEntry.get()), - &mStyle, mNeedsBold, anAAOption); + auto entry = static_cast(mFontEntry.get()); + return MakeUnique(entry, &mStyle, mNeedsBold, anAAOption); } bool diff --git a/gfx/thebes/gfxGDIFont.h b/gfx/thebes/gfxGDIFont.h index 9d8ac9552437..1e0e4a25339f 100644 --- a/gfx/thebes/gfxGDIFont.h +++ b/gfx/thebes/gfxGDIFont.h @@ -45,7 +45,7 @@ public: uint16_t aOrientation) override; /* required for MathML to suppress effects of ClearType "padding" */ - virtual gfxFont* + mozilla::UniquePtr CopyWithAntialiasOption(AntialiasOption anAAOption) override; // If the font has a cmap table, we handle it purely with harfbuzz;