| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/fonts/shaping/ShapeResultBloberizer.h" | 5 #include "platform/fonts/shaping/ShapeResultBloberizer.h" |
| 6 | 6 |
| 7 #include <hb.h> | 7 #include <hb.h> |
| 8 #include "platform/fonts/Font.h" | 8 #include "platform/fonts/Font.h" |
| 9 #include "platform/fonts/shaping/CachingWordShaper.h" | 9 #include "platform/fonts/shaping/CachingWordShaper.h" |
| 10 #include "platform/fonts/shaping/ShapeResult.h" | 10 #include "platform/fonts/shaping/ShapeResult.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 float ShapeResultBloberizer::FillFastHorizontalGlyphs( | 284 float ShapeResultBloberizer::FillFastHorizontalGlyphs( |
| 285 const ShapeResultBuffer& result_buffer, | 285 const ShapeResultBuffer& result_buffer, |
| 286 TextDirection text_direction) { | 286 TextDirection text_direction) { |
| 287 DCHECK(!result_buffer.HasVerticalOffsets()); | 287 DCHECK(!result_buffer.HasVerticalOffsets()); |
| 288 DCHECK_NE(GetType(), ShapeResultBloberizer::Type::kTextIntercepts); | 288 DCHECK_NE(GetType(), ShapeResultBloberizer::Type::kTextIntercepts); |
| 289 | 289 |
| 290 float advance = 0; | 290 float advance = 0; |
| 291 auto results = result_buffer.results_; | 291 auto results = result_buffer.results_; |
| 292 | 292 |
| 293 for (unsigned i = 0; i < results.size(); ++i) { | 293 for (unsigned i = 0; i < results.size(); ++i) { |
| 294 const auto& word_result = IsLeftToRightDirection(text_direction) | 294 const auto& word_result = |
| 295 ? results[i] | 295 IsLtr(text_direction) ? results[i] : results[results.size() - 1 - i]; |
| 296 : results[results.size() - 1 - i]; | |
| 297 advance = FillFastHorizontalGlyphs(word_result.Get(), advance); | 296 advance = FillFastHorizontalGlyphs(word_result.Get(), advance); |
| 298 } | 297 } |
| 299 | 298 |
| 300 return advance; | 299 return advance; |
| 301 } | 300 } |
| 302 | 301 |
| 303 float ShapeResultBloberizer::FillFastHorizontalGlyphs( | 302 float ShapeResultBloberizer::FillFastHorizontalGlyphs( |
| 304 const ShapeResult* shape_result, | 303 const ShapeResult* shape_result, |
| 305 float advance) { | 304 float advance) { |
| 306 DCHECK(!shape_result->HasVerticalOffsets()); | 305 DCHECK(!shape_result->HasVerticalOffsets()); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 advance_so_far += glyph_advance_x; | 407 advance_so_far += glyph_advance_x; |
| 409 } | 408 } |
| 410 cluster_start = cluster_end; | 409 cluster_start = cluster_end; |
| 411 cluster_advance = 0; | 410 cluster_advance = 0; |
| 412 } | 411 } |
| 413 } | 412 } |
| 414 return advance_so_far - initial_advance; | 413 return advance_so_far - initial_advance; |
| 415 } | 414 } |
| 416 | 415 |
| 417 } // namespace blink | 416 } // namespace blink |
| OLD | NEW |