Bug 1338426 - gfx/2d/2D.h should not include gfxPrefs.h. - r=bas
MozReview-Commit-ID: 8Ep8ZrqFtxO
--- 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