Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / experimental / sorttoy / sorttypes.h
1 // Copyright 2021 Google LLC.
2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3
4 #ifndef SortTypes_DEFINED
5 #define SortTypes_DEFINED
6
7 #include "include/gpu/GrTypes.h"
8
9 enum class Shape {
10     kRect,
11     kOval
12 };
13
14 // This is strictly used to check if we get the order of draw operations we expected. It is
15 // pretty much the same as painters order though.
16 class ID {
17 public:
18     explicit ID(int id) : fID(id) {
19         SkASSERT(id != -1);
20     }
21
22     static ID Invalid() {
23         return ID();
24     }
25
26     bool isValid() const { return fID != -1; }
27
28     bool operator==(ID other) const { return fID == other.fID; }
29
30     int toInt() const { return fID; }
31
32 private:
33     ID() : fID(-1) {}
34
35     int fID;
36 };
37
38 // This class just serves to strictly differentiate between painter's order and the sort/draw Zs
39 class PaintersOrder {
40 public:
41     PaintersOrder() : fPaintersOrder(0) {}
42
43     explicit PaintersOrder(uint32_t paintersOrder) : fPaintersOrder(paintersOrder) {
44         SkASSERT(paintersOrder != 0);
45     }
46
47     static PaintersOrder Invalid() {
48         return PaintersOrder();
49     }
50
51     bool isValid() const { return fPaintersOrder != 0; }
52
53     uint32_t toUInt() const { return fPaintersOrder; }
54
55 private:
56     uint32_t fPaintersOrder = 0;
57 };
58
59 #endif