Bug 1377257 part 2 - Use cairo_scaled_font_get_hint_metrics instead of cairo_scaled_font_get_font_options to avoid malloc/free associated with cairo_font_options_create/destroy. r=jfkthame
authorMats Palmgren <mats@mozilla.com>
Mon, 14 Aug 2017 12:35:34 +0100
changeset 374532 53118a4b39b1b09ac796aa406ea8f4b02ce55a0e
parent 374531 bca0e256c3cf97e142c17a43b0129a08b90acad0
child 374533 216dc8344ce047d521c5431e212d942230337f13
push id93691
push userjkew@mozilla.com
push dateMon, 14 Aug 2017 12:06:32 +0000
treeherdermozilla-inbound@53118a4b39b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1377257
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 1377257 part 2 - Use cairo_scaled_font_get_hint_metrics instead of cairo_scaled_font_get_font_options to avoid malloc/free associated with cairo_font_options_create/destroy. r=jfkthame
gfx/thebes/gfxFont.cpp
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -837,21 +837,18 @@ gfxFont::GetRoundOffsetsToPixels(DrawTar
   NS_ASSERTION(scaled_font, "null cairo scaled font should never be returned "
     "by cairo_get_scaled_font");
   if (!scaled_font) {
     result |= RoundingFlags::kRoundX; // default to the same as the fallback path below
     return result;
   }
 
   // Sometimes hint metrics gets set for us, most notably for printing.
-  cairo_font_options_t *font_options = cairo_font_options_create();
-  cairo_scaled_font_get_font_options(scaled_font, font_options);
   cairo_hint_metrics_t hint_metrics =
-    cairo_font_options_get_hint_metrics(font_options);
-  cairo_font_options_destroy(font_options);
+    cairo_scaled_font_get_hint_metrics(scaled_font);
 
   switch (hint_metrics) {
   case CAIRO_HINT_METRICS_OFF:
     result &= ~RoundingFlags::kRoundY;
     return result;
   case CAIRO_HINT_METRICS_DEFAULT:
     // Here we mimic what cairo surface/font backends do.  Printing
     // surfaces have already been handled by hint_metrics.  The