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_DEFINED | 8 #ifndef SkRemote_DEFINED |
9 #define SkRemote_DEFINED | 9 #define SkRemote_DEFINED |
10 | 10 |
11 #include "SkPaint.h" | 11 #include "SkPaint.h" |
12 #include "SkRegion.h" | 12 #include "SkRegion.h" |
13 #include "SkRemote_protocol.h" | 13 #include "SkRemote_protocol.h" |
14 #include "SkTypes.h" | 14 #include "SkTypes.h" |
15 | 15 |
16 class SkCanvas; | 16 class SkCanvas; |
17 class SkMatrix; | 17 class SkMatrix; |
18 class SkPath; | 18 class SkPath; |
19 class SkShader; | 19 class SkShader; |
| 20 class SkTextBlob; |
20 class SkXfermode; | 21 class SkXfermode; |
21 | 22 |
22 // TODO: document | 23 // TODO: document |
23 | 24 |
24 namespace SkRemote { | 25 namespace SkRemote { |
25 | 26 |
26 // General purpose identifier. Holds a Type and a 56-bit value. | 27 // General purpose identifier. Holds a Type and a 56-bit value. |
27 class ID { | 28 class ID { |
28 public: | 29 public: |
29 ID() {} | 30 ID() {} |
(...skipping 28 matching lines...) Expand all Loading... |
58 SkPaint::Join fJoin; | 59 SkPaint::Join fJoin; |
59 | 60 |
60 static Stroke CreateFrom(const SkPaint&); | 61 static Stroke CreateFrom(const SkPaint&); |
61 void applyTo(SkPaint*) const; | 62 void applyTo(SkPaint*) const; |
62 }; | 63 }; |
63 | 64 |
64 // TODO: document | 65 // TODO: document |
65 struct Encoder { | 66 struct Encoder { |
66 virtual ~Encoder() {} | 67 virtual ~Encoder() {} |
67 | 68 |
68 virtual ID define(const SkMatrix&) = 0; | 69 virtual ID define(const SkMatrix&) = 0; |
69 virtual ID define(const Misc&) = 0; | 70 virtual ID define(const Misc&) = 0; |
70 virtual ID define(const SkPath&) = 0; | 71 virtual ID define(const SkPath&) = 0; |
71 virtual ID define(const Stroke&) = 0; | 72 virtual ID define(const Stroke&) = 0; |
72 virtual ID define(SkPathEffect*) = 0; | 73 virtual ID define(const SkTextBlob*) = 0; |
73 virtual ID define(SkShader*) = 0; | 74 virtual ID define(SkPathEffect*) = 0; |
74 virtual ID define(SkXfermode*) = 0; | 75 virtual ID define(SkShader*) = 0; |
75 virtual ID define(SkMaskFilter*) = 0; | 76 virtual ID define(SkXfermode*) = 0; |
76 virtual ID define(SkColorFilter*) = 0; | 77 virtual ID define(SkMaskFilter*) = 0; |
77 virtual ID define(SkRasterizer*) = 0; | 78 virtual ID define(SkColorFilter*) = 0; |
78 virtual ID define(SkDrawLooper*) = 0; | 79 virtual ID define(SkRasterizer*) = 0; |
79 virtual ID define(SkImageFilter*) = 0; | 80 virtual ID define(SkDrawLooper*) = 0; |
80 virtual ID define(SkAnnotation*) = 0; | 81 virtual ID define(SkImageFilter*) = 0; |
| 82 virtual ID define(SkAnnotation*) = 0; |
81 | 83 |
82 virtual void undefine(ID) = 0; | 84 virtual void undefine(ID) = 0; |
83 | 85 |
84 // TODO: do these all belong here in CommonIDs? | 86 // TODO: do these all belong here in CommonIDs? |
85 struct CommonIDs { | 87 struct CommonIDs { |
86 ID misc, patheffect, shader, xfermode, maskfilter, | 88 ID misc, patheffect, shader, xfermode, maskfilter, |
87 colorfilter, rasterizer, looper, imagefilter, annotation; | 89 colorfilter, rasterizer, looper, imagefilter, annotation; |
88 }; | 90 }; |
89 | 91 |
90 virtual void save() = 0; | 92 virtual void save() = 0; |
91 virtual void restore() = 0; | 93 virtual void restore() = 0; |
92 virtual void saveLayer(ID bounds, CommonIDs, SkCanvas::SaveFlags) = 0; | 94 virtual void saveLayer(ID bounds, CommonIDs, SkCanvas::SaveFlags) = 0; |
93 | 95 |
94 virtual void setMatrix(ID matrix) = 0; | 96 virtual void setMatrix(ID matrix) = 0; |
95 | 97 |
96 virtual void clipPath(ID path, SkRegion::Op, bool aa) = 0; | 98 virtual void clipPath(ID path, SkRegion::Op, bool aa) = 0; |
97 virtual void fillPath(ID path, CommonIDs) = 0; | 99 virtual void fillPath(ID path, CommonIDs) = 0; |
98 virtual void strokePath(ID path, CommonIDs, ID stroke) = 0; | 100 virtual void strokePath(ID path, CommonIDs, ID stroke) = 0; |
| 101 virtual void fillText(ID text, SkPoint, CommonIDs) = 0; |
| 102 virtual void strokeText(ID text, SkPoint, CommonIDs, ID stroke) = 0; |
99 }; | 103 }; |
100 | 104 |
101 // None of these factories take ownership of their arguments. | 105 // None of these factories take ownership of their arguments. |
102 | 106 |
103 // Returns a new SkCanvas that translates to the Encoder API. | 107 // Returns a new SkCanvas that translates to the Encoder API. |
104 SkCanvas* NewCanvas(Encoder*); | 108 SkCanvas* NewCanvas(Encoder*); |
105 // Returns an Encoder that translates back to the SkCanvas API. | 109 // Returns an Encoder that translates back to the SkCanvas API. |
106 Encoder* NewDecoder(SkCanvas*); | 110 Encoder* NewDecoder(SkCanvas*); |
107 // Wraps another Encoder with a cache. TODO: parameterize | 111 // Wraps another Encoder with a cache. TODO: parameterize |
108 Encoder* NewCachingEncoder(Encoder*); | 112 Encoder* NewCachingEncoder(Encoder*); |
109 | 113 |
110 } // namespace SkRemote | 114 } // namespace SkRemote |
111 | 115 |
112 #endif//SkRemote_DEFINED | 116 #endif//SkRemote_DEFINED |
OLD | NEW |