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

Side by Side Diff: include/core/SkTextBlob.h

Issue 511783005: SkTextBlob GPipe serialization. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: review comments Created 6 years, 3 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
« no previous file with comments | « no previous file | src/pipe/SkGPipeRead.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 14 matching lines...) Expand all
25 /** 25 /**
26 * Returns the blob bounding box. 26 * Returns the blob bounding box.
27 */ 27 */
28 const SkRect& bounds() const { return fBounds; } 28 const SkRect& bounds() const { return fBounds; }
29 29
30 /** 30 /**
31 * Return a non-zero, unique value representing the text blob. 31 * Return a non-zero, unique value representing the text blob.
32 */ 32 */
33 uint32_t uniqueID() const; 33 uint32_t uniqueID() const;
34 34
35 /**
36 * Serialize to a buffer.
37 */
38 void flatten(SkWriteBuffer&) const;
39
40 /**
41 * Recreate an SkTextBlob that was serialized into a buffer.
42 *
43 * @param SkReadBuffer Serialized blob data.
44 * @return A new SkTextBlob representing the serialized data, or NULL if th e buffer is
45 * invalid.
46 */
47 static const SkTextBlob* CreateFromBuffer(SkReadBuffer&);
48
35 private: 49 private:
36 enum GlyphPositioning { 50 enum GlyphPositioning {
37 kDefault_Positioning = 0, // Default glyph advances -- zero scalars per glyph. 51 kDefault_Positioning = 0, // Default glyph advances -- zero scalars per glyph.
38 kHorizontal_Positioning = 1, // Horizontal positioning -- one scalar p er glyph. 52 kHorizontal_Positioning = 1, // Horizontal positioning -- one scalar p er glyph.
39 kFull_Positioning = 2 // Point positioning -- two scalars per g lyph. 53 kFull_Positioning = 2 // Point positioning -- two scalars per g lyph.
40 }; 54 };
41 55
42 class RunIterator { 56 class RunIterator {
43 public: 57 public:
44 RunIterator(const SkTextBlob* blob); 58 RunIterator(const SkTextBlob* blob);
(...skipping 18 matching lines...) Expand all
63 uint32_t count; 77 uint32_t count;
64 uint32_t glyphStart; // index into fGlyphBuffer 78 uint32_t glyphStart; // index into fGlyphBuffer
65 uint32_t posStart; // index into fPosBuffer 79 uint32_t posStart; // index into fPosBuffer
66 SkPoint offset; // run offset (unsued for fully positioned glyphs) 80 SkPoint offset; // run offset (unsued for fully positioned glyphs)
67 SkPaint font; 81 SkPaint font;
68 GlyphPositioning positioning; 82 GlyphPositioning positioning;
69 }; 83 };
70 84
71 SkTextBlob(uint16_t* glyphs, SkScalar* pos, const SkTArray<Run>* runs, const SkRect& bounds); 85 SkTextBlob(uint16_t* glyphs, SkScalar* pos, const SkTArray<Run>* runs, const SkRect& bounds);
72 86
73 void flatten(SkWriteBuffer&) const;
74 static const SkTextBlob* CreateFromBuffer(SkReadBuffer&);
75
76 static unsigned ScalarsPerGlyph(GlyphPositioning pos); 87 static unsigned ScalarsPerGlyph(GlyphPositioning pos);
77 88
78 friend class SkCanvas; 89 friend class SkCanvas;
79 friend class SkPictureData;
80 friend class SkTextBlobBuilder; 90 friend class SkTextBlobBuilder;
81 friend class TextBlobTester; 91 friend class TextBlobTester;
82 92
83 const SkAutoTMalloc<uint16_t> fGlyphBuffer; 93 const SkAutoTMalloc<uint16_t> fGlyphBuffer;
84 const SkAutoTMalloc<SkScalar> fPosBuffer; 94 const SkAutoTMalloc<SkScalar> fPosBuffer;
85 95
86 // SkTArray required here for run font destruction. 96 // SkTArray required here for run font destruction.
87 SkAutoTDelete<const SkTArray<Run> > fRuns; 97 SkAutoTDelete<const SkTArray<Run> > fRuns;
88 const SkRect fBounds; 98 const SkRect fBounds;
89 99
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 SkTDArray<SkScalar> fPosBuffer; 190 SkTDArray<SkScalar> fPosBuffer;
181 SkTArray<SkTextBlob::Run>* fRuns; 191 SkTArray<SkTextBlob::Run>* fRuns;
182 192
183 SkRect fBounds; 193 SkRect fBounds;
184 bool fDeferredBounds; 194 bool fDeferredBounds;
185 195
186 RunBuffer fCurrentRunBuffer; 196 RunBuffer fCurrentRunBuffer;
187 }; 197 };
188 198
189 #endif // SkTextBlob_DEFINED 199 #endif // SkTextBlob_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/pipe/SkGPipeRead.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698