summaryrefslogtreecommitdiff
path: root/gfx/2d
diff options
context:
space:
mode:
authorBrian Smith <brian@dbsoft.org>2022-04-26 11:07:23 -0500
committerBrian Smith <brian@dbsoft.org>2022-04-26 11:07:23 -0500
commit9e2a89c71ddf67975da35eb100673f6b5546f292 (patch)
treeca7b972015f5ad2388d416fa0ec8f506cc9fb8d6 /gfx/2d
parent68d1c14bdf79d1c536ae05a4ce33fd9601c277eb (diff)
downloaduxp-9e2a89c71ddf67975da35eb100673f6b5546f292.tar.gz
Issue #1829 - Revert "Issue #1751 -- Remove XP_DARWIN"
This reverts commit 3d671e4275c73a1484c72713304c6e04ec4ffc7c.
Diffstat (limited to 'gfx/2d')
-rw-r--r--gfx/2d/2D.h5
-rw-r--r--gfx/2d/Factory.cpp21
2 files changed, 26 insertions, 0 deletions
diff --git a/gfx/2d/2D.h b/gfx/2d/2D.h
index 89de5630c6..e2020dc9e6 100644
--- a/gfx/2d/2D.h
+++ b/gfx/2d/2D.h
@@ -1481,6 +1481,11 @@ public:
static already_AddRefed<DrawTarget> CreateDrawTargetWithSkCanvas(SkCanvas* aCanvas);
#endif
+#ifdef XP_DARWIN
+ static already_AddRefed<GlyphRenderingOptions>
+ CreateCGGlyphRenderingOptions(const Color &aFontSmoothingBackgroundColor);
+#endif
+
#ifdef WIN32
static already_AddRefed<DrawTarget> CreateDrawTargetForD3D11Texture(ID3D11Texture2D *aTexture, SurfaceFormat aFormat);
diff --git a/gfx/2d/Factory.cpp b/gfx/2d/Factory.cpp
index 22352b20c6..5cd5d14eab 100644
--- a/gfx/2d/Factory.cpp
+++ b/gfx/2d/Factory.cpp
@@ -25,6 +25,11 @@
#include "NativeFontResourceGDI.h"
#endif
+#ifdef XP_DARWIN
+#include "ScaledFontMac.h"
+#include "NativeFontResourceMac.h"
+#endif
+
#ifdef MOZ_WIDGET_GTK
#include "ScaledFontFontconfig.h"
#endif
@@ -476,6 +481,12 @@ Factory::CreateScaledFontForNativeFont(const NativeFont &aNativeFont, Float aSiz
}
#endif
#endif
+#ifdef XP_DARWIN
+ case NativeFontType::MAC_FONT_FACE:
+ {
+ return MakeAndAddRef<ScaledFontMac>(static_cast<CGFontRef>(aNativeFont.mFont), aSize);
+ }
+#endif
#if defined(USE_CAIRO) || defined(USE_SKIA_FREETYPE)
case NativeFontType::CAIRO_FONT_FACE:
{
@@ -513,6 +524,8 @@ Factory::CreateNativeFontResource(uint8_t *aData, uint32_t aSize,
return NativeFontResourceGDI::Create(aData, aSize,
/* aNeedsCairo = */ true);
}
+#elif XP_DARWIN
+ return NativeFontResourceMac::Create(aData, aSize);
#else
gfxWarning() << "Unable to create cairo scaled font from truetype data";
return nullptr;
@@ -789,6 +802,14 @@ Factory::CreateWrappingDataSourceSurface(uint8_t *aData,
return newSurf.forget();
}
+#ifdef XP_DARWIN
+already_AddRefed<GlyphRenderingOptions>
+Factory::CreateCGGlyphRenderingOptions(const Color &aFontSmoothingBackgroundColor)
+{
+ return MakeAndAddRef<GlyphRenderingOptionsCG>(aFontSmoothingBackgroundColor);
+}
+#endif
+
already_AddRefed<DataSourceSurface>
Factory::CreateDataSourceSurface(const IntSize &aSize,
SurfaceFormat aFormat,