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

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

Issue 941523002: Rename: background_is_transparent -> subpixel_rendering_enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months 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
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 8
9 #include "base/i18n/bidi_line_iterator.h" 9 #include "base/i18n/bidi_line_iterator.h"
10 #include "base/i18n/break_iterator.h" 10 #include "base/i18n/break_iterator.h"
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 internal::TextRunList* run_list = GetRunList(); 1002 internal::TextRunList* run_list = GetRunList();
1003 for (size_t i = 0; i < lines().size(); ++i) { 1003 for (size_t i = 0; i < lines().size(); ++i) {
1004 const internal::Line& line = lines()[i]; 1004 const internal::Line& line = lines()[i];
1005 const Vector2d origin = GetLineOffset(i) + Vector2d(0, line.baseline); 1005 const Vector2d origin = GetLineOffset(i) + Vector2d(0, line.baseline);
1006 SkScalar preceding_segment_widths = 0; 1006 SkScalar preceding_segment_widths = 0;
1007 for (const internal::LineSegment& segment : line.segments) { 1007 for (const internal::LineSegment& segment : line.segments) {
1008 const internal::TextRunHarfBuzz& run = *run_list->runs()[segment.run]; 1008 const internal::TextRunHarfBuzz& run = *run_list->runs()[segment.run];
1009 renderer.SetTypeface(run.skia_face.get()); 1009 renderer.SetTypeface(run.skia_face.get());
1010 renderer.SetTextSize(SkIntToScalar(run.font_size)); 1010 renderer.SetTextSize(SkIntToScalar(run.font_size));
1011 renderer.SetFontRenderParams(run.render_params, 1011 renderer.SetFontRenderParams(run.render_params,
1012 background_is_transparent()); 1012 subpixel_rendering_enabled());
1013 Range glyphs_range = run.CharRangeToGlyphRange(segment.char_range); 1013 Range glyphs_range = run.CharRangeToGlyphRange(segment.char_range);
1014 scoped_ptr<SkPoint[]> positions(new SkPoint[glyphs_range.length()]); 1014 scoped_ptr<SkPoint[]> positions(new SkPoint[glyphs_range.length()]);
1015 SkScalar offset_x = 1015 SkScalar offset_x =
1016 preceding_segment_widths - run.positions[glyphs_range.start()].x(); 1016 preceding_segment_widths - run.positions[glyphs_range.start()].x();
1017 for (size_t j = 0; j < glyphs_range.length(); ++j) { 1017 for (size_t j = 0; j < glyphs_range.length(); ++j) {
1018 positions[j] = run.positions[(glyphs_range.is_reversed()) ? 1018 positions[j] = run.positions[(glyphs_range.is_reversed()) ?
1019 (glyphs_range.start() - j) : 1019 (glyphs_range.start() - j) :
1020 (glyphs_range.start() + j)]; 1020 (glyphs_range.start() + j)];
1021 positions[j].offset(SkIntToScalar(origin.x()) + offset_x, 1021 positions[j].offset(SkIntToScalar(origin.x()) + offset_x,
1022 SkIntToScalar(origin.y())); 1022 SkIntToScalar(origin.y()));
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 run->family = font_family; 1290 run->family = font_family;
1291 run->render_params = params; 1291 run->render_params = params;
1292 1292
1293 // TODO(vadimt): Remove ScopedTracker below once crbug.com/431326 is fixed. 1293 // TODO(vadimt): Remove ScopedTracker below once crbug.com/431326 is fixed.
1294 tracked_objects::ScopedTracker tracking_profile01( 1294 tracked_objects::ScopedTracker tracking_profile01(
1295 FROM_HERE_WITH_EXPLICIT_FUNCTION( 1295 FROM_HERE_WITH_EXPLICIT_FUNCTION(
1296 "431326 RenderTextHarfBuzz::ShapeRunWithFont01")); 1296 "431326 RenderTextHarfBuzz::ShapeRunWithFont01"));
1297 1297
1298 hb_font_t* harfbuzz_font = CreateHarfBuzzFont( 1298 hb_font_t* harfbuzz_font = CreateHarfBuzzFont(
1299 run->skia_face.get(), SkIntToScalar(run->font_size), run->render_params, 1299 run->skia_face.get(), SkIntToScalar(run->font_size), run->render_params,
1300 background_is_transparent()); 1300 subpixel_rendering_enabled());
1301 1301
1302 // TODO(vadimt): Remove ScopedTracker below once crbug.com/431326 is fixed. 1302 // TODO(vadimt): Remove ScopedTracker below once crbug.com/431326 is fixed.
1303 tracked_objects::ScopedTracker tracking_profile1( 1303 tracked_objects::ScopedTracker tracking_profile1(
1304 FROM_HERE_WITH_EXPLICIT_FUNCTION( 1304 FROM_HERE_WITH_EXPLICIT_FUNCTION(
1305 "431326 RenderTextHarfBuzz::ShapeRunWithFont1")); 1305 "431326 RenderTextHarfBuzz::ShapeRunWithFont1"));
1306 1306
1307 // Create a HarfBuzz buffer and add the string to be shaped. The HarfBuzz 1307 // Create a HarfBuzz buffer and add the string to be shaped. The HarfBuzz
1308 // buffer holds our text, run information to be used by the shaping engine, 1308 // buffer holds our text, run information to be used by the shaping engine,
1309 // and the resulting glyph data. 1309 // and the resulting glyph data.
1310 hb_buffer_t* buffer = hb_buffer_create(); 1310 hb_buffer_t* buffer = hb_buffer_create();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 DCHECK(!update_layout_run_list_); 1457 DCHECK(!update_layout_run_list_);
1458 DCHECK(!update_display_run_list_); 1458 DCHECK(!update_display_run_list_);
1459 return text_elided() ? display_run_list_.get() : &layout_run_list_; 1459 return text_elided() ? display_run_list_.get() : &layout_run_list_;
1460 } 1460 }
1461 1461
1462 const internal::TextRunList* RenderTextHarfBuzz::GetRunList() const { 1462 const internal::TextRunList* RenderTextHarfBuzz::GetRunList() const {
1463 return const_cast<RenderTextHarfBuzz*>(this)->GetRunList(); 1463 return const_cast<RenderTextHarfBuzz*>(this)->GetRunList();
1464 } 1464 }
1465 1465
1466 } // namespace gfx 1466 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698