Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/gfxPlatformGtk.h
Line
Count
Source (jump to first uncovered line)
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_GTK_H
7
#define GFX_PLATFORM_GTK_H
8
9
#include "gfxPlatform.h"
10
#include "nsAutoRef.h"
11
#include "nsTArray.h"
12
#include "mozilla/gfx/gfxVars.h"
13
14
#ifdef MOZ_X11
15
struct _XDisplay;
16
typedef struct _XDisplay Display;
17
#endif // MOZ_X11
18
19
namespace mozilla {
20
    namespace dom {
21
        class SystemFontListEntry;
22
    };
23
};
24
25
class gfxPlatformGtk : public gfxPlatform {
26
public:
27
    gfxPlatformGtk();
28
    virtual ~gfxPlatformGtk();
29
30
0
    static gfxPlatformGtk *GetPlatform() {
31
0
        return (gfxPlatformGtk*) gfxPlatform::GetPlatform();
32
0
    }
33
34
    void ReadSystemFontList(
35
        InfallibleTArray<mozilla::dom::SystemFontListEntry>* retValue) override;
36
37
    virtual already_AddRefed<gfxASurface>
38
      CreateOffscreenSurface(const IntSize& aSize,
39
                             gfxImageFormat aFormat) override;
40
41
    virtual nsresult GetFontList(nsAtom *aLangGroup,
42
                                 const nsACString& aGenericFamily,
43
                                 nsTArray<nsString>& aListOfFonts) override;
44
45
    virtual nsresult UpdateFontList() override;
46
47
    virtual void
48
    GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
49
                           Script aRunScript,
50
                           nsTArray<const char*>& aFontList) override;
51
52
    virtual gfxPlatformFontList* CreatePlatformFontList() override;
53
54
    gfxFontGroup*
55
    CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList,
56
                    const gfxFontStyle *aStyle,
57
                    gfxTextPerfMetrics* aTextPerf,
58
                    gfxUserFontSet *aUserFontSet,
59
                    gfxFloat aDevToCssSize) override;
60
61
    /**
62
     * Calls XFlush if xrender is enabled.
63
     */
64
    virtual void FlushContentDrawing() override;
65
66
    FT_Library GetFTLibrary() override;
67
68
    static int32_t GetFontScaleDPI();
69
    static double  GetFontScaleFactor();
70
71
#ifdef MOZ_X11
72
    virtual void GetAzureBackendInfo(mozilla::widget::InfoObject &aObj) override {
73
      gfxPlatform::GetAzureBackendInfo(aObj);
74
      aObj.DefineProperty("CairoUseXRender", mozilla::gfx::gfxVars::UseXRender());
75
    }
76
#endif
77
78
    bool UseImageOffscreenSurfaces();
79
80
    virtual gfxImageFormat GetOffscreenFormat() override;
81
82
    bool SupportsApzWheelInput() const override {
83
      return true;
84
    }
85
86
    void FontsPrefsChanged(const char *aPref) override;
87
88
    // maximum number of fonts to substitute for a generic
89
    uint32_t MaxGenericSubstitions();
90
91
    bool SupportsPluginDirectBitmapDrawing() override {
92
      return true;
93
    }
94
95
    bool AccelerateLayersByDefault() override;
96
97
#ifdef MOZ_X11
98
    already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;
99
#endif
100
101
#ifdef MOZ_X11
102
0
    Display* GetCompositorDisplay() {
103
0
      return mCompositorDisplay;
104
0
    }
105
#endif // MOZ_X11
106
107
#ifdef MOZ_WAYLAND
108
    void SetWaylandLastVsync(uint32_t aVsyncTimestamp) {
109
      mWaylandLastVsyncTimestamp = aVsyncTimestamp;
110
    }
111
    int64_t GetWaylandLastVsync() {
112
      return mWaylandLastVsyncTimestamp;
113
    }
114
    void SetWaylandFrameDelay(int64_t aFrameDelay) {
115
      mWaylandFrameDelay = aFrameDelay;
116
    }
117
    int64_t GetWaylandFrameDelay() {
118
      return mWaylandFrameDelay;
119
    }
120
#endif
121
122
protected:
123
    bool CheckVariationFontSupport() override;
124
125
    int8_t mMaxGenericSubstitutions;
126
127
private:
128
    virtual void GetPlatformCMSOutputProfile(void *&mem,
129
                                             size_t &size) override;
130
131
#ifdef MOZ_X11
132
    Display* mCompositorDisplay;
133
#endif
134
#ifdef MOZ_WAYLAND
135
    int64_t  mWaylandLastVsyncTimestamp;
136
    int64_t  mWaylandFrameDelay;
137
#endif
138
};
139
140
#endif /* GFX_PLATFORM_GTK_H */