Commit e5b5efa7 authored by David Quiroz Marin's avatar David Quiroz Marin Committed by Commit Bot

Fix float-cast-overflow in IndividualCharacterAdvances

Advances should be store as doubles, but the previous code
was using a float as a part of their computation.

Bug: 880169
Change-Id: I47fd70bf947c9b1e0fdb827eba69108bd938a72a
Reviewed-on: https://chromium-review.googlesource.com/1213516Reviewed-by: default avatarStephen White <senorblanco@chromium.org>
Commit-Queue: David Quiroz Marin <davidqu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590010}
parent 3b5fb84e
...@@ -200,7 +200,7 @@ Vector<CharacterRange> ShapeResultBuffer::IndividualCharacterRanges( ...@@ -200,7 +200,7 @@ Vector<CharacterRange> ShapeResultBuffer::IndividualCharacterRanges(
} }
void ShapeResultBuffer::AddRunInfoAdvances(const ShapeResult::RunInfo& run_info, void ShapeResultBuffer::AddRunInfoAdvances(const ShapeResult::RunInfo& run_info,
float offset, double offset,
Vector<double>& advances) { Vector<double>& advances) {
const unsigned num_glyphs = run_info.glyph_data_.size(); const unsigned num_glyphs = run_info.glyph_data_.size();
const unsigned num_chars = run_info.num_characters_; const unsigned num_chars = run_info.num_characters_;
...@@ -254,7 +254,7 @@ Vector<double> ShapeResultBuffer::IndividualCharacterAdvances( ...@@ -254,7 +254,7 @@ Vector<double> ShapeResultBuffer::IndividualCharacterAdvances(
float total_width) const { float total_width) const {
unsigned character_offset = 0; unsigned character_offset = 0;
Vector<double> advances; Vector<double> advances;
float current_x = direction == TextDirection::kRtl ? total_width : 0; double current_x = direction == TextDirection::kRtl ? total_width : 0;
for (const scoped_refptr<const ShapeResult> result : results_) { for (const scoped_refptr<const ShapeResult> result : results_) {
unsigned run_count = result->runs_.size(); unsigned run_count = result->runs_.size();
......
...@@ -72,7 +72,7 @@ class PLATFORM_EXPORT ShapeResultBuffer { ...@@ -72,7 +72,7 @@ class PLATFORM_EXPORT ShapeResultBuffer {
unsigned to); unsigned to);
static void AddRunInfoAdvances(const ShapeResult::RunInfo& run_info, static void AddRunInfoAdvances(const ShapeResult::RunInfo& run_info,
float offset, double offset,
Vector<double>& advances); Vector<double>& advances);
static void AddRunInfoRanges(const ShapeResult::RunInfo&, static void AddRunInfoRanges(const ShapeResult::RunInfo&,
float offset, float offset,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment