diff options
author | 2022-04-03 16:34:10 -0700 | |
---|---|---|
committer | 2022-04-03 16:34:10 -0700 | |
commit | a87508008dfa1604baf2d4e39bf44704c00f261c (patch) | |
tree | 0be2ade96772037a02803b30e157c367d931e3d9 /src/deps/skia/include/private/SkUniquePaintParamsID.h | |
parent | 4a19a3f07f1887903e5638a3be167f0c7b377ba3 (diff) | |
download | bun-jarred/canvas.tar.gz bun-jarred/canvas.tar.zst bun-jarred/canvas.zip |
skia WIPjarred/canvas
Diffstat (limited to '')
-rw-r--r-- | src/deps/skia/include/private/SkUniquePaintParamsID.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/deps/skia/include/private/SkUniquePaintParamsID.h b/src/deps/skia/include/private/SkUniquePaintParamsID.h new file mode 100644 index 000000000..2cd89fd2f --- /dev/null +++ b/src/deps/skia/include/private/SkUniquePaintParamsID.h @@ -0,0 +1,35 @@ +/* + * Copyright 2022 Google LLC + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkUniquePaintParamsID_DEFINED +#define SkUniquePaintParamsID_DEFINED + +#include "include/core/SkTypes.h" + +// This class boils down to a unique uint that can be used instead of a variable length +// key derived from a PaintParams. +class SkUniquePaintParamsID { +public: + explicit SkUniquePaintParamsID(uint32_t id) : fID(id) { + SkASSERT(id != SK_InvalidUniqueID); + } + + static SkUniquePaintParamsID InvalidID() { return SkUniquePaintParamsID(); } + + SkUniquePaintParamsID() : fID(SK_InvalidUniqueID) {} + + bool operator==(const SkUniquePaintParamsID &that) const { return fID == that.fID; } + bool operator!=(const SkUniquePaintParamsID &that) const { return !(*this == that); } + + bool isValid() const { return fID != SK_InvalidUniqueID; } + uint32_t asUInt() const { return fID; } + +private: + uint32_t fID; +}; + +#endif // SkUniquePaintParamsID_DEFINED |