Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(719)

Side by Side Diff: ui/gfx/render_text_harfbuzz.cc

Issue 707013004: Fix clipping RenderTextHarfBuzz text on Windows 8. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Round run widths without subpixel positioning on Windows too. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/gfx/render_text_harfbuzz.h" 5 #include "ui/gfx/render_text_harfbuzz.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <map> 8 #include <map>
9 9
10 #include "base/i18n/bidi_line_iterator.h" 10 #include "base/i18n/bidi_line_iterator.h"
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 run->positions.reset(new SkPoint[run->glyph_count]); 1199 run->positions.reset(new SkPoint[run->glyph_count]);
1200 run->width = 0.0f; 1200 run->width = 0.0f;
1201 for (size_t i = 0; i < run->glyph_count; ++i) { 1201 for (size_t i = 0; i < run->glyph_count; ++i) {
1202 DCHECK_LE(infos[i].codepoint, std::numeric_limits<uint16>::max()); 1202 DCHECK_LE(infos[i].codepoint, std::numeric_limits<uint16>::max());
1203 run->glyphs[i] = static_cast<uint16>(infos[i].codepoint); 1203 run->glyphs[i] = static_cast<uint16>(infos[i].codepoint);
1204 run->glyph_to_char[i] = infos[i].cluster; 1204 run->glyph_to_char[i] = infos[i].cluster;
1205 const SkScalar x_offset = SkFixedToScalar(hb_positions[i].x_offset); 1205 const SkScalar x_offset = SkFixedToScalar(hb_positions[i].x_offset);
1206 const SkScalar y_offset = SkFixedToScalar(hb_positions[i].y_offset); 1206 const SkScalar y_offset = SkFixedToScalar(hb_positions[i].y_offset);
1207 run->positions[i].set(run->width + x_offset, -y_offset); 1207 run->positions[i].set(run->width + x_offset, -y_offset);
1208 run->width += SkFixedToScalar(hb_positions[i].x_advance); 1208 run->width += SkFixedToScalar(hb_positions[i].x_advance);
1209 #if defined(OS_LINUX) 1209 // Round run widths if subpixel positioning is off to match native behavior.
1210 // Match Pango's glyph rounding logic on Linux.
1211 if (!run->render_params.subpixel_positioning) 1210 if (!run->render_params.subpixel_positioning)
1212 run->width = std::floor(run->width + 0.5f); 1211 run->width = std::floor(run->width + 0.5f);
1213 #endif
1214 } 1212 }
1215 1213
1216 hb_buffer_destroy(buffer); 1214 hb_buffer_destroy(buffer);
1217 hb_font_destroy(harfbuzz_font); 1215 hb_font_destroy(harfbuzz_font);
1218 return true; 1216 return true;
1219 } 1217 }
1220 1218
1221 } // namespace gfx 1219 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698