Skia
2D Graphics Library
GrBackendDrawableInfo.h
Go to the documentation of this file.
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 class SK_API GrBackendDrawableInfo {
16 public:
17  // Creates an invalid backend drawable info.
18  GrBackendDrawableInfo() : fIsValid(false) {}
19 
20  GrBackendDrawableInfo(const GrVkDrawableInfo& info)
21  : fIsValid(true)
22  , fBackend(GrBackendApi::kVulkan)
23  , fVkInfo(info) {}
24 
25  // Returns true if the backend texture has been initialized.
26  bool isValid() const { return fIsValid; }
27 
28  GrBackendApi backend() const { return fBackend; }
29 
30  bool getVkDrawableInfo(GrVkDrawableInfo* outInfo) const {
31  if (this->isValid() && GrBackendApi::kVulkan == fBackend) {
32  *outInfo = fVkInfo;
33  return true;
34  }
35  return false;
36  }
37 
38 private:
39  bool fIsValid;
40  GrBackendApi fBackend;
41  GrVkDrawableInfo fVkInfo;
42 };
43 
44 #endif
GrBackendApi
Possible 3D APIs that may be used by Ganesh.
Definition: GrTypes.h:96
Definition: GrBackendDrawableInfo.h:15
GrBackendDrawableInfo()
Definition: GrBackendDrawableInfo.h:18
GrBackendApi backend() const
Definition: GrBackendDrawableInfo.h:28
bool getVkDrawableInfo(GrVkDrawableInfo *outInfo) const
Definition: GrBackendDrawableInfo.h:30
GrBackendDrawableInfo(const GrVkDrawableInfo &info)
Definition: GrBackendDrawableInfo.h:20
bool isValid() const
Definition: GrBackendDrawableInfo.h:26