Bug 1880704 - Crop more PDF rendering and wait differently for rendering r=mboldan
[gecko.git] / gfx / thebes / gfxPlatformGtk.h
blobc28a2249259ace2df251ebacfa5f6957d3e9918c
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_GTK_H
7 #define GFX_PLATFORM_GTK_H
9 #include "gfxPlatform.h"
10 #include "nsAutoRef.h"
11 #include "nsTArray.h"
12 #include "mozilla/gfx/gfxVars.h"
14 #ifdef MOZ_X11
15 struct _XDisplay;
16 typedef struct _XDisplay Display;
17 #endif // MOZ_X11
19 class gfxPlatformGtk final : public gfxPlatform {
20 friend class gfxPlatform;
22 public:
23 gfxPlatformGtk();
24 virtual ~gfxPlatformGtk();
26 static gfxPlatformGtk* GetPlatform() {
27 return (gfxPlatformGtk*)gfxPlatform::GetPlatform();
30 void ReadSystemFontList(mozilla::dom::SystemFontList* retValue) override;
32 already_AddRefed<gfxASurface> CreateOffscreenSurface(
33 const IntSize& aSize, gfxImageFormat aFormat) override;
35 nsresult GetFontList(nsAtom* aLangGroup, const nsACString& aGenericFamily,
36 nsTArray<nsString>& aListOfFonts) override;
38 void GetCommonFallbackFonts(uint32_t aCh, Script aRunScript,
39 eFontPresentation aPresentation,
40 nsTArray<const char*>& aFontList) override;
42 bool CreatePlatformFontList() override;
44 static int32_t GetFontScaleDPI();
45 static double GetFontScaleFactor();
47 gfxImageFormat GetOffscreenFormat() override;
49 bool SupportsApzWheelInput() const override { return true; }
51 void FontsPrefsChanged(const char* aPref) override;
53 bool SupportsPluginDirectBitmapDrawing() override { return true; }
55 bool AccelerateLayersByDefault() override;
57 already_AddRefed<mozilla::gfx::VsyncSource> CreateGlobalHardwareVsyncSource()
58 override;
60 bool IsX11Display() { return mIsX11Display; }
61 bool IsWaylandDisplay() override {
62 return !mIsX11Display && !gfxPlatform::IsHeadless();
65 static bool CheckVariationFontSupport();
67 protected:
68 void InitAcceleration() override;
69 void InitX11EGLConfig();
70 void InitDmabufConfig();
71 bool InitVAAPIConfig(bool aForceEnabledByUser);
72 void InitPlatformGPUProcessPrefs() override;
73 void InitWebRenderConfig() override;
74 void BuildContentDeviceData(mozilla::gfx::ContentDeviceData* aOut) override;
76 private:
77 nsTArray<uint8_t> GetPlatformCMSOutputProfileData() override;
79 bool mIsX11Display;
82 // Wrapper for third party code (WebRTC for instance) where
83 // gfxVars can't be included.
84 namespace mozilla::gfx {
85 bool IsDMABufEnabled();
88 #endif /* GFX_PLATFORM_GTK_H */