gecko/gfx/thebes/gfxAndroidPlatform.h

110 lines
3.7 KiB
C
Raw Normal View History

/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2012-05-21 04:12:37 -07: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/. */
#ifndef GFX_PLATFORM_ANDROID_H
#define GFX_PLATFORM_ANDROID_H
#include "gfxFT2Fonts.h"
#include "gfxPlatform.h"
#include "gfxUserFontSet.h"
#include "nsCOMPtr.h"
#include "nsTArray.h"
class nsIMemoryReporter;
namespace mozilla {
namespace dom {
class FontListEntry;
};
};
using mozilla::dom::FontListEntry;
typedef struct FT_LibraryRec_ *FT_Library;
class gfxAndroidPlatform : public gfxPlatform {
public:
gfxAndroidPlatform();
virtual ~gfxAndroidPlatform();
static gfxAndroidPlatform *GetPlatform() {
return (gfxAndroidPlatform*) gfxPlatform::GetPlatform();
}
virtual already_AddRefed<gfxASurface>
CreateOffscreenSurface(const IntSize& size,
Bug 913872 - Take nested enums out of gfxASurface - 1/3 : automatic changes - r=jrmuizel Generated by these regexes: find . -name '*.h' -o -name '*.cpp' -o -name '*.mm' | grep -v '\.hg' | grep -v '^\.\/obj' | xargs sed -i 's/gfx[A-Za-z0-9_]*Surface\:\:[a-z]*\(\(ImageFormat\|SurfaceType\|ContentType\|MemoryLocation\)[0-9A-Za-z_]*\)/gfx\1/g' find . -name '*.h' -o -name '*.cpp' -o -name '*.mm' | grep -v '\.hg' | grep -v '^\.\/obj' | xargs sed -i 's/gfx[A-Za-z0-9_]*Surface\:\:[a-z]*\(\(CONTENT_\|MEMORY_\)[0-9A-Za-z_]*\)/GFX_\1/g' find . -name '*.h' -o -name '*.cpp' -o -name '*.mm' | grep -v '\.hg' | grep -v '^\.\/obj' | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)\(CONTENT_COLOR\|CONTENT_ALPHA\|CONTENT_COLOR_ALPHA\|CONTENT_SENTINEL\|MEMORY_IN_PROCESS_HEAP\|MEMORY_IN_PROCESS_NONHEAP\|MEMORY_OUT_OF_PROCESS\)\($\|[^A-Za-z0-9_]\)/\1GFX_\2\3/g' find . -name '*.h' -o -name '*.cpp' -o -name '*.mm' | grep -v '\.hg' | grep -v '^\.\/obj' | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)\(ImageFormatARGB32\|ImageFormatRGB24\|ImageFormatA8\|ImageFormatA1\|ImageFormatRGB16_565\|ImageFormatUnknown\|SurfaceTypeImage\|SurfaceTypePDF\|SurfaceTypePS\|SurfaceTypeXlib\|SurfaceTypeXcb\|SurfaceTypeGlitz\|SurfaceTypeQuartz\|SurfaceTypeWin32\|SurfaceTypeBeOS\|SurfaceTypeDirectFB\|SurfaceTypeSVG\|SurfaceTypeOS2\|SurfaceTypeWin32Printing\|SurfaceTypeQuartzImage\|SurfaceTypeScript\|SurfaceTypeQPainter\|SurfaceTypeRecording\|SurfaceTypeVG\|SurfaceTypeGL\|SurfaceTypeDRM\|SurfaceTypeTee\|SurfaceTypeXML\|SurfaceTypeSkia\|SurfaceTypeSubsurface\|SurfaceTypeD2D\|SurfaceTypeMax\)\($\|[^A-Za-z0-9_]\)/\1gfx\2\3/g'
2013-09-24 13:45:13 -07:00
gfxContentType contentType);
virtual gfxImageFormat GetOffscreenFormat() { return mOffscreenFormat; }
mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont);
// to support IPC font list (sharing between chrome and content)
void GetFontList(InfallibleTArray<FontListEntry>* retValue);
// platform implementations of font functions
virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags);
virtual gfxPlatformFontList* CreatePlatformFontList();
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);
virtual void GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
int32_t aRunScript,
nsTArray<const char*>& aFontList);
virtual nsresult GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts);
virtual nsresult UpdateFontList();
virtual nsresult GetStandardFamilyName(const nsAString& aFontName,
nsAString& aFamilyName);
virtual gfxFontGroup*
CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList,
const gfxFontStyle *aStyle,
gfxUserFontSet* aUserFontSet);
virtual bool FontHintingEnabled() MOZ_OVERRIDE;
virtual bool RequiresLinearZoom() MOZ_OVERRIDE;
FT_Library GetFTLibrary();
virtual int GetScreenDepth() const;
virtual bool CanRenderContentToDataSurface() const MOZ_OVERRIDE {
return true;
}
virtual bool HaveChoiceOfHWAndSWCanvas() MOZ_OVERRIDE;
virtual bool UseAcceleratedSkiaCanvas() MOZ_OVERRIDE;
virtual already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() MOZ_OVERRIDE;
#ifdef MOZ_WIDGET_GONK
virtual bool IsInGonkEmulator() const { return mIsInGonkEmulator; }
#endif
private:
int mScreenDepth;
gfxImageFormat mOffscreenFormat;
#ifdef MOZ_WIDGET_GONK
bool mIsInGonkEmulator;
#endif
};
#endif /* GFX_PLATFORM_ANDROID_H */