2010-05-11 17:27:36 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2012-05-21 11:12:37 +00:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-05-11 17:27:36 +00:00
|
|
|
|
|
|
|
#ifndef GFX_PLATFORM_ANDROID_H
|
|
|
|
#define GFX_PLATFORM_ANDROID_H
|
|
|
|
|
|
|
|
#include "gfxFT2Fonts.h"
|
|
|
|
#include "gfxPlatform.h"
|
2011-09-23 11:15:36 +00:00
|
|
|
#include "gfxUserFontSet.h"
|
2013-01-18 00:45:11 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2010-05-11 17:27:36 +00:00
|
|
|
#include "nsTArray.h"
|
|
|
|
|
2011-09-23 11:16:13 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class FontListEntry;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
using mozilla::dom::FontListEntry;
|
|
|
|
|
2010-05-11 17:27:36 +00:00
|
|
|
typedef struct FT_LibraryRec_ *FT_Library;
|
|
|
|
|
2013-05-29 21:59:24 +00:00
|
|
|
class gfxAndroidPlatform : public gfxPlatform {
|
2010-05-11 17:27:36 +00:00
|
|
|
public:
|
|
|
|
gfxAndroidPlatform();
|
|
|
|
virtual ~gfxAndroidPlatform();
|
|
|
|
|
|
|
|
static gfxAndroidPlatform *GetPlatform() {
|
|
|
|
return (gfxAndroidPlatform*) gfxPlatform::GetPlatform();
|
|
|
|
}
|
|
|
|
|
2011-09-23 11:15:36 +00:00
|
|
|
virtual already_AddRefed<gfxASurface>
|
2014-02-09 08:04:38 +00:00
|
|
|
CreateOffscreenSurface(const IntSize& size,
|
2013-09-24 20:45:13 +00:00
|
|
|
gfxContentType contentType);
|
2011-11-17 03:45:51 +00:00
|
|
|
|
2012-03-13 20:59:26 +00:00
|
|
|
virtual gfxImageFormat GetOffscreenFormat() { return mOffscreenFormat; }
|
2011-11-02 19:55:03 +00:00
|
|
|
|
2015-06-17 14:00:52 +00:00
|
|
|
already_AddRefed<mozilla::gfx::ScaledFont>
|
2012-07-24 10:18:37 +00:00
|
|
|
GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont);
|
2010-05-11 17:27:36 +00:00
|
|
|
|
2011-09-23 11:15:36 +00:00
|
|
|
// to support IPC font list (sharing between chrome and content)
|
2015-05-13 05:11:25 +00:00
|
|
|
void GetSystemFontList(InfallibleTArray<FontListEntry>* retValue);
|
2011-09-23 09:36:16 +00:00
|
|
|
|
2011-09-23 11:15:36 +00:00
|
|
|
// platform implementations of font functions
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags);
|
2010-07-16 06:03:45 +00:00
|
|
|
virtual gfxPlatformFontList* CreatePlatformFontList();
|
2014-09-08 07:23:19 +00:00
|
|
|
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
|
|
|
|
uint16_t aWeight,
|
|
|
|
int16_t aStretch,
|
|
|
|
bool aItalic);
|
|
|
|
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
|
|
|
|
uint16_t aWeight,
|
|
|
|
int16_t aStretch,
|
|
|
|
bool aItalic,
|
|
|
|
const uint8_t* aFontData,
|
|
|
|
uint32_t aLength);
|
2010-07-16 06:03:45 +00:00
|
|
|
|
2014-09-30 06:27:55 +00:00
|
|
|
virtual void GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
|
2013-03-04 17:03:16 +00:00
|
|
|
int32_t aRunScript,
|
|
|
|
nsTArray<const char*>& aFontList);
|
|
|
|
|
2011-09-23 11:15:36 +00:00
|
|
|
virtual nsresult GetFontList(nsIAtom *aLangGroup,
|
|
|
|
const nsACString& aGenericFamily,
|
|
|
|
nsTArray<nsString>& aListOfFonts);
|
2010-05-11 17:27:36 +00:00
|
|
|
|
2011-09-23 11:15:36 +00:00
|
|
|
virtual nsresult UpdateFontList();
|
2010-05-11 17:27:36 +00:00
|
|
|
|
2011-09-23 11:15:36 +00:00
|
|
|
virtual nsresult GetStandardFamilyName(const nsAString& aFontName,
|
|
|
|
nsAString& aFamilyName);
|
2010-05-11 17:27:36 +00:00
|
|
|
|
2014-06-06 06:09:23 +00:00
|
|
|
virtual gfxFontGroup*
|
|
|
|
CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList,
|
|
|
|
const gfxFontStyle *aStyle,
|
|
|
|
gfxUserFontSet* aUserFontSet);
|
2010-05-11 17:27:36 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool FontHintingEnabled() override;
|
|
|
|
virtual bool RequiresLinearZoom() override;
|
2012-02-08 22:52:57 +00:00
|
|
|
|
2010-05-11 17:27:36 +00:00
|
|
|
FT_Library GetFTLibrary();
|
2012-03-13 20:59:26 +00:00
|
|
|
|
2012-05-15 19:41:20 +00:00
|
|
|
virtual int GetScreenDepth() const;
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool CanRenderContentToDataSurface() const override {
|
2014-09-14 22:22:44 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool HaveChoiceOfHWAndSWCanvas() override;
|
|
|
|
virtual bool UseAcceleratedSkiaCanvas() override;
|
|
|
|
virtual already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;
|
2014-12-18 16:30:06 +00:00
|
|
|
|
2014-03-05 21:48:58 +00:00
|
|
|
|
2014-04-01 13:33:49 +00:00
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
|
|
virtual bool IsInGonkEmulator() const { return mIsInGonkEmulator; }
|
|
|
|
#endif
|
|
|
|
|
2015-04-19 21:34:09 +00:00
|
|
|
virtual bool SupportsApzTouchInput() const override {
|
2015-03-24 22:04:44 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-03-13 20:59:26 +00:00
|
|
|
private:
|
2012-05-15 19:41:20 +00:00
|
|
|
int mScreenDepth;
|
2012-03-13 20:59:26 +00:00
|
|
|
gfxImageFormat mOffscreenFormat;
|
2014-04-01 13:33:49 +00:00
|
|
|
|
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
|
|
bool mIsInGonkEmulator;
|
|
|
|
#endif
|
2010-05-11 17:27:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* GFX_PLATFORM_ANDROID_H */
|
|
|
|
|