tor-browser

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

gfxAndroidPlatform.h (2264B)


      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_ANDROID_H
      7 #define GFX_PLATFORM_ANDROID_H
      8 
      9 #include "gfxPlatform.h"
     10 #include "gfxUserFontSet.h"
     11 #include "nsCOMPtr.h"
     12 #include "nsTArray.h"
     13 #include "MediaCodecsSupport.h"
     14 
     15 class gfxAndroidPlatform final : public gfxPlatform {
     16 public:
     17  gfxAndroidPlatform();
     18  virtual ~gfxAndroidPlatform();
     19 
     20  static gfxAndroidPlatform* GetPlatform() {
     21    return (gfxAndroidPlatform*)gfxPlatform::GetPlatform();
     22  }
     23 
     24  already_AddRefed<gfxASurface> CreateOffscreenSurface(
     25      const IntSize& aSize, gfxImageFormat aFormat) override;
     26 
     27  gfxImageFormat GetOffscreenFormat() override { return mOffscreenFormat; }
     28 
     29  // platform implementations of font functions
     30  bool CreatePlatformFontList() override;
     31 
     32  void ReadSystemFontList(mozilla::dom::SystemFontList*) override;
     33 
     34  void GetCommonFallbackFonts(uint32_t aCh, Script aRunScript,
     35                              FontPresentation aPresentation,
     36                              nsTArray<const char*>& aFontList) override;
     37 
     38  bool FontHintingEnabled() override;
     39  bool RequiresLinearZoom() override;
     40 
     41  already_AddRefed<mozilla::gfx::VsyncSource> CreateGlobalHardwareVsyncSource()
     42      override;
     43 
     44  static bool CheckVariationFontSupport() { return true; }
     45 
     46  // From Android 12, Font API doesn't read XML files only. To handle updated
     47  // font, initializing font API causes that it analyzes all font files. So we
     48  // have to call this API at start up on another thread to initialize it.
     49  static void InitializeFontAPI();
     50  static void WaitForInitializeFontAPI();
     51 
     52  static bool IsFontAPIDisabled(bool aDontCheckPref = false);
     53 
     54  static bool IsHwCodecSupported(mozilla::media::MediaCodec aCodec,
     55                                 bool aEncoder);
     56 
     57 protected:
     58  void InitAcceleration() override;
     59 
     60  bool AccelerateLayersByDefault() override { return true; }
     61 
     62 private:
     63  gfxImageFormat mOffscreenFormat;
     64 
     65  static PRThread* sFontAPIInitializeThread;
     66  static nsCString sManufacturer;
     67 };
     68 
     69 #endif /* GFX_PLATFORM_ANDROID_H */