Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/core/SkRemote_protocol.h

Issue 1391023005: SkRemote (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/core/SkRemote.h ('K') | « src/core/SkRemote.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 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 #ifndef SkRemote_protocol_DEFINED
9 #define SkRemote_protocol_DEFINED
10
11 // ATTENTION! Changes to this file can break protocol compatibility. Tread car efully.
12
13 namespace SkRemote {
14
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.
17 enum class Type : uint8_t {
18 kNone,
19
20 kMatrix,
21 kMisc,
22 kPath,
23 kStroke,
24 };
25
26 class ID {
27 public:
28 explicit ID(Type type = Type::kNone) : fVal((uint64_t)type << 56) {}
29
30 Type type() const { return (Type)(fVal >> 56); }
31 uint64_t val() const { return fVal & ~((uint64_t)0xFF << 56); }
hal.canary 2015/10/16 16:57:55 given a type and a value, how does a decoder creat
mtklein 2015/10/16 17:20:33 I had been imagining it couldn't, but good point,
32
33 bool operator==(ID o) const { return fVal == o.fVal; }
34 ID operator++(int) {
35 ID prev = *this;
36 fVal++;
37 SkASSERT(this->val() != 0); // Overflow is particularly bad as it'd change our Type.
38 return prev;
39 }
40
41 private:
42 // High 8 bits hold a Type. Low 56 bits are unique within that Type.
43 // Any change to this format will break protocol compatibility.
44 uint64_t fVal;
45 };
46
47 } // namespace SkRemote
48
49 #endif//SkRemote_protocol_DEFINED
OLDNEW
« src/core/SkRemote.h ('K') | « src/core/SkRemote.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698