Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
gpu
ganesh
GrResourceHandle.h
Go to the documentation of this file.
1
/*
2
* Copyright 2016 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 GrResourceHandle_DEFINED
9
#define GrResourceHandle_DEFINED
10
11
#include "
include/core/SkTypes.h
"
12
13
// Opaque handle to a resource. Users should always use the macro below to create a specific
14
// template instantiation of GrResourceHandle.
15
template
<
typename
kind>
class
GrResourceHandle
{
16
public
:
17
GrResourceHandle
(
int
value) : fValue(
value
) {
18
SkASSERT
(this->
isValid
());
19
}
20
21
GrResourceHandle
() : fValue(kInvalid_ResourceHandle) {}
22
23
bool
operator==
(
const
GrResourceHandle
& other)
const
{
return
other.fValue == fValue; }
24
bool
isValid
()
const
{
return
kInvalid_ResourceHandle != fValue; }
25
int
toIndex
()
const
{
SkASSERT
(this->
isValid
());
return
fValue; }
26
27
private
:
28
static
const
int
kInvalid_ResourceHandle = -1;
29
int
fValue;
30
};
31
32
// Creates a type "name", which is a specfic template instantiation of GrResourceHandle.
33
#define GR_DEFINE_RESOURCE_HANDLE_CLASS(name) \
34
struct name##Kind {}; \
35
using name = GrResourceHandle<name##Kind>;
36
#endif
SkASSERT
#define SkASSERT(cond)
Definition
SkAssert.h:116
SkTypes.h
GrResourceHandle
Definition
GrResourceHandle.h:15
GrResourceHandle::isValid
bool isValid() const
Definition
GrResourceHandle.h:24
GrResourceHandle::GrResourceHandle
GrResourceHandle()
Definition
GrResourceHandle.h:21
GrResourceHandle::toIndex
int toIndex() const
Definition
GrResourceHandle.h:25
GrResourceHandle::GrResourceHandle
GrResourceHandle(int value)
Definition
GrResourceHandle.h:17
GrResourceHandle::operator==
bool operator==(const GrResourceHandle &other) const
Definition
GrResourceHandle.h:23
value
uint8_t value
Definition
fl_standard_message_codec.cc:36
Generated on Fri Apr 26 2024 06:17:05 for Flutter Engine by
1.9.8