|
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
|
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 "gfxFT2Fonts.h" |
|
10 #include "gfxPlatform.h" |
|
11 #include "gfxUserFontSet.h" |
|
12 #include "nsCOMPtr.h" |
|
13 #include "nsTArray.h" |
|
14 |
|
15 class nsIMemoryReporter; |
|
16 |
|
17 namespace mozilla { |
|
18 namespace dom { |
|
19 class FontListEntry; |
|
20 }; |
|
21 }; |
|
22 using mozilla::dom::FontListEntry; |
|
23 |
|
24 typedef struct FT_LibraryRec_ *FT_Library; |
|
25 |
|
26 class gfxAndroidPlatform : public gfxPlatform { |
|
27 public: |
|
28 gfxAndroidPlatform(); |
|
29 virtual ~gfxAndroidPlatform(); |
|
30 |
|
31 static gfxAndroidPlatform *GetPlatform() { |
|
32 return (gfxAndroidPlatform*) gfxPlatform::GetPlatform(); |
|
33 } |
|
34 |
|
35 virtual already_AddRefed<gfxASurface> |
|
36 CreateOffscreenSurface(const IntSize& size, |
|
37 gfxContentType contentType); |
|
38 |
|
39 virtual gfxImageFormat GetOffscreenFormat() { return mOffscreenFormat; } |
|
40 |
|
41 mozilla::TemporaryRef<mozilla::gfx::ScaledFont> |
|
42 GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont); |
|
43 |
|
44 // to support IPC font list (sharing between chrome and content) |
|
45 void GetFontList(InfallibleTArray<FontListEntry>* retValue); |
|
46 |
|
47 // platform implementations of font functions |
|
48 virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags); |
|
49 virtual gfxPlatformFontList* CreatePlatformFontList(); |
|
50 virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry, |
|
51 const uint8_t *aFontData, uint32_t aLength); |
|
52 virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry, |
|
53 const nsAString& aFontName); |
|
54 |
|
55 virtual void GetCommonFallbackFonts(const uint32_t aCh, |
|
56 int32_t aRunScript, |
|
57 nsTArray<const char*>& aFontList); |
|
58 |
|
59 virtual nsresult GetFontList(nsIAtom *aLangGroup, |
|
60 const nsACString& aGenericFamily, |
|
61 nsTArray<nsString>& aListOfFonts); |
|
62 |
|
63 virtual nsresult UpdateFontList(); |
|
64 |
|
65 virtual nsresult ResolveFontName(const nsAString& aFontName, |
|
66 FontResolverCallback aCallback, |
|
67 void *aClosure, bool& aAborted); |
|
68 |
|
69 virtual nsresult GetStandardFamilyName(const nsAString& aFontName, |
|
70 nsAString& aFamilyName); |
|
71 |
|
72 virtual gfxFontGroup *CreateFontGroup(const nsAString &aFamilies, |
|
73 const gfxFontStyle *aStyle, |
|
74 gfxUserFontSet* aUserFontSet); |
|
75 |
|
76 virtual bool FontHintingEnabled() MOZ_OVERRIDE; |
|
77 virtual bool RequiresLinearZoom() MOZ_OVERRIDE; |
|
78 |
|
79 FT_Library GetFTLibrary(); |
|
80 |
|
81 virtual int GetScreenDepth() const; |
|
82 |
|
83 virtual bool UseAcceleratedSkiaCanvas() MOZ_OVERRIDE; |
|
84 |
|
85 #ifdef MOZ_WIDGET_GONK |
|
86 virtual bool IsInGonkEmulator() const { return mIsInGonkEmulator; } |
|
87 #endif |
|
88 |
|
89 private: |
|
90 int mScreenDepth; |
|
91 gfxImageFormat mOffscreenFormat; |
|
92 |
|
93 #ifdef MOZ_WIDGET_GONK |
|
94 bool mIsInGonkEmulator; |
|
95 #endif |
|
96 }; |
|
97 |
|
98 #endif /* GFX_PLATFORM_ANDROID_H */ |
|
99 |