Coverage Report

Created: 2024-05-20 07:14

/src/skia/include/gpu/ganesh/vk/GrBackendDrawableInfo.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2018 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 GrBackendDrawableInfo_DEFINED
9
#define GrBackendDrawableInfo_DEFINED
10
11
#include "include/gpu/GrTypes.h"
12
13
#include "include/gpu/vk/GrVkTypes.h"
14
15
// If necessary, this could be pulled into a generic interface, but at this point, we only expect
16
// it to be used by the Ganesh Vulkan backend.
17
class SK_API GrBackendDrawableInfo {
18
public:
19
    // Creates an invalid backend drawable info.
20
0
    GrBackendDrawableInfo() : fIsValid(false) {}
21
22
    GrBackendDrawableInfo(const GrVkDrawableInfo& info)
23
            : fIsValid(true)
24
            , fBackend(GrBackendApi::kVulkan)
25
0
            , fVkInfo(info) {}
26
27
    // Returns true if the backend texture has been initialized.
28
0
    bool isValid() const { return fIsValid; }
29
30
0
    GrBackendApi backend() const { return fBackend; }
31
32
0
    bool getVkDrawableInfo(GrVkDrawableInfo* outInfo) const {
33
0
        if (this->isValid() && GrBackendApi::kVulkan == fBackend) {
34
0
            *outInfo = fVkInfo;
35
0
            return true;
36
0
        }
37
0
        return false;
38
0
    }
39
40
private:
41
    bool             fIsValid;
42
    GrBackendApi     fBackend;
43
    GrVkDrawableInfo fVkInfo;
44
};
45
46
#endif