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_GTK_H michael@0: #define GFX_PLATFORM_GTK_H michael@0: michael@0: #include "gfxPlatform.h" michael@0: #include "nsAutoRef.h" michael@0: #include "nsTArray.h" michael@0: michael@0: #if (MOZ_WIDGET_GTK == 2) michael@0: extern "C" { michael@0: typedef struct _GdkDrawable GdkDrawable; michael@0: } michael@0: #endif michael@0: michael@0: class gfxFontconfigUtils; michael@0: michael@0: class gfxPlatformGtk : public gfxPlatform { michael@0: public: michael@0: gfxPlatformGtk(); michael@0: virtual ~gfxPlatformGtk(); michael@0: michael@0: static gfxPlatformGtk *GetPlatform() { michael@0: return (gfxPlatformGtk*) gfxPlatform::GetPlatform(); michael@0: } michael@0: michael@0: virtual already_AddRefed michael@0: CreateOffscreenSurface(const IntSize& size, michael@0: gfxContentType contentType) MOZ_OVERRIDE; michael@0: michael@0: mozilla::TemporaryRef michael@0: GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont); michael@0: michael@0: nsresult GetFontList(nsIAtom *aLangGroup, michael@0: const nsACString& aGenericFamily, michael@0: nsTArray& aListOfFonts); michael@0: michael@0: nsresult UpdateFontList(); michael@0: michael@0: nsresult ResolveFontName(const nsAString& aFontName, michael@0: FontResolverCallback aCallback, michael@0: void *aClosure, bool& aAborted); michael@0: michael@0: nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName); michael@0: michael@0: gfxFontGroup *CreateFontGroup(const nsAString &aFamilies, michael@0: const gfxFontStyle *aStyle, michael@0: gfxUserFontSet *aUserFontSet); michael@0: michael@0: /** michael@0: * Look up a local platform font using the full font face name (needed to michael@0: * support @font-face src local() ) michael@0: */ michael@0: virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry, michael@0: const nsAString& aFontName); michael@0: michael@0: /** michael@0: * Activate a platform font (needed to support @font-face src url() ) michael@0: * michael@0: */ michael@0: virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry, michael@0: const uint8_t *aFontData, michael@0: uint32_t aLength); michael@0: michael@0: /** michael@0: * Check whether format is supported on a platform or not (if unclear, michael@0: * returns true). michael@0: */ michael@0: virtual bool IsFontFormatSupported(nsIURI *aFontURI, michael@0: uint32_t aFormatFlags); michael@0: michael@0: #if (MOZ_WIDGET_GTK == 2) michael@0: static void SetGdkDrawable(cairo_surface_t *target, michael@0: GdkDrawable *drawable); michael@0: static GdkDrawable *GetGdkDrawable(cairo_surface_t *target); michael@0: #endif michael@0: michael@0: static int32_t GetDPI(); michael@0: michael@0: bool UseXRender() { michael@0: #if defined(MOZ_X11) michael@0: if (GetContentBackend() != mozilla::gfx::BackendType::NONE && michael@0: GetContentBackend() != mozilla::gfx::BackendType::CAIRO) michael@0: return false; michael@0: michael@0: return sUseXRender; michael@0: #else michael@0: return false; michael@0: #endif michael@0: } michael@0: michael@0: virtual gfxImageFormat GetOffscreenFormat(); michael@0: michael@0: virtual int GetScreenDepth() const; michael@0: michael@0: protected: michael@0: static gfxFontconfigUtils *sFontconfigUtils; michael@0: michael@0: private: michael@0: virtual void GetPlatformCMSOutputProfile(void *&mem, size_t &size); michael@0: michael@0: virtual bool SupportsOffMainThreadCompositing(); michael@0: #ifdef MOZ_X11 michael@0: static bool sUseXRender; michael@0: #endif michael@0: }; michael@0: michael@0: #endif /* GFX_PLATFORM_GTK_H */