halcanary | 3377975 | 2015-10-27 14:01:05 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | #ifndef SkTextBlobRunIterator_DEFINED |
| 8 | #define SkTextBlobRunIterator_DEFINED |
| 9 | |
| 10 | #include "SkTextBlob.h" |
| 11 | |
| 12 | /** |
| 13 | * Iterate through all of the text runs of the text blob. For example: |
| 14 | * for (SkTextBlobRunIterator it(blob); !it.done(); it.next()) { |
| 15 | * ..... |
| 16 | * } |
| 17 | */ |
| 18 | class SkTextBlobRunIterator { |
| 19 | public: |
| 20 | SkTextBlobRunIterator(const SkTextBlob* blob); |
| 21 | |
| 22 | bool done() const; |
| 23 | void next(); |
| 24 | |
| 25 | uint32_t glyphCount() const; |
| 26 | const uint16_t* glyphs() const; |
| 27 | const SkScalar* pos() const; |
| 28 | const SkPoint& offset() const; |
| 29 | void applyFontToPaint(SkPaint*) const; |
| 30 | SkTextBlob::GlyphPositioning positioning() const; |
halcanary | 4f0a23a | 2016-08-30 11:58:33 -0700 | [diff] [blame] | 31 | uint32_t* clusters() const; |
| 32 | uint32_t textSize() const; |
| 33 | char* text() const; |
| 34 | |
halcanary | 3377975 | 2015-10-27 14:01:05 -0700 | [diff] [blame] | 35 | bool isLCD() const; |
| 36 | |
| 37 | private: |
| 38 | const SkTextBlob::RunRecord* fCurrentRun; |
halcanary | 3377975 | 2015-10-27 14:01:05 -0700 | [diff] [blame] | 39 | |
| 40 | SkDEBUGCODE(uint8_t* fStorageTop;) |
| 41 | }; |
| 42 | |
| 43 | #endif // SkTextBlobRunIterator_DEFINED |