Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef GFX_PLATFORM_ANDROID_H |
michael@0 | 7 | #define GFX_PLATFORM_ANDROID_H |
michael@0 | 8 | |
michael@0 | 9 | #include "gfxFT2Fonts.h" |
michael@0 | 10 | #include "gfxPlatform.h" |
michael@0 | 11 | #include "gfxUserFontSet.h" |
michael@0 | 12 | #include "nsCOMPtr.h" |
michael@0 | 13 | #include "nsTArray.h" |
michael@0 | 14 | |
michael@0 | 15 | class nsIMemoryReporter; |
michael@0 | 16 | |
michael@0 | 17 | namespace mozilla { |
michael@0 | 18 | namespace dom { |
michael@0 | 19 | class FontListEntry; |
michael@0 | 20 | }; |
michael@0 | 21 | }; |
michael@0 | 22 | using mozilla::dom::FontListEntry; |
michael@0 | 23 | |
michael@0 | 24 | typedef struct FT_LibraryRec_ *FT_Library; |
michael@0 | 25 | |
michael@0 | 26 | class gfxAndroidPlatform : public gfxPlatform { |
michael@0 | 27 | public: |
michael@0 | 28 | gfxAndroidPlatform(); |
michael@0 | 29 | virtual ~gfxAndroidPlatform(); |
michael@0 | 30 | |
michael@0 | 31 | static gfxAndroidPlatform *GetPlatform() { |
michael@0 | 32 | return (gfxAndroidPlatform*) gfxPlatform::GetPlatform(); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | virtual already_AddRefed<gfxASurface> |
michael@0 | 36 | CreateOffscreenSurface(const IntSize& size, |
michael@0 | 37 | gfxContentType contentType); |
michael@0 | 38 | |
michael@0 | 39 | virtual gfxImageFormat GetOffscreenFormat() { return mOffscreenFormat; } |
michael@0 | 40 | |
michael@0 | 41 | mozilla::TemporaryRef<mozilla::gfx::ScaledFont> |
michael@0 | 42 | GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont); |
michael@0 | 43 | |
michael@0 | 44 | // to support IPC font list (sharing between chrome and content) |
michael@0 | 45 | void GetFontList(InfallibleTArray<FontListEntry>* retValue); |
michael@0 | 46 | |
michael@0 | 47 | // platform implementations of font functions |
michael@0 | 48 | virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags); |
michael@0 | 49 | virtual gfxPlatformFontList* CreatePlatformFontList(); |
michael@0 | 50 | virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry, |
michael@0 | 51 | const uint8_t *aFontData, uint32_t aLength); |
michael@0 | 52 | virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry, |
michael@0 | 53 | const nsAString& aFontName); |
michael@0 | 54 | |
michael@0 | 55 | virtual void GetCommonFallbackFonts(const uint32_t aCh, |
michael@0 | 56 | int32_t aRunScript, |
michael@0 | 57 | nsTArray<const char*>& aFontList); |
michael@0 | 58 | |
michael@0 | 59 | virtual nsresult GetFontList(nsIAtom *aLangGroup, |
michael@0 | 60 | const nsACString& aGenericFamily, |
michael@0 | 61 | nsTArray<nsString>& aListOfFonts); |
michael@0 | 62 | |
michael@0 | 63 | virtual nsresult UpdateFontList(); |
michael@0 | 64 | |
michael@0 | 65 | virtual nsresult ResolveFontName(const nsAString& aFontName, |
michael@0 | 66 | FontResolverCallback aCallback, |
michael@0 | 67 | void *aClosure, bool& aAborted); |
michael@0 | 68 | |
michael@0 | 69 | virtual nsresult GetStandardFamilyName(const nsAString& aFontName, |
michael@0 | 70 | nsAString& aFamilyName); |
michael@0 | 71 | |
michael@0 | 72 | virtual gfxFontGroup *CreateFontGroup(const nsAString &aFamilies, |
michael@0 | 73 | const gfxFontStyle *aStyle, |
michael@0 | 74 | gfxUserFontSet* aUserFontSet); |
michael@0 | 75 | |
michael@0 | 76 | virtual bool FontHintingEnabled() MOZ_OVERRIDE; |
michael@0 | 77 | virtual bool RequiresLinearZoom() MOZ_OVERRIDE; |
michael@0 | 78 | |
michael@0 | 79 | FT_Library GetFTLibrary(); |
michael@0 | 80 | |
michael@0 | 81 | virtual int GetScreenDepth() const; |
michael@0 | 82 | |
michael@0 | 83 | virtual bool UseAcceleratedSkiaCanvas() MOZ_OVERRIDE; |
michael@0 | 84 | |
michael@0 | 85 | #ifdef MOZ_WIDGET_GONK |
michael@0 | 86 | virtual bool IsInGonkEmulator() const { return mIsInGonkEmulator; } |
michael@0 | 87 | #endif |
michael@0 | 88 | |
michael@0 | 89 | private: |
michael@0 | 90 | int mScreenDepth; |
michael@0 | 91 | gfxImageFormat mOffscreenFormat; |
michael@0 | 92 | |
michael@0 | 93 | #ifdef MOZ_WIDGET_GONK |
michael@0 | 94 | bool mIsInGonkEmulator; |
michael@0 | 95 | #endif |
michael@0 | 96 | }; |
michael@0 | 97 | |
michael@0 | 98 | #endif /* GFX_PLATFORM_ANDROID_H */ |
michael@0 | 99 |