| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkRemote_protocol_DEFINED | 8 #ifndef SkRemote_protocol_DEFINED |
| 9 #define SkRemote_protocol_DEFINED | 9 #define SkRemote_protocol_DEFINED |
| 10 | 10 |
| 11 // ATTENTION! Changes to this file can break protocol compatibility. Tread car
efully. | 11 // ATTENTION! Changes to this file can break protocol compatibility. Tread car
efully. |
| 12 | 12 |
| 13 namespace SkRemote { | 13 namespace SkRemote { |
| 14 | 14 |
| 15 // It is safe to append to this enum without breaking protocol compatibility
. | 15 // It is safe to append to this enum without breaking protocol compatibility
. |
| 16 // Resorting, deleting, or inserting anywhere but the end will break compati
bility. | 16 // Resorting, deleting, or inserting anywhere but the end will break compati
bility. |
| 17 enum class Type : uint8_t { | 17 enum class Type : uint8_t { |
| 18 kNone, | 18 kNone, |
| 19 | 19 |
| 20 kMatrix, | 20 kMatrix, |
| 21 kMisc, | 21 kMisc, |
| 22 kPath, | 22 kPath, |
| 23 kStroke, | 23 kStroke, |
| 24 kShader, |
| 24 kXfermode, | 25 kXfermode, |
| 25 }; | 26 }; |
| 26 | 27 |
| 27 class ID { | 28 class ID { |
| 28 public: | 29 public: |
| 29 explicit ID(Type type = Type::kNone) : fVal((uint64_t)type << 56) {} | 30 explicit ID(Type type = Type::kNone) : fVal((uint64_t)type << 56) {} |
| 30 ID(Type type, uint64_t val) { | 31 ID(Type type, uint64_t val) { |
| 31 fVal = (uint64_t)type << 56 | val; | 32 fVal = (uint64_t)type << 56 | val; |
| 32 SkASSERT(this->type() == type && this->val() == val); | 33 SkASSERT(this->type() == type && this->val() == val); |
| 33 } | 34 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 // High 8 bits hold a Type. Low 56 bits are unique within that Type. | 47 // High 8 bits hold a Type. Low 56 bits are unique within that Type. |
| 47 // Any change to this format will break protocol compatibility. | 48 // Any change to this format will break protocol compatibility. |
| 48 uint64_t fVal; | 49 uint64_t fVal; |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 } // namespace SkRemote | 52 } // namespace SkRemote |
| 52 | 53 |
| 53 #endif//SkRemote_protocol_DEFINED | 54 #endif//SkRemote_protocol_DEFINED |
| OLD | NEW |