Bug 1385029 - remove redundant CairoScaledFont accessor from gfxFont subclasses. r=jfkthame
authorLee Salzman <lsalzman@mozilla.com>
Mon, 07 Aug 2017 16:20:40 -0400
changeset 422812 24c8d3ee219f1aa582a16fb702c0e6376297fe1c
parent 422811 de5db6588684d33ee0e053241748148137488162
child 422813 b1f2be9ad554279190fd751e8252330b912ecffb
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1385029
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1385029 - remove redundant CairoScaledFont accessor from gfxFont subclasses. r=jfkthame MozReview-Commit-ID: BjcKkCgSZdG
gfx/thebes/gfxFT2FontBase.cpp
gfx/thebes/gfxFT2FontBase.h
gfx/thebes/gfxFT2Utils.h
gfx/thebes/gfxGDIFont.h
--- a/gfx/thebes/gfxFT2FontBase.cpp
+++ b/gfx/thebes/gfxFT2FontBase.cpp
@@ -40,17 +40,17 @@ gfxFT2FontBase::~gfxFT2FontBase()
 uint32_t
 gfxFT2FontBase::GetGlyph(uint32_t aCharCode)
 {
     // FcFreeTypeCharIndex needs to lock the FT_Face and can end up searching
     // through all the postscript glyph names in the font.  Therefore use a
     // lightweight cache, which is stored on the cairo_font_face_t.
 
     cairo_font_face_t *face =
-        cairo_scaled_font_get_font_face(CairoScaledFont());
+        cairo_scaled_font_get_font_face(GetCairoScaledFont());
 
     if (cairo_font_face_status(face) != CAIRO_STATUS_SUCCESS)
         return 0;
 
     // This cache algorithm and size is based on what is done in
     // cairo_scaled_font_text_to_glyphs and pango_fc_font_real_get_glyph.  I
     // think the concept is that adjacent characters probably come mostly from
     // one Unicode block.  This assumption is probably not so valid with
@@ -108,17 +108,17 @@ gfxFT2FontBase::GetGlyphExtents(uint32_t
     glyphs[0].index = aGlyph;
     glyphs[0].x = 0.0;
     glyphs[0].y = 0.0;
     // cairo does some caching for us here but perhaps a small gain could be
     // made by caching more.  It is usually only the advance that is needed,
     // so caching only the advance could allow many requests to be cached with
     // little memory use.  Ideally this cache would be merged with
     // gfxGlyphExtents.
-    cairo_scaled_font_glyph_extents(CairoScaledFont(), glyphs, 1, aExtents);
+    cairo_scaled_font_glyph_extents(GetCairoScaledFont(), glyphs, 1, aExtents);
 }
 
 // aScale is intended for a 16.16 x/y_scale of an FT_Size_Metrics
 static inline FT_Long
 ScaleRoundDesignUnits(FT_Short aDesignMetric, FT_Fixed aScale)
 {
     FT_Long fixed26dot6 = FT_MulFix(aDesignMetric, aScale);
     return ROUND_26_6_TO_INT(fixed26dot6);
@@ -481,17 +481,17 @@ bool
 gfxFT2FontBase::SetupCairoFont(DrawTarget* aDrawTarget)
 {
     // The scaled font ctm is not relevant right here because
     // cairo_set_scaled_font does not record the scaled font itself, but
     // merely the font_face, font_matrix, font_options.  The scaled_font used
     // for the target can be different from the scaled_font passed to
     // cairo_set_scaled_font.  (Unfortunately we have measured only for an
     // identity ctm.)
-    cairo_scaled_font_t *cairoFont = CairoScaledFont();
+    cairo_scaled_font_t *cairoFont = GetCairoScaledFont();
 
     if (cairo_scaled_font_status(cairoFont) != CAIRO_STATUS_SUCCESS) {
         // Don't cairo_set_scaled_font as that would propagate the error to
         // the cairo_t, precluding any further drawing.
         return false;
     }
     // Thoughts on which font_options to set on the context:
     //
--- a/gfx/thebes/gfxFT2FontBase.h
+++ b/gfx/thebes/gfxFT2FontBase.h
@@ -26,17 +26,16 @@ public:
     virtual uint32_t GetSpaceGlyph() override;
     virtual bool ProvidesGetGlyph() const override { return true; }
     virtual uint32_t GetGlyph(uint32_t unicode,
                               uint32_t variation_selector) override;
     virtual bool ProvidesGlyphWidths() const override { return true; }
     virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget,
                                   uint16_t aGID) override;
 
-    cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; };
     virtual bool SetupCairoFont(DrawTarget* aDrawTarget) override;
 
     virtual FontType GetType() const override { return FONT_TYPE_FT2; }
 
 private:
     uint32_t GetCharExtents(char aChar, cairo_text_extents_t* aExtents);
     void InitMetrics();
 
--- a/gfx/thebes/gfxFT2Utils.h
+++ b/gfx/thebes/gfxFT2Utils.h
@@ -26,22 +26,22 @@ typedef struct FT_FaceRec_* FT_Face;
  * Do not attempt to call into Cairo within the scope of gfxFT2LockedFace,
  * as that may accidentally try to re-lock the face within Cairo itself
  * and thus deadlock.
  */
 class gfxFT2LockedFace {
 public:
     explicit gfxFT2LockedFace(gfxFT2FontBase *aFont) :
         mGfxFont(aFont),
-        mFace(cairo_ft_scaled_font_lock_face(aFont->CairoScaledFont()))
+        mFace(cairo_ft_scaled_font_lock_face(aFont->GetCairoScaledFont()))
     { }
     ~gfxFT2LockedFace()
     {
         if (mFace) {
-            cairo_ft_scaled_font_unlock_face(mGfxFont->CairoScaledFont());
+            cairo_ft_scaled_font_unlock_face(mGfxFont->GetCairoScaledFont());
         }
     }
 
     FT_Face get() { return mFace; };
 
     /**
      * Get the glyph id for a Unicode character representable by a single
      * glyph, or return zero if there is no such glyph.  This does no caching,
--- a/gfx/thebes/gfxGDIFont.h
+++ b/gfx/thebes/gfxGDIFont.h
@@ -23,18 +23,17 @@ public:
                const gfxFontStyle *aFontStyle,
                bool aNeedsBold,
                AntialiasOption anAAOption = kAntialiasDefault);
 
     virtual ~gfxGDIFont();
 
     HFONT GetHFONT() { return mFont; }
 
-    cairo_font_face_t   *CairoFontFace() { return mFontFace; }
-    cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; }
+    cairo_font_face_t* CairoFontFace() { return mFontFace; }
 
     /* overrides for the pure virtual methods in gfxFont */
     virtual uint32_t GetSpaceGlyph() override;
 
     virtual bool SetupCairoFont(DrawTarget* aDrawTarget) override;
 
     /* override Measure to add padding for antialiasing */
     virtual RunMetrics Measure(const gfxTextRun *aTextRun,