OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkTextBox_DEFINED | 10 #ifndef SkTextBox_DEFINED |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 void getSpacing(SkScalar* mul, SkScalar* add) const; | 53 void getSpacing(SkScalar* mul, SkScalar* add) const; |
54 void setSpacing(SkScalar mul, SkScalar add); | 54 void setSpacing(SkScalar mul, SkScalar add); |
55 | 55 |
56 void draw(SkCanvas*, const char text[], size_t len, const SkPaint&); | 56 void draw(SkCanvas*, const char text[], size_t len, const SkPaint&); |
57 | 57 |
58 void setText(const char text[], size_t len, const SkPaint&); | 58 void setText(const char text[], size_t len, const SkPaint&); |
59 void draw(SkCanvas*); | 59 void draw(SkCanvas*); |
60 int countLines() const; | 60 int countLines() const; |
61 SkScalar getTextHeight() const; | 61 SkScalar getTextHeight() const; |
62 | 62 |
63 SkTextBlob* snapshotTextBlob(SkScalar* computedBottom) const; | 63 sk_sp<SkTextBlob> snapshotTextBlob(SkScalar* computedBottom) const; |
64 | 64 |
65 class Visitor { | 65 class Visitor { |
66 public: | 66 public: |
67 virtual ~Visitor() {} | 67 virtual ~Visitor() {} |
68 virtual void operator()(const char*, size_t, SkScalar x, SkScalar y, con
st SkPaint&) = 0; | 68 virtual void operator()(const char*, size_t, SkScalar x, SkScalar y, con
st SkPaint&) = 0; |
69 }; | 69 }; |
70 | 70 |
71 private: | 71 private: |
72 SkRect fBox; | 72 SkRect fBox; |
73 SkScalar fSpacingMul, fSpacingAdd; | 73 SkScalar fSpacingMul, fSpacingAdd; |
74 uint8_t fMode, fSpacingAlign; | 74 uint8_t fMode, fSpacingAlign; |
75 const char* fText; | 75 const char* fText; |
76 size_t fLen; | 76 size_t fLen; |
77 const SkPaint* fPaint; | 77 const SkPaint* fPaint; |
78 | 78 |
79 SkScalar visit(Visitor&, const char text[], size_t len, const SkPaint&) cons
t; | 79 SkScalar visit(Visitor&, const char text[], size_t len, const SkPaint&) cons
t; |
80 }; | 80 }; |
81 | 81 |
82 class SkTextLineBreaker { | 82 class SkTextLineBreaker { |
83 public: | 83 public: |
84 static int CountLines(const char text[], size_t len, const SkPaint&, SkScala
r width); | 84 static int CountLines(const char text[], size_t len, const SkPaint&, SkScala
r width); |
85 }; | 85 }; |
86 | 86 |
87 #endif | 87 #endif |
OLD | NEW |