提交 b8cd25b4 编写于 作者: N najeira 提交者: Jason Simmons

libtxt: fix a bug that used incorrect buffer size depending on conditions (#5804)

* libtxt: fix a bug that used incorrect buffer size depending on conditions

* Update AUTHORS

* clang-format
上级 b7b13b5e
......@@ -11,3 +11,4 @@ Dan Field <dfield@gmail.com>
Victor Choueiri <victor@ctrlanddev.com>
Simon Lightfoot <simon@devangels.london>
Dwayne Slater <ds84182@gmail.com>
Tetsuhiro Ueda <najeira@gmail.com>
......@@ -504,6 +504,7 @@ void Paragraph::Layout(double width, bool force) {
uint16_t* text_ptr = text_.data();
size_t text_start = run.start();
size_t text_count = run.end() - run.start();
size_t text_size = text_.size();
// Apply ellipsizing if the run was not completely laid out and this
// is the last line (or lines are unlimited).
......@@ -541,6 +542,7 @@ void Paragraph::Layout(double width, bool force) {
text_ptr = ellipsized_text.data();
text_start = 0;
text_count = ellipsized_text.size();
text_size = text_count;
// If there is no line limit, then skip all lines after the ellipsized
// line.
......@@ -550,9 +552,8 @@ void Paragraph::Layout(double width, bool force) {
}
}
layout.doLayout(text_ptr, text_start, text_count, text_.size(),
run.is_rtl(), font, minikin_paint,
minikin_font_collection);
layout.doLayout(text_ptr, text_start, text_count, text_size, run.is_rtl(),
font, minikin_paint, minikin_font_collection);
if (layout.nGlyphs() == 0)
continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册