Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
UniquePaintParamsID.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 Google LLC
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 skgpu_graphite_UniquePaintParamsID_DEFINED
9#define skgpu_graphite_UniquePaintParamsID_DEFINED
10
12
13namespace skgpu::graphite {
14
15// This class boils down to a unique uint that can be used instead of a variable length
16// key derived from a PaintParams.
18public:
19 explicit UniquePaintParamsID(uint32_t id) : fID(id) {
21 }
22
24
26
27 bool operator==(const UniquePaintParamsID &that) const { return fID == that.fID; }
28 bool operator!=(const UniquePaintParamsID &that) const { return !(*this == that); }
29
30 bool isValid() const { return fID != SK_InvalidUniqueID; }
31 uint32_t asUInt() const { return fID; }
32
33private:
34 uint32_t fID;
35};
36
37} // skgpu::graphite
38
39#endif // skgpu_graphite_UniquePaintParamsID_DEFINED
#define SkASSERT(cond)
Definition SkAssert.h:116
static constexpr uint32_t SK_InvalidUniqueID
Definition SkTypes.h:196
bool operator!=(const UniquePaintParamsID &that) const
bool operator==(const UniquePaintParamsID &that) const
static UniquePaintParamsID InvalidID()
const uintptr_t id