summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorJob Bautista <jobbautista9@aol.com>2023-04-05 18:40:25 +0800
committerJob Bautista <jobbautista9@protonmail.com>2023-04-05 21:22:17 +0800
commit4af61863f3da2e6f8951854e4343e6898e1e86f8 (patch)
tree59e88725715ce9a8908abdc107a041c34e0bb457 /gfx
parentb494419e915d461e2990facfdbf7c91b98da2543 (diff)
downloaduxp-4af61863f3da2e6f8951854e4343e6898e1e86f8.tar.gz
Issue #2191 - Get rid of gfxFontconfigUtils.h since gfxFontconfigFontBase is unnecessary.
Backported from Mozilla bug 1385029.
Diffstat (limited to 'gfx')
-rw-r--r--gfx/thebes/gfxFcPlatformFontList.cpp19
-rw-r--r--gfx/thebes/gfxFcPlatformFontList.h17
-rw-r--r--gfx/thebes/gfxFontconfigUtils.h55
-rw-r--r--gfx/thebes/gfxPlatformGtk.cpp1
-rw-r--r--gfx/thebes/gfxPlatformGtk.h4
5 files changed, 28 insertions, 68 deletions
diff --git a/gfx/thebes/gfxFcPlatformFontList.cpp b/gfx/thebes/gfxFcPlatformFontList.cpp
index 75e8fb76a0..4f5966d948 100644
--- a/gfx/thebes/gfxFcPlatformFontList.cpp
+++ b/gfx/thebes/gfxFcPlatformFontList.cpp
@@ -55,6 +55,20 @@ using namespace mozilla::unicode;
gfxPlatform::GetLog(eGfxLog_cmapdata), \
LogLevel::Debug)
+template <>
+class nsAutoRefTraits<FcFontSet> : public nsPointerRefTraits<FcFontSet>
+{
+public:
+ static void Release(FcFontSet *ptr) { FcFontSetDestroy(ptr); }
+};
+
+template <>
+class nsAutoRefTraits<FcObjectSet> : public nsPointerRefTraits<FcObjectSet>
+{
+public:
+ static void Release(FcObjectSet *ptr) { FcObjectSetDestroy(ptr); }
+};
+
static const FcChar8*
ToFcChar8Ptr(const char* aStr)
{
@@ -1078,8 +1092,9 @@ gfxFontconfigFont::gfxFontconfigFont(cairo_scaled_font_t *aScaledFont,
gfxFloat aAdjustedSize,
gfxFontEntry *aFontEntry,
const gfxFontStyle *aFontStyle,
- bool aNeedsBold) :
- gfxFontconfigFontBase(aScaledFont, aPattern, aFontEntry, aFontStyle)
+ bool aNeedsBold)
+ : gfxFT2FontBase(aScaledFont, aFontEntry, aFontStyle)
+ , mPattern(aPattern)
{
mAdjustedSize = aAdjustedSize;
}
diff --git a/gfx/thebes/gfxFcPlatformFontList.h b/gfx/thebes/gfxFcPlatformFontList.h
index aa8f614a90..dcad65c863 100644
--- a/gfx/thebes/gfxFcPlatformFontList.h
+++ b/gfx/thebes/gfxFcPlatformFontList.h
@@ -11,6 +11,7 @@
#include "gfxFT2FontBase.h"
#include "gfxPlatformFontList.h"
#include "mozilla/mozalloc.h"
+#include "nsAutoRef.h"
#include "nsClassHashtable.h"
#include <fontconfig/fontconfig.h>
@@ -20,13 +21,12 @@
#include <cairo.h>
#include <cairo-ft.h>
-#include "gfxFontconfigUtils.h" // xxx - only for nsAutoRefTraits<FcPattern>, etc.
-
template <>
-class nsAutoRefTraits<FcObjectSet> : public nsPointerRefTraits<FcObjectSet>
+class nsAutoRefTraits<FcPattern> : public nsPointerRefTraits<FcPattern>
{
public:
- static void Release(FcObjectSet *ptr) { FcObjectSetDestroy(ptr); }
+ static void Release(FcPattern *ptr) { FcPatternDestroy(ptr); }
+ static void AddRef(FcPattern *ptr) { FcPatternReference(ptr); }
};
template <>
@@ -205,7 +205,7 @@ protected:
bool mForceScalable;
};
-class gfxFontconfigFont : public gfxFontconfigFontBase {
+class gfxFontconfigFont : public gfxFT2FontBase {
public:
gfxFontconfigFont(cairo_scaled_font_t *aScaledFont,
FcPattern *aPattern,
@@ -214,8 +214,13 @@ public:
const gfxFontStyle *aFontStyle,
bool aNeedsBold);
-protected:
+ virtual FontType GetType() const override { return FONT_TYPE_FONTCONFIG; }
+ virtual FcPattern *GetPattern() const { return mPattern; }
+
+private:
virtual ~gfxFontconfigFont();
+
+ nsCountedRef<FcPattern> mPattern;
};
class nsILanguageAtomService;
diff --git a/gfx/thebes/gfxFontconfigUtils.h b/gfx/thebes/gfxFontconfigUtils.h
deleted file mode 100644
index 3f502c1243..0000000000
--- a/gfx/thebes/gfxFontconfigUtils.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * 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/. */
-
-#ifndef GFX_FONTCONFIG_UTILS_H
-#define GFX_FONTCONFIG_UTILS_H
-
-#include "gfxPlatform.h"
-
-#include "nsAutoRef.h"
-#include "gfxFT2FontBase.h"
-
-#include <fontconfig/fontconfig.h>
-
-
-template <>
-class nsAutoRefTraits<FcPattern> : public nsPointerRefTraits<FcPattern>
-{
-public:
- static void Release(FcPattern *ptr) { FcPatternDestroy(ptr); }
- static void AddRef(FcPattern *ptr) { FcPatternReference(ptr); }
-};
-
-template <>
-class nsAutoRefTraits<FcFontSet> : public nsPointerRefTraits<FcFontSet>
-{
-public:
- static void Release(FcFontSet *ptr) { FcFontSetDestroy(ptr); }
-};
-
-template <>
-class nsAutoRefTraits<FcCharSet> : public nsPointerRefTraits<FcCharSet>
-{
-public:
- static void Release(FcCharSet *ptr) { FcCharSetDestroy(ptr); }
-};
-
-class gfxFontconfigFontBase : public gfxFT2FontBase {
-public:
- gfxFontconfigFontBase(cairo_scaled_font_t *aScaledFont,
- FcPattern *aPattern,
- gfxFontEntry *aFontEntry,
- const gfxFontStyle *aFontStyle)
- : gfxFT2FontBase(aScaledFont, aFontEntry, aFontStyle)
- , mPattern(aPattern) { }
-
- virtual FontType GetType() const override { return FONT_TYPE_FONTCONFIG; }
- virtual FcPattern *GetPattern() const { return mPattern; }
-
-private:
- nsCountedRef<FcPattern> mPattern;
-};
-
-#endif /* GFX_FONTCONFIG_UTILS_H */
diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp
index d8bafac918..476d250273 100644
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -13,7 +13,6 @@
#include "nsUnicodeProperties.h"
#include "gfx2DGlue.h"
#include "gfxFcPlatformFontList.h"
-#include "gfxFontconfigUtils.h"
#include "gfxConfig.h"
#include "gfxContext.h"
#include "gfxUserFontSet.h"
diff --git a/gfx/thebes/gfxPlatformGtk.h b/gfx/thebes/gfxPlatformGtk.h
index cfaca45074..585eeab0ac 100644
--- a/gfx/thebes/gfxPlatformGtk.h
+++ b/gfx/thebes/gfxPlatformGtk.h
@@ -22,8 +22,6 @@ struct _XDisplay;
typedef struct _XDisplay Display;
#endif // MOZ_X11
-class gfxFontconfigUtils;
-
class gfxPlatformGtk : public gfxPlatform {
public:
gfxPlatformGtk();
@@ -141,8 +139,6 @@ public:
#endif // MOZ_X11
protected:
- static gfxFontconfigUtils *sFontconfigUtils;
-
int8_t mMaxGenericSubstitutions;
private: