Bug 1919083 - [ci] Enable os-integration variant for more suites, r=jmaher
[gecko.git] / gfx / thebes / gfxPlatformMac.h
blob00ab2c1ca86423d2dd3e5b47fb4a97f1742cc21f
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef GFX_PLATFORM_MAC_H
7 #define GFX_PLATFORM_MAC_H
9 #include "nsTArrayForwardDeclare.h"
10 #include "gfxPlatform.h"
11 #include "mozilla/LookAndFeel.h"
13 namespace mozilla {
14 namespace gfx {
15 class DrawTarget;
16 class VsyncSource;
17 } // namespace gfx
18 } // namespace mozilla
20 class gfxPlatformMac : public gfxPlatform {
21 public:
22 gfxPlatformMac();
23 virtual ~gfxPlatformMac();
25 // Call early in startup to register the macOS supplemental language fonts
26 // so that they're usable by the browser. This is intended to be called as
27 // early as possible, before most services etc are initialized; it starts
28 // a separate thread to register the fonts, because this is quite slow.
29 static void RegisterSupplementalFonts();
31 // Call from the main thread at the point where we need to start using the
32 // font list; this will wait (if necessary) for the registration thread to
33 // finish.
34 static void WaitForFontRegistration();
36 static gfxPlatformMac* GetPlatform() {
37 return (gfxPlatformMac*)gfxPlatform::GetPlatform();
40 already_AddRefed<gfxASurface> CreateOffscreenSurface(
41 const IntSize& aSize, gfxImageFormat aFormat) override;
43 bool CreatePlatformFontList() override;
45 void ReadSystemFontList(mozilla::dom::SystemFontList* aFontList) override;
47 void GetCommonFallbackFonts(uint32_t aCh, Script aRunScript,
48 eFontPresentation aPresentation,
49 nsTArray<const char*>& aFontList) override;
51 // lookup the system font for a particular system font type and set
52 // the name and style characteristics
53 static void LookupSystemFont(mozilla::LookAndFeel::FontID aSystemFontID,
54 nsACString& aSystemFontName,
55 gfxFontStyle& aFontStyle);
57 bool SupportsApzWheelInput() const override { return true; }
59 bool RespectsFontStyleSmoothing() const override {
60 // gfxMacFont respects the font smoothing hint.
61 return true;
64 bool RequiresAcceleratedGLContextForCompositorOGL() const override {
65 // On OS X in a VM, unaccelerated CompositorOGL shows black flashes, so we
66 // require accelerated GL for CompositorOGL but allow unaccelerated GL for
67 // BasicCompositor.
68 return true;
71 already_AddRefed<mozilla::gfx::VsyncSource> CreateGlobalHardwareVsyncSource()
72 override;
74 // lower threshold on font anti-aliasing
75 uint32_t GetAntiAliasingThreshold() { return mFontAntiAliasingThreshold; }
77 static bool CheckVariationFontSupport();
79 protected:
80 bool AccelerateLayersByDefault() override;
82 BackendPrefsData GetBackendPrefs() const override;
84 void InitPlatformGPUProcessPrefs() override;
86 private:
87 nsTArray<uint8_t> GetPlatformCMSOutputProfileData() override;
89 // read in the pref value for the lower threshold on font anti-aliasing
90 static uint32_t ReadAntiAliasingThreshold();
92 static void FontRegistrationCallback(void* aUnused);
94 uint32_t mFontAntiAliasingThreshold;
96 static PRThread* sFontRegistrationThread;
99 #endif /* GFX_PLATFORM_MAC_H */