Bug 1338426 - gfx/2d/2D.h should not include gfxPrefs.h. - r=bas draft
authorJeff Gilbert <jgilbert@mozilla.com>
Thu, 09 Feb 2017 20:42:14 -0800
changeset 481609 b40ef48be4e96818fe7edf74b8f52c901d8162a2
parent 479455 12c02bf624c48903b155428f7c8a419ba7a333a6
child 545244 348ff925389edda5a7a1e066fc19046d9b7158aa
push id44870
push userbmo:jgilbert@mozilla.com
push dateFri, 10 Feb 2017 04:42:46 +0000
reviewersbas
bugs1338426
milestone54.0a1
Bug 1338426 - gfx/2d/2D.h should not include gfxPrefs.h. - r=bas MozReview-Commit-ID: 8Ep8ZrqFtxO
gfx/2d/2D.h
gfx/2d/ScaledFontBase.cpp
--- a/gfx/2d/2D.h
+++ b/gfx/2d/2D.h
@@ -26,18 +26,16 @@
 #include "mozilla/RefPtr.h"
 
 #include "mozilla/DebugOnly.h"
 
 #ifdef MOZ_ENABLE_FREETYPE
 #include <string>
 #endif
 
-#include "gfxPrefs.h"
-
 struct _cairo_surface;
 typedef _cairo_surface cairo_surface_t;
 
 struct _cairo_scaled_font;
 typedef _cairo_scaled_font cairo_scaled_font_t;
 
 struct _FcPattern;
 typedef _FcPattern FcPattern;
@@ -714,23 +712,17 @@ public:
 
   typedef void (*FontFileDataOutput)(const uint8_t *aData, uint32_t aLength, uint32_t aIndex, Float aGlyphSize,
                                      uint32_t aVariationCount, const VariationSetting* aVariations,
                                      void *aBaton);
   typedef void (*FontInstanceDataOutput)(const uint8_t* aData, uint32_t aLength, void* aBaton);
   typedef void (*FontDescriptorOutput)(const uint8_t* aData, uint32_t aLength, Float aFontSize, void* aBaton);
 
   virtual FontType GetType() const = 0;
-  virtual AntialiasMode GetDefaultAAMode() {
-    if (gfxPrefs::DisableAllTextAA()) {
-      return AntialiasMode::NONE;
-    }
-
-    return AntialiasMode::DEFAULT;
-  }
+  virtual AntialiasMode GetDefaultAAMode();
 
   /** This allows getting a path that describes the outline of a set of glyphs.
    * A target is passed in so that the guarantee is made the returned path
    * can be used with any DrawTarget that has the same backend as the one
    * passed in.
    */
   virtual already_AddRefed<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget) = 0;
 
--- a/gfx/2d/ScaledFontBase.cpp
+++ b/gfx/2d/ScaledFontBase.cpp
@@ -1,15 +1,17 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ScaledFontBase.h"
 
+#include "gfxPrefs.h"
+
 #ifdef USE_SKIA
 #include "PathSkia.h"
 #include "skia/include/core/SkPaint.h"
 #endif
 
 #ifdef USE_CAIRO
 #include "PathCairo.h"
 #include "DrawTargetCairo.h"
@@ -19,16 +21,26 @@
 #include <vector>
 #include <cmath>
 
 using namespace std;
 
 namespace mozilla {
 namespace gfx {
 
+AntialiasMode
+ScaledFont::GetDefaultAAMode()
+{
+  if (gfxPrefs::DisableAllTextAA()) {
+    return AntialiasMode::NONE;
+  }
+
+  return AntialiasMode::DEFAULT;
+}
+
 ScaledFontBase::~ScaledFontBase()
 {
 #ifdef USE_SKIA
   SkSafeUnref(mTypeface);
 #endif
 #ifdef USE_CAIRO_SCALED_FONT
   cairo_scaled_font_destroy(mScaledFont);
 #endif
@@ -248,17 +260,17 @@ ScaledFontBase::GetGlyphDesignMetrics(co
 #ifdef USE_CAIRO_SCALED_FONT
 void
 ScaledFontBase::SetCairoScaledFont(cairo_scaled_font_t* font)
 {
   MOZ_ASSERT(!mScaledFont);
 
   if (font == mScaledFont)
     return;
- 
+
   if (mScaledFont)
     cairo_scaled_font_destroy(mScaledFont);
 
   mScaledFont = font;
   cairo_scaled_font_reference(mScaledFont);
 }
 #endif