Coverage Report

Created: 2024-09-14 07:19

/src/skia/src/gpu/ganesh/GrBaseContextPriv.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2019 Google Inc.
3
 *
4
 * Use of this source code is governed by a BSD-style license that can be
5
 * found in the LICENSE file.
6
 */
7
8
#ifndef GrBaseContextPriv_DEFINED
9
#define GrBaseContextPriv_DEFINED
10
11
#include "include/core/SkRefCnt.h"
12
#include "include/gpu/ganesh/GrContextOptions.h"
13
#include "include/private/gpu/ganesh/GrContext_Base.h"
14
15
#include <cstdint>
16
17
class GrCaps;
18
class GrDirectContext;
19
class GrImageContext;
20
class GrRecordingContext;
21
22
/** Class that exposes methods on GrContext_Base that are only intended for use internal to Skia.
23
    This class is purely a privileged window into GrContext_Base. It should never have
24
    additional data members or virtual methods. */
25
class GrBaseContextPriv {
26
public:
27
0
    GrContext_Base* context() { return fContext; }
28
4.52M
    const GrContext_Base* context() const { return fContext; }
29
30
94.3k
    uint32_t contextID() const { return this->context()->contextID(); }
31
32
265k
    bool matches(GrContext_Base* candidate) const { return this->context()->matches(candidate); }
33
34
250k
    const GrContextOptions& options() const { return this->context()->options(); }
35
36
3.90M
    const GrCaps* caps() const { return this->context()->caps(); }
37
    sk_sp<const GrCaps> refCaps() const;
38
39
0
    GrImageContext* asImageContext() { return this->context()->asImageContext(); }
40
0
    GrRecordingContext* asRecordingContext() { return this->context()->asRecordingContext(); }
41
0
    GrDirectContext* asDirectContext() { return this->context()->asDirectContext(); }
42
43
    GrContextOptions::ShaderErrorHandler* getShaderErrorHandler() const;
44
45
protected:
46
11.4M
    explicit GrBaseContextPriv(GrContext_Base* context) : fContext(context) {}
47
48
    GrContext_Base* fContext;
49
50
private:
51
    GrBaseContextPriv& operator=(const GrBaseContextPriv&) = delete;
52
53
    // No taking addresses of this type.
54
    const GrBaseContextPriv* operator&() const;
55
    GrBaseContextPriv* operator&();
56
57
    friend class GrContext_Base; // to construct/copy this type.
58
};
59
60
0
inline GrBaseContextPriv GrContext_Base::priv() { return GrBaseContextPriv(this); }
61
62
0
inline const GrBaseContextPriv GrContext_Base::priv () const {  // NOLINT(readability-const-return-type)
63
0
    return GrBaseContextPriv(const_cast<GrContext_Base*>(this));
64
0
}
65
66
#endif