1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/thebes/gfxAndroidPlatform.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,99 @@ 1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef GFX_PLATFORM_ANDROID_H 1.10 +#define GFX_PLATFORM_ANDROID_H 1.11 + 1.12 +#include "gfxFT2Fonts.h" 1.13 +#include "gfxPlatform.h" 1.14 +#include "gfxUserFontSet.h" 1.15 +#include "nsCOMPtr.h" 1.16 +#include "nsTArray.h" 1.17 + 1.18 +class nsIMemoryReporter; 1.19 + 1.20 +namespace mozilla { 1.21 + namespace dom { 1.22 + class FontListEntry; 1.23 + }; 1.24 +}; 1.25 +using mozilla::dom::FontListEntry; 1.26 + 1.27 +typedef struct FT_LibraryRec_ *FT_Library; 1.28 + 1.29 +class gfxAndroidPlatform : public gfxPlatform { 1.30 +public: 1.31 + gfxAndroidPlatform(); 1.32 + virtual ~gfxAndroidPlatform(); 1.33 + 1.34 + static gfxAndroidPlatform *GetPlatform() { 1.35 + return (gfxAndroidPlatform*) gfxPlatform::GetPlatform(); 1.36 + } 1.37 + 1.38 + virtual already_AddRefed<gfxASurface> 1.39 + CreateOffscreenSurface(const IntSize& size, 1.40 + gfxContentType contentType); 1.41 + 1.42 + virtual gfxImageFormat GetOffscreenFormat() { return mOffscreenFormat; } 1.43 + 1.44 + mozilla::TemporaryRef<mozilla::gfx::ScaledFont> 1.45 + GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont); 1.46 + 1.47 + // to support IPC font list (sharing between chrome and content) 1.48 + void GetFontList(InfallibleTArray<FontListEntry>* retValue); 1.49 + 1.50 + // platform implementations of font functions 1.51 + virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags); 1.52 + virtual gfxPlatformFontList* CreatePlatformFontList(); 1.53 + virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry, 1.54 + const uint8_t *aFontData, uint32_t aLength); 1.55 + virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry, 1.56 + const nsAString& aFontName); 1.57 + 1.58 + virtual void GetCommonFallbackFonts(const uint32_t aCh, 1.59 + int32_t aRunScript, 1.60 + nsTArray<const char*>& aFontList); 1.61 + 1.62 + virtual nsresult GetFontList(nsIAtom *aLangGroup, 1.63 + const nsACString& aGenericFamily, 1.64 + nsTArray<nsString>& aListOfFonts); 1.65 + 1.66 + virtual nsresult UpdateFontList(); 1.67 + 1.68 + virtual nsresult ResolveFontName(const nsAString& aFontName, 1.69 + FontResolverCallback aCallback, 1.70 + void *aClosure, bool& aAborted); 1.71 + 1.72 + virtual nsresult GetStandardFamilyName(const nsAString& aFontName, 1.73 + nsAString& aFamilyName); 1.74 + 1.75 + virtual gfxFontGroup *CreateFontGroup(const nsAString &aFamilies, 1.76 + const gfxFontStyle *aStyle, 1.77 + gfxUserFontSet* aUserFontSet); 1.78 + 1.79 + virtual bool FontHintingEnabled() MOZ_OVERRIDE; 1.80 + virtual bool RequiresLinearZoom() MOZ_OVERRIDE; 1.81 + 1.82 + FT_Library GetFTLibrary(); 1.83 + 1.84 + virtual int GetScreenDepth() const; 1.85 + 1.86 + virtual bool UseAcceleratedSkiaCanvas() MOZ_OVERRIDE; 1.87 + 1.88 +#ifdef MOZ_WIDGET_GONK 1.89 + virtual bool IsInGonkEmulator() const { return mIsInGonkEmulator; } 1.90 +#endif 1.91 + 1.92 +private: 1.93 + int mScreenDepth; 1.94 + gfxImageFormat mOffscreenFormat; 1.95 + 1.96 +#ifdef MOZ_WIDGET_GONK 1.97 + bool mIsInGonkEmulator; 1.98 +#endif 1.99 +}; 1.100 + 1.101 +#endif /* GFX_PLATFORM_ANDROID_H */ 1.102 +