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_QT_H michael@0: #define GFX_PLATFORM_QT_H michael@0: michael@0: #include "gfxPlatform.h" michael@0: #include "nsAutoRef.h" michael@0: #include "nsDataHashtable.h" michael@0: #include "nsTArray.h" michael@0: #ifdef MOZ_X11 michael@0: #include "X11/Xlib.h" michael@0: #endif michael@0: michael@0: class gfxImageSurface; michael@0: class gfxFontconfigUtils; michael@0: class QWindow; michael@0: michael@0: class gfxQtPlatform : public gfxPlatform { michael@0: public: michael@0: gfxQtPlatform(); michael@0: virtual ~gfxQtPlatform(); michael@0: michael@0: static gfxQtPlatform *GetPlatform() { michael@0: return static_cast(gfxPlatform::GetPlatform()); michael@0: } michael@0: michael@0: virtual already_AddRefed michael@0: OptimizeImage(gfxImageSurface *aSurface, michael@0: gfxImageFormat format) MOZ_OVERRIDE; michael@0: virtual already_AddRefed michael@0: CreateOffscreenSurface(const IntSize& size, michael@0: gfxContentType contentType) MOZ_OVERRIDE; michael@0: michael@0: virtual mozilla::TemporaryRef michael@0: GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult GetFontList(nsIAtom *aLangGroup, michael@0: const nsACString& aGenericFamily, michael@0: nsTArray& aListOfFonts) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult UpdateFontList() MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult ResolveFontName(const nsAString& aFontName, michael@0: FontResolverCallback aCallback, michael@0: void *aClosure, bool& aAborted) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName) MOZ_OVERRIDE; michael@0: michael@0: virtual gfxFontGroup *CreateFontGroup(const nsAString &aFamilies, michael@0: const gfxFontStyle *aStyle, michael@0: gfxUserFontSet* aUserFontSet) MOZ_OVERRIDE; 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) MOZ_OVERRIDE; 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) MOZ_OVERRIDE; 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) MOZ_OVERRIDE; michael@0: michael@0: virtual void ClearPrefFonts() { mPrefFonts.Clear(); } michael@0: michael@0: static int32_t GetDPI(); michael@0: michael@0: virtual gfxImageFormat GetOffscreenFormat() MOZ_OVERRIDE; michael@0: #ifdef MOZ_X11 michael@0: static Display* GetXDisplay(QWindow* aWindow = 0); michael@0: static Screen* GetXScreen(QWindow* aWindow = 0); michael@0: #endif michael@0: michael@0: virtual int GetScreenDepth() const MOZ_OVERRIDE; michael@0: michael@0: virtual bool SupportsOffMainThreadCompositing() MOZ_OVERRIDE; michael@0: michael@0: protected: michael@0: static gfxFontconfigUtils *sFontconfigUtils; michael@0: michael@0: private: 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 void GetPlatformCMSOutputProfile(void *&mem, size_t &size) MOZ_OVERRIDE; michael@0: michael@0: // TODO: unify this with mPrefFonts (NB: holds families, not fonts) in gfxPlatformFontList michael@0: nsDataHashtable > > mPrefFonts; michael@0: michael@0: int mScreenDepth; michael@0: #ifdef MOZ_X11 michael@0: static bool sUseXRender; michael@0: #endif michael@0: }; michael@0: michael@0: #endif /* GFX_PLATFORM_QT_H */ michael@0: