michael@0: /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef GFX_PLATFORM_ANDROID_H michael@0: #define GFX_PLATFORM_ANDROID_H michael@0: michael@0: #include "gfxFT2Fonts.h" michael@0: #include "gfxPlatform.h" michael@0: #include "gfxUserFontSet.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsTArray.h" michael@0: michael@0: class nsIMemoryReporter; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: class FontListEntry; michael@0: }; michael@0: }; michael@0: using mozilla::dom::FontListEntry; michael@0: michael@0: typedef struct FT_LibraryRec_ *FT_Library; michael@0: michael@0: class gfxAndroidPlatform : public gfxPlatform { michael@0: public: michael@0: gfxAndroidPlatform(); michael@0: virtual ~gfxAndroidPlatform(); michael@0: michael@0: static gfxAndroidPlatform *GetPlatform() { michael@0: return (gfxAndroidPlatform*) gfxPlatform::GetPlatform(); michael@0: } michael@0: michael@0: virtual already_AddRefed michael@0: CreateOffscreenSurface(const IntSize& size, michael@0: gfxContentType contentType); michael@0: michael@0: virtual gfxImageFormat GetOffscreenFormat() { return mOffscreenFormat; } michael@0: michael@0: mozilla::TemporaryRef michael@0: GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont); michael@0: michael@0: // to support IPC font list (sharing between chrome and content) michael@0: void GetFontList(InfallibleTArray* retValue); michael@0: michael@0: // platform implementations of font functions michael@0: virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags); michael@0: virtual gfxPlatformFontList* CreatePlatformFontList(); michael@0: virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry, michael@0: const uint8_t *aFontData, uint32_t aLength); michael@0: virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry, michael@0: const nsAString& aFontName); michael@0: michael@0: virtual void GetCommonFallbackFonts(const uint32_t aCh, michael@0: int32_t aRunScript, michael@0: nsTArray& aFontList); michael@0: michael@0: virtual nsresult GetFontList(nsIAtom *aLangGroup, michael@0: const nsACString& aGenericFamily, michael@0: nsTArray& aListOfFonts); michael@0: michael@0: virtual nsresult UpdateFontList(); michael@0: michael@0: virtual nsresult ResolveFontName(const nsAString& aFontName, michael@0: FontResolverCallback aCallback, michael@0: void *aClosure, bool& aAborted); michael@0: michael@0: virtual nsresult GetStandardFamilyName(const nsAString& aFontName, michael@0: nsAString& aFamilyName); michael@0: michael@0: virtual gfxFontGroup *CreateFontGroup(const nsAString &aFamilies, michael@0: const gfxFontStyle *aStyle, michael@0: gfxUserFontSet* aUserFontSet); michael@0: michael@0: virtual bool FontHintingEnabled() MOZ_OVERRIDE; michael@0: virtual bool RequiresLinearZoom() MOZ_OVERRIDE; michael@0: michael@0: FT_Library GetFTLibrary(); michael@0: michael@0: virtual int GetScreenDepth() const; michael@0: michael@0: virtual bool UseAcceleratedSkiaCanvas() MOZ_OVERRIDE; michael@0: michael@0: #ifdef MOZ_WIDGET_GONK michael@0: virtual bool IsInGonkEmulator() const { return mIsInGonkEmulator; } michael@0: #endif michael@0: michael@0: private: michael@0: int mScreenDepth; michael@0: gfxImageFormat mOffscreenFormat; michael@0: michael@0: #ifdef MOZ_WIDGET_GONK michael@0: bool mIsInGonkEmulator; michael@0: #endif michael@0: }; michael@0: michael@0: #endif /* GFX_PLATFORM_ANDROID_H */ michael@0: