tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

gfxPlatformGtk.h (2548B)


      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/. */
      5 
      6 #ifndef GFX_PLATFORM_GTK_H
      7 #define GFX_PLATFORM_GTK_H
      8 
      9 #include "gfxPlatform.h"
     10 #include "nsAutoRef.h"
     11 #include "nsTArray.h"
     12 #include "mozilla/gfx/gfxVars.h"
     13 
     14 #ifdef MOZ_X11
     15 struct _XDisplay;
     16 typedef struct _XDisplay Display;
     17 #endif  // MOZ_X11
     18 
     19 class gfxPlatformGtk final : public gfxPlatform {
     20  friend class gfxPlatform;
     21 
     22 public:
     23  gfxPlatformGtk();
     24  virtual ~gfxPlatformGtk();
     25 
     26  static gfxPlatformGtk* GetPlatform() {
     27    return (gfxPlatformGtk*)gfxPlatform::GetPlatform();
     28  }
     29 
     30  void ReadSystemFontList(mozilla::dom::SystemFontList* retValue) override;
     31 
     32  already_AddRefed<gfxASurface> CreateOffscreenSurface(
     33      const IntSize& aSize, gfxImageFormat aFormat) override;
     34 
     35  nsresult GetFontList(nsAtom* aLangGroup, const nsACString& aGenericFamily,
     36                       nsTArray<nsString>& aListOfFonts) override;
     37 
     38  void GetCommonFallbackFonts(uint32_t aCh, Script aRunScript,
     39                              FontPresentation aPresentation,
     40                              nsTArray<const char*>& aFontList) override;
     41 
     42  bool CreatePlatformFontList() override;
     43 
     44  gfxImageFormat GetOffscreenFormat() override;
     45 
     46  bool SupportsApzWheelInput() const override { return true; }
     47 
     48  void FontsPrefsChanged(const char* aPref) override;
     49 
     50  bool SupportsPluginDirectBitmapDrawing() override { return true; }
     51 
     52  bool AccelerateLayersByDefault() override;
     53 
     54  already_AddRefed<mozilla::gfx::VsyncSource> CreateGlobalHardwareVsyncSource()
     55      override;
     56 
     57  bool IsX11Display() { return mIsX11Display; }
     58  bool IsWaylandDisplay() override {
     59    return !mIsX11Display && !gfxPlatform::IsHeadless();
     60  }
     61 
     62  static bool CheckVariationFontSupport();
     63 
     64 protected:
     65  void InitAcceleration() override;
     66  void InitX11EGLConfig();
     67  void InitDmabufConfig();
     68  void InitPlatformHardwareVideoConfig() override;
     69  void InitPlatformGPUProcessPrefs() override;
     70  void InitWebRenderConfig() override;
     71  void InitMesaThreading();
     72  void BuildContentDeviceData(mozilla::gfx::ContentDeviceData* aOut) override;
     73 
     74 private:
     75  nsTArray<uint8_t> GetPlatformCMSOutputProfileData() override;
     76 
     77  bool mIsX11Display;
     78 };
     79 
     80 // Wrapper for third party code (WebRTC for instance) where
     81 // gfxVars can't be included.
     82 namespace mozilla::gfx {
     83 bool IsDMABufEnabled();
     84 }
     85 
     86 #endif /* GFX_PLATFORM_GTK_H */