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

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

Issue 1411723005: Make SkTextBlob::RunIterator public. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-10-27 (Tuesday) 16:20:53 EDT Created 5 years, 1 month 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/core/SkDevice.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 28 matching lines...) Expand all
39 39
40 /** 40 /**
41 * Recreate an SkTextBlob that was serialized into a buffer. 41 * Recreate an SkTextBlob that was serialized into a buffer.
42 * 42 *
43 * @param SkReadBuffer Serialized blob data. 43 * @param SkReadBuffer Serialized blob data.
44 * @return A new SkTextBlob representing the serialized data, or NULL if th e buffer is 44 * @return A new SkTextBlob representing the serialized data, or NULL if th e buffer is
45 * invalid. 45 * invalid.
46 */ 46 */
47 static const SkTextBlob* CreateFromBuffer(SkReadBuffer&); 47 static const SkTextBlob* CreateFromBuffer(SkReadBuffer&);
48 48
49 private:
50 enum GlyphPositioning { 49 enum GlyphPositioning {
51 kDefault_Positioning = 0, // Default glyph advances -- zero scalars per glyph. 50 kDefault_Positioning = 0, // Default glyph advances -- zero scalars per glyph.
52 kHorizontal_Positioning = 1, // Horizontal positioning -- one scalar p er glyph. 51 kHorizontal_Positioning = 1, // Horizontal positioning -- one scalar p er glyph.
53 kFull_Positioning = 2 // Point positioning -- two scalars per g lyph. 52 kFull_Positioning = 2 // Point positioning -- two scalars per g lyph.
54 }; 53 };
55 54
55 private:
56 class RunRecord; 56 class RunRecord;
57 57
58 class RunIterator {
59 public:
60 RunIterator(const SkTextBlob* blob);
61
62 bool done() const;
63 void next();
64
65 uint32_t glyphCount() const;
66 const uint16_t* glyphs() const;
67 const SkScalar* pos() const;
68 const SkPoint& offset() const;
69 void applyFontToPaint(SkPaint*) const;
70 GlyphPositioning positioning() const;
71 bool isLCD() const;
72
73 private:
74 const RunRecord* fCurrentRun;
75 int fRemainingRuns;
76
77 SkDEBUGCODE(uint8_t* fStorageTop;)
78 };
79
80 SkTextBlob(int runCount, const SkRect& bounds); 58 SkTextBlob(int runCount, const SkRect& bounds);
81 59
82 virtual ~SkTextBlob(); 60 virtual ~SkTextBlob();
83 61
84 // Memory for objects of this class is created with sk_malloc rather than op erator new and must 62 // Memory for objects of this class is created with sk_malloc rather than op erator new and must
85 // be freed with sk_free. 63 // be freed with sk_free.
86 void operator delete(void* p) { sk_free(p); } 64 void operator delete(void* p) { sk_free(p); }
87 void* operator new(size_t) { 65 void* operator new(size_t) {
88 SkFAIL("All blobs are created by placement new."); 66 SkFAIL("All blobs are created by placement new.");
89 return sk_malloc_throw(0); 67 return sk_malloc_throw(0);
90 } 68 }
91 void* operator new(size_t, void* p) { return p; } 69 void* operator new(size_t, void* p) { return p; }
92 70
93 static unsigned ScalarsPerGlyph(GlyphPositioning pos); 71 static unsigned ScalarsPerGlyph(GlyphPositioning pos);
94 72
95 friend class GrAtlasTextContext;
96 friend class GrStencilAndCoverTextContext;
97 friend class GrTextBlobCache;
98 friend class GrTextContext;
99 friend class SkBaseDevice;
100 friend class SkTextBlobBuilder; 73 friend class SkTextBlobBuilder;
101 friend class TextBlobTester; 74 friend class SkTextBlobRunIterator;
102 75
103 const int fRunCount; 76 const int fRunCount;
104 const SkRect fBounds; 77 const SkRect fBounds;
105 const uint32_t fUniqueID; 78 const uint32_t fUniqueID;
106 79
107 SkDEBUGCODE(size_t fStorageSize;) 80 SkDEBUGCODE(size_t fStorageSize;)
108 81
109 // The actual payload resides in externally-managed storage, following the o bject. 82 // The actual payload resides in externally-managed storage, following the o bject.
110 // (see the .cpp for more details) 83 // (see the .cpp for more details)
111 84
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 175
203 SkRect fBounds; 176 SkRect fBounds;
204 int fRunCount; 177 int fRunCount;
205 bool fDeferredBounds; 178 bool fDeferredBounds;
206 size_t fLastRun; // index into fStorage 179 size_t fLastRun; // index into fStorage
207 180
208 RunBuffer fCurrentRunBuffer; 181 RunBuffer fCurrentRunBuffer;
209 }; 182 };
210 183
211 #endif // SkTextBlob_DEFINED 184 #endif // SkTextBlob_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698