Index: src/gpu/GrResourceHandle.h |
diff --git a/src/gpu/GrResourceHandle.h b/src/gpu/GrResourceHandle.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6c5f981b19ebcac0543bdae178cf0c5899eda808 |
--- /dev/null |
+++ b/src/gpu/GrResourceHandle.h |
@@ -0,0 +1,34 @@ |
+/* |
robertphillips
2016/05/06 15:09:00
space these over 1 ?
egdaniel
2016/05/06 17:08:00
Done.
|
+* Copyright 2016 Google Inc. |
+* |
+* Use of this source code is governed by a BSD-style license that can be |
+* found in the LICENSE file. |
+*/ |
+ |
+#include "SkTypes.h" |
+ |
+#ifndef GrResourceHandle_DEFINED |
+#define GrResourcehandle_DEFINED |
+ |
+// Opaque handle to a resource |
+class GrResourceHandle { |
+public: |
+ GrResourceHandle(int value) |
+ : fValue(value) { |
+ SkASSERT(this->isValid()); |
+ } |
+ |
robertphillips
2016/05/06 15:09:00
1 line ?
egdaniel
2016/05/06 17:08:00
Done.
|
+ GrResourceHandle() |
+ : fValue(kInvalid_ResourceHandle) { |
+ } |
+ |
+ bool operator==(const GrResourceHandle& other) const { return other.fValue == fValue; } |
+ bool isValid() const { return kInvalid_ResourceHandle != fValue; } |
+ int toIndex() const { SkASSERT(this->isValid()); return fValue; } |
+ |
+private: |
+ static const int kInvalid_ResourceHandle = -1; |
+ int fValue; |
+}; |
+ |
+#endif |