1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef GFX_PLATFORM_GTK_H
7 #define GFX_PLATFORM_GTK_H
9 #include "gfxPlatform.h"
11 #include "nsAutoRef.h"
14 #if (MOZ_WIDGET_GTK == 2)
16 typedef struct _GdkDrawable GdkDrawable
;
20 class gfxFontconfigUtils
;
22 class gfxPlatformGtk
: public gfxPlatform
{
25 virtual ~gfxPlatformGtk();
27 static gfxPlatformGtk
*GetPlatform() {
28 return (gfxPlatformGtk
*) gfxPlatform::GetPlatform();
31 virtual already_AddRefed
<gfxASurface
>
32 CreateOffscreenSurface(const IntSize
& size
,
33 gfxContentType contentType
) MOZ_OVERRIDE
;
35 mozilla::TemporaryRef
<mozilla::gfx::ScaledFont
>
36 GetScaledFontForFont(mozilla::gfx::DrawTarget
* aTarget
, gfxFont
*aFont
);
38 nsresult
GetFontList(nsIAtom
*aLangGroup
,
39 const nsACString
& aGenericFamily
,
40 nsTArray
<nsString
>& aListOfFonts
);
42 nsresult
UpdateFontList();
44 nsresult
GetStandardFamilyName(const nsAString
& aFontName
, nsAString
& aFamilyName
);
46 gfxFontGroup
*CreateFontGroup(const mozilla::FontFamilyList
& aFontFamilyList
,
47 const gfxFontStyle
*aStyle
,
48 gfxUserFontSet
*aUserFontSet
);
51 * Look up a local platform font using the full font face name (needed to
52 * support @font-face src local() )
54 virtual gfxFontEntry
* LookupLocalFont(const gfxProxyFontEntry
*aProxyEntry
,
55 const nsAString
& aFontName
);
58 * Activate a platform font (needed to support @font-face src url() )
61 virtual gfxFontEntry
* MakePlatformFont(const gfxProxyFontEntry
*aProxyEntry
,
62 const uint8_t *aFontData
,
66 * Check whether format is supported on a platform or not (if unclear,
69 virtual bool IsFontFormatSupported(nsIURI
*aFontURI
,
70 uint32_t aFormatFlags
);
72 #if (MOZ_WIDGET_GTK == 2)
73 static void SetGdkDrawable(cairo_surface_t
*target
,
74 GdkDrawable
*drawable
);
75 static GdkDrawable
*GetGdkDrawable(cairo_surface_t
*target
);
78 static int32_t GetDPI();
82 if (GetContentBackend() != mozilla::gfx::BackendType::NONE
&&
83 GetContentBackend() != mozilla::gfx::BackendType::CAIRO
)
92 bool UseImageOffscreenSurfaces() {
93 // We want to turn on image offscreen surfaces ONLY for GTK3 builds
94 // since GTK2 theme rendering still requires xlib surfaces per se.
95 #if (MOZ_WIDGET_GTK == 3)
96 return gfxPrefs::UseImageOffscreenSurfaces();
102 virtual gfxImageFormat
GetOffscreenFormat();
104 virtual int GetScreenDepth() const;
107 static gfxFontconfigUtils
*sFontconfigUtils
;
110 virtual void GetPlatformCMSOutputProfile(void *&mem
, size_t &size
);
113 static bool sUseXRender
;
117 #endif /* GFX_PLATFORM_GTK_H */