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

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

Issue 2236013002: update textblob api to use sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | « include/core/SkCanvas.h ('k') | src/core/SkTextBlob.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 25 matching lines...) Expand all
36 */ 36 */
37 void flatten(SkWriteBuffer&) const; 37 void flatten(SkWriteBuffer&) const;
38 38
39 /** 39 /**
40 * Recreate an SkTextBlob that was serialized into a buffer. 40 * Recreate an SkTextBlob that was serialized into a buffer.
41 * 41 *
42 * @param SkReadBuffer Serialized blob data. 42 * @param SkReadBuffer Serialized blob data.
43 * @return A new SkTextBlob representing the serialized data, or NULL if th e buffer is 43 * @return A new SkTextBlob representing the serialized data, or NULL if th e buffer is
44 * invalid. 44 * invalid.
45 */ 45 */
46 static const SkTextBlob* CreateFromBuffer(SkReadBuffer&); 46 static sk_sp<SkTextBlob> MakeFromBuffer(SkReadBuffer&);
47
48 static const SkTextBlob* CreateFromBuffer(SkReadBuffer& buffer) {
49 return MakeFromBuffer(buffer).release();
50 }
47 51
48 enum GlyphPositioning { 52 enum GlyphPositioning {
49 kDefault_Positioning = 0, // Default glyph advances -- zero scalars per glyph. 53 kDefault_Positioning = 0, // Default glyph advances -- zero scalars per glyph.
50 kHorizontal_Positioning = 1, // Horizontal positioning -- one scalar p er glyph. 54 kHorizontal_Positioning = 1, // Horizontal positioning -- one scalar p er glyph.
51 kFull_Positioning = 2 // Point positioning -- two scalars per g lyph. 55 kFull_Positioning = 2 // Point positioning -- two scalars per g lyph.
52 }; 56 };
53 57
54 private: 58 private:
55 friend class SkNVRefCnt<SkTextBlob>; 59 friend class SkNVRefCnt<SkTextBlob>;
56 class RunRecord; 60 class RunRecord;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 class SK_API SkTextBlobBuilder { 96 class SK_API SkTextBlobBuilder {
93 public: 97 public:
94 SkTextBlobBuilder(); 98 SkTextBlobBuilder();
95 99
96 ~SkTextBlobBuilder(); 100 ~SkTextBlobBuilder();
97 101
98 /** 102 /**
99 * Returns an immutable SkTextBlob for the current runs/glyphs. The builder is reset and 103 * Returns an immutable SkTextBlob for the current runs/glyphs. The builder is reset and
100 * can be reused. 104 * can be reused.
101 */ 105 */
102 const SkTextBlob* build(); 106 sk_sp<SkTextBlob> make();
107
108 const SkTextBlob* build() {
109 return this->make().release();
110 }
103 111
104 /** 112 /**
105 * Glyph and position buffers associated with a run. 113 * Glyph and position buffers associated with a run.
106 * 114 *
107 * A run is a sequence of glyphs sharing the same font metrics and position ing mode. 115 * A run is a sequence of glyphs sharing the same font metrics and position ing mode.
108 */ 116 */
109 struct RunBuffer { 117 struct RunBuffer {
110 SkGlyphID* glyphs; 118 SkGlyphID* glyphs;
111 SkScalar* pos; 119 SkScalar* pos;
112 }; 120 };
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 183
176 SkRect fBounds; 184 SkRect fBounds;
177 int fRunCount; 185 int fRunCount;
178 bool fDeferredBounds; 186 bool fDeferredBounds;
179 size_t fLastRun; // index into fStorage 187 size_t fLastRun; // index into fStorage
180 188
181 RunBuffer fCurrentRunBuffer; 189 RunBuffer fCurrentRunBuffer;
182 }; 190 };
183 191
184 #endif // SkTextBlob_DEFINED 192 #endif // SkTextBlob_DEFINED
OLDNEW
« no previous file with comments | « include/core/SkCanvas.h ('k') | src/core/SkTextBlob.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698