cc4d21f980
Since the SkShaders, etc will need access to SkPaintParamKeys and the SkShaderCodeDictionary they can't be buried in the skgpu namespace. The currently planned signature for addToKey is: void addToKey(SkShaderCodeDictionary*, SkBackend, SkPaintParamsKey*) const; This CL doesn't modify the classes beyond what is needed to move them. Bug: skia:12701 Change-Id: I18bbf6d6c3a768427112a3d19a9ccf2d46a23ad2 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494237 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
36 lines
1.0 KiB
C++
36 lines
1.0 KiB
C++
/*
|
|
* 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
|