Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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_MAC_H
7 #define GFX_PLATFORM_MAC_H
9 #include "nsTArrayForwardDeclare.h"
10 #include "gfxPlatform.h"
12 #define MAC_OS_X_VERSION_10_6_HEX 0x00001060
13 #define MAC_OS_X_VERSION_10_7_HEX 0x00001070
15 #define MAC_OS_X_MAJOR_VERSION_MASK 0xFFFFFFF0U
17 namespace mozilla { namespace gfx { class DrawTarget; }}
19 class gfxPlatformMac : public gfxPlatform {
20 public:
21 gfxPlatformMac();
22 virtual ~gfxPlatformMac();
24 static gfxPlatformMac *GetPlatform() {
25 return (gfxPlatformMac*) gfxPlatform::GetPlatform();
26 }
28 virtual already_AddRefed<gfxASurface>
29 CreateOffscreenSurface(const IntSize& size,
30 gfxContentType contentType) MOZ_OVERRIDE;
32 virtual already_AddRefed<gfxASurface>
33 CreateOffscreenImageSurface(const gfxIntSize& aSize,
34 gfxContentType aContentType);
36 already_AddRefed<gfxASurface> OptimizeImage(gfxImageSurface *aSurface,
37 gfxImageFormat format);
39 mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
40 GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont);
42 nsresult ResolveFontName(const nsAString& aFontName,
43 FontResolverCallback aCallback,
44 void *aClosure, bool& aAborted);
46 nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName);
48 gfxFontGroup *CreateFontGroup(const nsAString &aFamilies,
49 const gfxFontStyle *aStyle,
50 gfxUserFontSet *aUserFontSet);
52 virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
53 const nsAString& aFontName);
55 virtual gfxPlatformFontList* CreatePlatformFontList();
57 virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
58 const uint8_t *aFontData,
59 uint32_t aLength);
61 bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags);
63 nsresult GetFontList(nsIAtom *aLangGroup,
64 const nsACString& aGenericFamily,
65 nsTArray<nsString>& aListOfFonts);
66 nsresult UpdateFontList();
68 virtual void GetCommonFallbackFonts(const uint32_t aCh,
69 int32_t aRunScript,
70 nsTArray<const char*>& aFontList);
72 bool UseAcceleratedCanvas();
74 // lower threshold on font anti-aliasing
75 uint32_t GetAntiAliasingThreshold() { return mFontAntiAliasingThreshold; }
77 virtual already_AddRefed<gfxASurface>
78 GetThebesSurfaceForDrawTarget(mozilla::gfx::DrawTarget *aTarget);
79 private:
80 virtual void GetPlatformCMSOutputProfile(void* &mem, size_t &size);
82 virtual bool SupportsOffMainThreadCompositing();
84 // read in the pref value for the lower threshold on font anti-aliasing
85 static uint32_t ReadAntiAliasingThreshold();
87 uint32_t mFontAntiAliasingThreshold;
88 };
90 #endif /* GFX_PLATFORM_MAC_H */