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 14 class gfxAndroidPlatform final : public gfxPlatform { 15 public: 16 gfxAndroidPlatform(); 17 virtual ~gfxAndroidPlatform(); 18 GetPlatform()19 static gfxAndroidPlatform* GetPlatform() { 20 return (gfxAndroidPlatform*)gfxPlatform::GetPlatform(); 21 } 22 23 already_AddRefed<gfxASurface> CreateOffscreenSurface( 24 const IntSize& aSize, gfxImageFormat aFormat) override; 25 GetOffscreenFormat()26 gfxImageFormat GetOffscreenFormat() override { return mOffscreenFormat; } 27 28 // platform implementations of font functions 29 bool CreatePlatformFontList() override; 30 31 void ReadSystemFontList(mozilla::dom::SystemFontList*) override; 32 33 void GetCommonFallbackFonts(uint32_t aCh, Script aRunScript, 34 eFontPresentation aPresentation, 35 nsTArray<const char*>& aFontList) override; 36 37 bool FontHintingEnabled() override; 38 bool RequiresLinearZoom() override; 39 40 already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() 41 override; 42 43 protected: 44 void InitAcceleration() override; 45 AccelerateLayersByDefault()46 bool AccelerateLayersByDefault() override { return true; } 47 CheckVariationFontSupport()48 bool CheckVariationFontSupport() override { 49 // We build with in-tree FreeType, so we know it is a new enough 50 // version to support variations. 51 return true; 52 } 53 54 private: 55 gfxImageFormat mOffscreenFormat; 56 }; 57 58 #endif /* GFX_PLATFORM_ANDROID_H */ 59