Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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/. */
6 #ifndef GFX_PLATFORM_ANDROID_H
7 #define GFX_PLATFORM_ANDROID_H
9 #include "gfxFT2Fonts.h"
10 #include "gfxPlatform.h"
11 #include "gfxUserFontSet.h"
12 #include "nsCOMPtr.h"
13 #include "nsTArray.h"
15 class nsIMemoryReporter;
17 namespace mozilla {
18 namespace dom {
19 class FontListEntry;
20 };
21 };
22 using mozilla::dom::FontListEntry;
24 typedef struct FT_LibraryRec_ *FT_Library;
26 class gfxAndroidPlatform : public gfxPlatform {
27 public:
28 gfxAndroidPlatform();
29 virtual ~gfxAndroidPlatform();
31 static gfxAndroidPlatform *GetPlatform() {
32 return (gfxAndroidPlatform*) gfxPlatform::GetPlatform();
33 }
35 virtual already_AddRefed<gfxASurface>
36 CreateOffscreenSurface(const IntSize& size,
37 gfxContentType contentType);
39 virtual gfxImageFormat GetOffscreenFormat() { return mOffscreenFormat; }
41 mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
42 GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont);
44 // to support IPC font list (sharing between chrome and content)
45 void GetFontList(InfallibleTArray<FontListEntry>* retValue);
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);
55 virtual void GetCommonFallbackFonts(const uint32_t aCh,
56 int32_t aRunScript,
57 nsTArray<const char*>& aFontList);
59 virtual nsresult GetFontList(nsIAtom *aLangGroup,
60 const nsACString& aGenericFamily,
61 nsTArray<nsString>& aListOfFonts);
63 virtual nsresult UpdateFontList();
65 virtual nsresult ResolveFontName(const nsAString& aFontName,
66 FontResolverCallback aCallback,
67 void *aClosure, bool& aAborted);
69 virtual nsresult GetStandardFamilyName(const nsAString& aFontName,
70 nsAString& aFamilyName);
72 virtual gfxFontGroup *CreateFontGroup(const nsAString &aFamilies,
73 const gfxFontStyle *aStyle,
74 gfxUserFontSet* aUserFontSet);
76 virtual bool FontHintingEnabled() MOZ_OVERRIDE;
77 virtual bool RequiresLinearZoom() MOZ_OVERRIDE;
79 FT_Library GetFTLibrary();
81 virtual int GetScreenDepth() const;
83 virtual bool UseAcceleratedSkiaCanvas() MOZ_OVERRIDE;
85 #ifdef MOZ_WIDGET_GONK
86 virtual bool IsInGonkEmulator() const { return mIsInGonkEmulator; }
87 #endif
89 private:
90 int mScreenDepth;
91 gfxImageFormat mOffscreenFormat;
93 #ifdef MOZ_WIDGET_GONK
94 bool mIsInGonkEmulator;
95 #endif
96 };
98 #endif /* GFX_PLATFORM_ANDROID_H */