|
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/. */ |
|
5 |
|
6 #ifndef GFX_PLATFORM_MAC_H |
|
7 #define GFX_PLATFORM_MAC_H |
|
8 |
|
9 #include "nsTArrayForwardDeclare.h" |
|
10 #include "gfxPlatform.h" |
|
11 |
|
12 #define MAC_OS_X_VERSION_10_6_HEX 0x00001060 |
|
13 #define MAC_OS_X_VERSION_10_7_HEX 0x00001070 |
|
14 |
|
15 #define MAC_OS_X_MAJOR_VERSION_MASK 0xFFFFFFF0U |
|
16 |
|
17 namespace mozilla { namespace gfx { class DrawTarget; }} |
|
18 |
|
19 class gfxPlatformMac : public gfxPlatform { |
|
20 public: |
|
21 gfxPlatformMac(); |
|
22 virtual ~gfxPlatformMac(); |
|
23 |
|
24 static gfxPlatformMac *GetPlatform() { |
|
25 return (gfxPlatformMac*) gfxPlatform::GetPlatform(); |
|
26 } |
|
27 |
|
28 virtual already_AddRefed<gfxASurface> |
|
29 CreateOffscreenSurface(const IntSize& size, |
|
30 gfxContentType contentType) MOZ_OVERRIDE; |
|
31 |
|
32 virtual already_AddRefed<gfxASurface> |
|
33 CreateOffscreenImageSurface(const gfxIntSize& aSize, |
|
34 gfxContentType aContentType); |
|
35 |
|
36 already_AddRefed<gfxASurface> OptimizeImage(gfxImageSurface *aSurface, |
|
37 gfxImageFormat format); |
|
38 |
|
39 mozilla::TemporaryRef<mozilla::gfx::ScaledFont> |
|
40 GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont); |
|
41 |
|
42 nsresult ResolveFontName(const nsAString& aFontName, |
|
43 FontResolverCallback aCallback, |
|
44 void *aClosure, bool& aAborted); |
|
45 |
|
46 nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName); |
|
47 |
|
48 gfxFontGroup *CreateFontGroup(const nsAString &aFamilies, |
|
49 const gfxFontStyle *aStyle, |
|
50 gfxUserFontSet *aUserFontSet); |
|
51 |
|
52 virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry, |
|
53 const nsAString& aFontName); |
|
54 |
|
55 virtual gfxPlatformFontList* CreatePlatformFontList(); |
|
56 |
|
57 virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry, |
|
58 const uint8_t *aFontData, |
|
59 uint32_t aLength); |
|
60 |
|
61 bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags); |
|
62 |
|
63 nsresult GetFontList(nsIAtom *aLangGroup, |
|
64 const nsACString& aGenericFamily, |
|
65 nsTArray<nsString>& aListOfFonts); |
|
66 nsresult UpdateFontList(); |
|
67 |
|
68 virtual void GetCommonFallbackFonts(const uint32_t aCh, |
|
69 int32_t aRunScript, |
|
70 nsTArray<const char*>& aFontList); |
|
71 |
|
72 bool UseAcceleratedCanvas(); |
|
73 |
|
74 // lower threshold on font anti-aliasing |
|
75 uint32_t GetAntiAliasingThreshold() { return mFontAntiAliasingThreshold; } |
|
76 |
|
77 virtual already_AddRefed<gfxASurface> |
|
78 GetThebesSurfaceForDrawTarget(mozilla::gfx::DrawTarget *aTarget); |
|
79 private: |
|
80 virtual void GetPlatformCMSOutputProfile(void* &mem, size_t &size); |
|
81 |
|
82 virtual bool SupportsOffMainThreadCompositing(); |
|
83 |
|
84 // read in the pref value for the lower threshold on font anti-aliasing |
|
85 static uint32_t ReadAntiAliasingThreshold(); |
|
86 |
|
87 uint32_t mFontAntiAliasingThreshold; |
|
88 }; |
|
89 |
|
90 #endif /* GFX_PLATFORM_MAC_H */ |