Bumping manifests a=b2g-bump
[gecko.git] / gfx / thebes / gfxPlatformGtk.h
blobcc076d28e5bcd43d6a6e0e3a1d758a1165f54c69
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"
10 #include "gfxPrefs.h"
11 #include "nsAutoRef.h"
12 #include "nsTArray.h"
14 #if (MOZ_WIDGET_GTK == 2)
15 extern "C" {
16 typedef struct _GdkDrawable GdkDrawable;
18 #endif
20 class gfxFontconfigUtils;
22 class gfxPlatformGtk : public gfxPlatform {
23 public:
24 gfxPlatformGtk();
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);
50 /**
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);
57 /**
58 * Activate a platform font (needed to support @font-face src url() )
61 virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
62 const uint8_t *aFontData,
63 uint32_t aLength);
65 /**
66 * Check whether format is supported on a platform or not (if unclear,
67 * returns true).
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);
76 #endif
78 static int32_t GetDPI();
80 bool UseXRender() {
81 #if defined(MOZ_X11)
82 if (GetContentBackend() != mozilla::gfx::BackendType::NONE &&
83 GetContentBackend() != mozilla::gfx::BackendType::CAIRO)
84 return false;
86 return sUseXRender;
87 #else
88 return false;
89 #endif
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();
97 #else
98 return false;
99 #endif
102 virtual gfxImageFormat GetOffscreenFormat();
104 virtual int GetScreenDepth() const;
106 protected:
107 static gfxFontconfigUtils *sFontconfigUtils;
109 private:
110 virtual void GetPlatformCMSOutputProfile(void *&mem, size_t &size);
112 #ifdef MOZ_X11
113 static bool sUseXRender;
114 #endif
117 #endif /* GFX_PLATFORM_GTK_H */