gfx/thebes/gfxPlatformGtk.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/thebes/gfxPlatformGtk.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,111 @@
     1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef GFX_PLATFORM_GTK_H
    1.10 +#define GFX_PLATFORM_GTK_H
    1.11 +
    1.12 +#include "gfxPlatform.h"
    1.13 +#include "nsAutoRef.h"
    1.14 +#include "nsTArray.h"
    1.15 +
    1.16 +#if (MOZ_WIDGET_GTK == 2)
    1.17 +extern "C" {
    1.18 +    typedef struct _GdkDrawable GdkDrawable;
    1.19 +}
    1.20 +#endif
    1.21 +
    1.22 +class gfxFontconfigUtils;
    1.23 +
    1.24 +class gfxPlatformGtk : public gfxPlatform {
    1.25 +public:
    1.26 +    gfxPlatformGtk();
    1.27 +    virtual ~gfxPlatformGtk();
    1.28 +
    1.29 +    static gfxPlatformGtk *GetPlatform() {
    1.30 +        return (gfxPlatformGtk*) gfxPlatform::GetPlatform();
    1.31 +    }
    1.32 +
    1.33 +    virtual already_AddRefed<gfxASurface>
    1.34 +      CreateOffscreenSurface(const IntSize& size,
    1.35 +                             gfxContentType contentType) MOZ_OVERRIDE;
    1.36 +
    1.37 +    mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
    1.38 +      GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont);
    1.39 +
    1.40 +    nsresult GetFontList(nsIAtom *aLangGroup,
    1.41 +                         const nsACString& aGenericFamily,
    1.42 +                         nsTArray<nsString>& aListOfFonts);
    1.43 +
    1.44 +    nsresult UpdateFontList();
    1.45 +
    1.46 +    nsresult ResolveFontName(const nsAString& aFontName,
    1.47 +                             FontResolverCallback aCallback,
    1.48 +                             void *aClosure, bool& aAborted);
    1.49 +
    1.50 +    nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName);
    1.51 +
    1.52 +    gfxFontGroup *CreateFontGroup(const nsAString &aFamilies,
    1.53 +                                  const gfxFontStyle *aStyle,
    1.54 +                                  gfxUserFontSet *aUserFontSet);
    1.55 +
    1.56 +    /**
    1.57 +     * Look up a local platform font using the full font face name (needed to
    1.58 +     * support @font-face src local() )
    1.59 +     */
    1.60 +    virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
    1.61 +                                          const nsAString& aFontName);
    1.62 +
    1.63 +    /**
    1.64 +     * Activate a platform font (needed to support @font-face src url() )
    1.65 +     *
    1.66 +     */
    1.67 +    virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
    1.68 +                                           const uint8_t *aFontData,
    1.69 +                                           uint32_t aLength);
    1.70 +
    1.71 +    /**
    1.72 +     * Check whether format is supported on a platform or not (if unclear,
    1.73 +     * returns true).
    1.74 +     */
    1.75 +    virtual bool IsFontFormatSupported(nsIURI *aFontURI,
    1.76 +                                         uint32_t aFormatFlags);
    1.77 +
    1.78 +#if (MOZ_WIDGET_GTK == 2)
    1.79 +    static void SetGdkDrawable(cairo_surface_t *target,
    1.80 +                               GdkDrawable *drawable);
    1.81 +    static GdkDrawable *GetGdkDrawable(cairo_surface_t *target);
    1.82 +#endif
    1.83 +
    1.84 +    static int32_t GetDPI();
    1.85 +
    1.86 +    bool UseXRender() {
    1.87 +#if defined(MOZ_X11)
    1.88 +        if (GetContentBackend() != mozilla::gfx::BackendType::NONE &&
    1.89 +            GetContentBackend() != mozilla::gfx::BackendType::CAIRO)
    1.90 +            return false;
    1.91 +
    1.92 +        return sUseXRender;
    1.93 +#else
    1.94 +        return false;
    1.95 +#endif
    1.96 +    }
    1.97 +
    1.98 +    virtual gfxImageFormat GetOffscreenFormat();
    1.99 +
   1.100 +    virtual int GetScreenDepth() const;
   1.101 +
   1.102 +protected:
   1.103 +    static gfxFontconfigUtils *sFontconfigUtils;
   1.104 +
   1.105 +private:
   1.106 +    virtual void GetPlatformCMSOutputProfile(void *&mem, size_t &size);
   1.107 +
   1.108 +    virtual bool SupportsOffMainThreadCompositing();
   1.109 +#ifdef MOZ_X11
   1.110 +    static bool sUseXRender;
   1.111 +#endif
   1.112 +};
   1.113 +
   1.114 +#endif /* GFX_PLATFORM_GTK_H */

mercurial