Skip to content

Commit

Permalink
libtxt: fix a bug that used incorrect buffer size depending on condit…
Browse files Browse the repository at this point in the history
…ions (flutter#5804)

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

* Update AUTHORS

* clang-format
  • Loading branch information
najeira authored and jason-simmons committed Jul 23, 2018
1 parent b7b13b5 commit b8cd25b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ Dan Field <[email protected]>
Victor Choueiri <[email protected]>
Simon Lightfoot <[email protected]>
Dwayne Slater <[email protected]>
Tetsuhiro Ueda <[email protected]>
7 changes: 4 additions & 3 deletions third_party/txt/src/txt/paragraph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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.
Expand All @@ -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;
Expand Down

0 comments on commit b8cd25b

Please sign in to comment.