use raw wrapWidth ptr instead of Maybe
This commit is contained in:
parent
210d6326fc
commit
17af21fd42
@ -295,6 +295,7 @@ size_t StringView::findFirstNotOf(StringView pattern, size_t beg) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t StringView::findNextBoundary(size_t index, bool backwards) const {
|
size_t StringView::findNextBoundary(size_t index, bool backwards) const {
|
||||||
|
//TODO: Make this faster.
|
||||||
size_t mySize = size();
|
size_t mySize = size();
|
||||||
starAssert(index <= mySize);
|
starAssert(index <= mySize);
|
||||||
if (!backwards && (index == mySize))
|
if (!backwards && (index == mySize))
|
||||||
|
@ -206,7 +206,7 @@ int TextPainter::stringWidth(StringView s) {
|
|||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextPainter::processWrapText(StringView text, Maybe<unsigned> wrapWidth, WrapTextCallback textFunc) {
|
bool TextPainter::processWrapText(StringView text, unsigned* wrapWidth, WrapTextCallback textFunc) {
|
||||||
String font = m_renderSettings.font, setFont = font;
|
String font = m_renderSettings.font, setFont = font;
|
||||||
m_fontTextureGroup.switchFont(font);
|
m_fontTextureGroup.switchFont(font);
|
||||||
int lines = 0;
|
int lines = 0;
|
||||||
@ -351,7 +351,7 @@ List<StringView> TextPainter::wrapTextViews(StringView s, Maybe<unsigned> wrapWi
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
processWrapText(s, wrapWidth, textCallback);
|
processWrapText(s, wrapWidth.ptr(), textCallback);
|
||||||
|
|
||||||
if (active)
|
if (active)
|
||||||
views.push_back(current);
|
views.push_back(current);
|
||||||
@ -374,7 +374,7 @@ StringList TextPainter::wrapText(StringView s, Maybe<unsigned> wrapWidth) {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
processWrapText(s, wrapWidth, textCallback);
|
processWrapText(s, wrapWidth.ptr(), textCallback);
|
||||||
|
|
||||||
if (!current.empty())
|
if (!current.empty())
|
||||||
result.append(move(current));
|
result.append(move(current));
|
||||||
|
@ -68,7 +68,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
typedef function<bool(StringView, int)> WrapTextCallback;
|
typedef function<bool(StringView, int)> WrapTextCallback;
|
||||||
bool processWrapText(StringView s, Maybe<unsigned> wrapWidth, WrapTextCallback textFunc);
|
bool processWrapText(StringView s, unsigned* wrapWidth, WrapTextCallback textFunc);
|
||||||
|
|
||||||
List<StringView> wrapTextViews(StringView s, Maybe<unsigned> wrapWidth);
|
List<StringView> wrapTextViews(StringView s, Maybe<unsigned> wrapWidth);
|
||||||
StringList wrapText(StringView s, Maybe<unsigned> wrapWidth);
|
StringList wrapText(StringView s, Maybe<unsigned> wrapWidth);
|
||||||
|
Loading…
Reference in New Issue
Block a user