OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 SkTextBlob_DEFINED | 8 #ifndef SkTextBlob_DEFINED |
9 #define SkTextBlob_DEFINED | 9 #define SkTextBlob_DEFINED |
10 | 10 |
11 #include "SkPaint.h" | 11 #include "SkPaint.h" |
12 #include "SkRefCnt.h" | 12 #include "SkRefCnt.h" |
13 #include "SkTArray.h" | 13 #include "SkTArray.h" |
14 #include "SkTDArray.h" | 14 #include "SkTDArray.h" |
15 | 15 |
| 16 class SkReadBuffer; |
| 17 class SkWriteBuffer; |
| 18 |
16 /** \class SkTextBlob | 19 /** \class SkTextBlob |
17 | 20 |
18 SkTextBlob combines multiple text runs into an immutable, ref-counted struct
ure. | 21 SkTextBlob combines multiple text runs into an immutable, ref-counted struct
ure. |
19 */ | 22 */ |
20 class SkTextBlob : public SkRefCnt { | 23 class SkTextBlob : public SkRefCnt { |
21 public: | 24 public: |
22 /** | 25 /** |
23 * Returns the blob bounding box. | 26 * Returns the blob bounding box. |
24 */ | 27 */ |
25 const SkRect& bounds() const { return fBounds; } | 28 const SkRect& bounds() const { return fBounds; } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 uint32_t count; | 63 uint32_t count; |
61 uint32_t glyphStart; // index into fGlyphBuffer | 64 uint32_t glyphStart; // index into fGlyphBuffer |
62 uint32_t posStart; // index into fPosBuffer | 65 uint32_t posStart; // index into fPosBuffer |
63 SkPoint offset; // run offset (unsued for fully positioned
glyphs) | 66 SkPoint offset; // run offset (unsued for fully positioned
glyphs) |
64 SkPaint font; | 67 SkPaint font; |
65 GlyphPositioning positioning; | 68 GlyphPositioning positioning; |
66 }; | 69 }; |
67 | 70 |
68 SkTextBlob(uint16_t* glyphs, SkScalar* pos, const SkTArray<Run>* runs, const
SkRect& bounds); | 71 SkTextBlob(uint16_t* glyphs, SkScalar* pos, const SkTArray<Run>* runs, const
SkRect& bounds); |
69 | 72 |
| 73 void flatten(SkWriteBuffer&) const; |
| 74 static const SkTextBlob* CreateFromBuffer(SkReadBuffer&); |
| 75 |
| 76 static unsigned ScalarsPerGlyph(GlyphPositioning pos); |
| 77 |
70 friend class SkCanvas; | 78 friend class SkCanvas; |
| 79 friend class SkPictureData; |
71 friend class SkTextBlobBuilder; | 80 friend class SkTextBlobBuilder; |
72 friend class TextBlobTester; | 81 friend class TextBlobTester; |
73 | 82 |
74 const SkAutoTMalloc<uint16_t> fGlyphBuffer; | 83 const SkAutoTMalloc<uint16_t> fGlyphBuffer; |
75 const SkAutoTMalloc<SkScalar> fPosBuffer; | 84 const SkAutoTMalloc<SkScalar> fPosBuffer; |
76 | 85 |
77 // SkTArray required here for run font destruction. | 86 // SkTArray required here for run font destruction. |
78 SkAutoTDelete<const SkTArray<Run> > fRuns; | 87 SkAutoTDelete<const SkTArray<Run> > fRuns; |
79 const SkRect fBounds; | 88 const SkRect fBounds; |
80 | 89 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 SkTDArray<SkScalar> fPosBuffer; | 180 SkTDArray<SkScalar> fPosBuffer; |
172 SkTArray<SkTextBlob::Run>* fRuns; | 181 SkTArray<SkTextBlob::Run>* fRuns; |
173 | 182 |
174 SkRect fBounds; | 183 SkRect fBounds; |
175 bool fDeferredBounds; | 184 bool fDeferredBounds; |
176 | 185 |
177 RunBuffer fCurrentRunBuffer; | 186 RunBuffer fCurrentRunBuffer; |
178 }; | 187 }; |
179 | 188 |
180 #endif // SkTextBlob_DEFINED | 189 #endif // SkTextBlob_DEFINED |
OLD | NEW |