OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_win.h" | 5 #include "ui/gfx/render_text_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/break_iterator.h" | 9 #include "base/i18n/break_iterator.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "ui/gfx/font_smoothing_win.h" | |
14 #include "ui/gfx/screen_compatible_dc_win.h" | 15 #include "ui/gfx/screen_compatible_dc_win.h" |
15 #include "ui/gfx/canvas.h" | 16 #include "ui/gfx/canvas.h" |
16 #include "ui/gfx/canvas_skia.h" | 17 #include "ui/gfx/canvas_skia.h" |
17 #include "ui/gfx/platform_font.h" | 18 #include "ui/gfx/platform_font.h" |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 // The maximum supported number of Uniscribe runs; a SCRIPT_ITEM is 8 bytes. | 22 // The maximum supported number of Uniscribe runs; a SCRIPT_ITEM is 8 bytes. |
22 // TODO(msw): Review memory use/failure? Max string length? Alternate approach? | 23 // TODO(msw): Review memory use/failure? Max string length? Alternate approach? |
23 const int kGuessItems = 100; | 24 const int kGuessItems = 100; |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
432 | 433 |
433 Point offset(GetOriginForSkiaDrawing()); | 434 Point offset(GetOriginForSkiaDrawing()); |
434 SkScalar x = SkIntToScalar(offset.x()); | 435 SkScalar x = SkIntToScalar(offset.x()); |
435 SkScalar y = SkIntToScalar(offset.y()); | 436 SkScalar y = SkIntToScalar(offset.y()); |
436 | 437 |
437 std::vector<SkPoint> pos; | 438 std::vector<SkPoint> pos; |
438 | 439 |
439 internal::SkiaTextRenderer renderer(canvas); | 440 internal::SkiaTextRenderer renderer(canvas); |
440 ApplyFadeEffects(&renderer); | 441 ApplyFadeEffects(&renderer); |
441 | 442 |
443 bool smoothing_enabled; | |
444 bool cleartype_enabled; | |
445 GetCachedFontSmoothingSettings(&smoothing_enabled, &cleartype_enabled); | |
446 renderer.SetFontSmoothingSettings(smoothing_enabled, cleartype_enabled); | |
msw
2012/02/15 00:33:16
Perhaps comment on how enable_lcd_text == cleartyp
asvitkine_google
2012/02/15 15:10:44
Done.
| |
447 | |
442 for (size_t i = 0; i < runs_.size(); ++i) { | 448 for (size_t i = 0; i < runs_.size(); ++i) { |
443 // Get the run specified by the visual-to-logical map. | 449 // Get the run specified by the visual-to-logical map. |
444 internal::TextRun* run = runs_[visual_to_logical_[i]]; | 450 internal::TextRun* run = runs_[visual_to_logical_[i]]; |
445 | 451 |
446 if (run->glyph_count == 0) | 452 if (run->glyph_count == 0) |
447 continue; | 453 continue; |
448 | 454 |
449 // Based on WebCore::skiaDrawText. | 455 // Based on WebCore::skiaDrawText. |
450 pos.resize(run->glyph_count); | 456 pos.resize(run->glyph_count); |
451 SkScalar glyph_x = x; | 457 SkScalar glyph_x = x; |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
725 internal::TextRun* run) { | 731 internal::TextRun* run) { |
726 size_t caret = IndexOfAdjacentGrapheme(run->range.end(), CURSOR_BACKWARD); | 732 size_t caret = IndexOfAdjacentGrapheme(run->range.end(), CURSOR_BACKWARD); |
727 return SelectionModel(caret, caret, SelectionModel::LEADING); | 733 return SelectionModel(caret, caret, SelectionModel::LEADING); |
728 } | 734 } |
729 | 735 |
730 RenderText* RenderText::CreateRenderText() { | 736 RenderText* RenderText::CreateRenderText() { |
731 return new RenderTextWin; | 737 return new RenderTextWin; |
732 } | 738 } |
733 | 739 |
734 } // namespace gfx | 740 } // namespace gfx |
OLD | NEW |