OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. | 3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 void ShapeResult::ApplySpacing(ShapeResultSpacing<String>& spacing, | 359 void ShapeResult::ApplySpacing(ShapeResultSpacing<String>& spacing, |
360 TextDirection direction) { | 360 TextDirection direction) { |
361 ApplySpacing(spacing, spacing.Text(), IsRtl(direction)); | 361 ApplySpacing(spacing, spacing.Text(), IsRtl(direction)); |
362 } | 362 } |
363 | 363 |
364 PassRefPtr<ShapeResult> ShapeResult::ApplySpacingToCopy( | 364 PassRefPtr<ShapeResult> ShapeResult::ApplySpacingToCopy( |
365 ShapeResultSpacing<TextRun>& spacing, | 365 ShapeResultSpacing<TextRun>& spacing, |
366 const TextRun& run) const { | 366 const TextRun& run) const { |
367 RefPtr<ShapeResult> result = ShapeResult::Create(*this); | 367 RefPtr<ShapeResult> result = ShapeResult::Create(*this); |
368 result->ApplySpacing(spacing, run, run.Rtl()); | 368 result->ApplySpacing(spacing, run, run.Rtl()); |
369 return result.Release(); | 369 return result; |
370 } | 370 } |
371 | 371 |
372 static inline float HarfBuzzPositionToFloat(hb_position_t value) { | 372 static inline float HarfBuzzPositionToFloat(hb_position_t value) { |
373 return static_cast<float>(value) / (1 << 16); | 373 return static_cast<float>(value) / (1 << 16); |
374 } | 374 } |
375 | 375 |
376 void ShapeResult::InsertRun(std::unique_ptr<ShapeResult::RunInfo> run_to_insert, | 376 void ShapeResult::InsertRun(std::unique_ptr<ShapeResult::RunInfo> run_to_insert, |
377 unsigned start_glyph, | 377 unsigned start_glyph, |
378 unsigned num_glyphs, | 378 unsigned num_glyphs, |
379 hb_buffer_t* harf_buzz_buffer) { | 379 hb_buffer_t* harf_buzz_buffer) { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 run->width_ = position - start_position; | 504 run->width_ = position - start_position; |
505 | 505 |
506 RefPtr<ShapeResult> result = | 506 RefPtr<ShapeResult> result = |
507 ShapeResult::Create(font, count, text_run.Direction()); | 507 ShapeResult::Create(font, count, text_run.Direction()); |
508 result->width_ = run->width_; | 508 result->width_ = run->width_; |
509 result->num_glyphs_ = count; | 509 result->num_glyphs_ = count; |
510 DCHECK_EQ(result->num_glyphs_, count); // no overflow | 510 DCHECK_EQ(result->num_glyphs_, count); // no overflow |
511 result->has_vertical_offsets_ = | 511 result->has_vertical_offsets_ = |
512 font_data->PlatformData().IsVerticalAnyUpright(); | 512 font_data->PlatformData().IsVerticalAnyUpright(); |
513 result->runs_.push_back(std::move(run)); | 513 result->runs_.push_back(std::move(run)); |
514 return result.Release(); | 514 return result; |
515 } | 515 } |
516 | 516 |
517 } // namespace blink | 517 } // namespace blink |
OLD | NEW |