Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
|
robertphillips
2016/05/06 15:09:00
space these over 1 ?
egdaniel
2016/05/06 17:08:00
Done.
| |
| 2 * Copyright 2016 Google Inc. | |
| 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 #include "SkTypes.h" | |
| 9 | |
| 10 #ifndef GrResourceHandle_DEFINED | |
| 11 #define GrResourcehandle_DEFINED | |
| 12 | |
| 13 // Opaque handle to a resource | |
| 14 class GrResourceHandle { | |
| 15 public: | |
| 16 GrResourceHandle(int value) | |
| 17 : fValue(value) { | |
| 18 SkASSERT(this->isValid()); | |
| 19 } | |
| 20 | |
|
robertphillips
2016/05/06 15:09:00
1 line ?
egdaniel
2016/05/06 17:08:00
Done.
| |
| 21 GrResourceHandle() | |
| 22 : fValue(kInvalid_ResourceHandle) { | |
| 23 } | |
| 24 | |
| 25 bool operator==(const GrResourceHandle& other) const { return other.fValue = = fValue; } | |
| 26 bool isValid() const { return kInvalid_ResourceHandle != fValue; } | |
| 27 int toIndex() const { SkASSERT(this->isValid()); return fValue; } | |
| 28 | |
| 29 private: | |
| 30 static const int kInvalid_ResourceHandle = -1; | |
| 31 int fValue; | |
| 32 }; | |
| 33 | |
| 34 #endif | |
| OLD | NEW |