OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 paint.setSubpixelText(true); | 599 paint.setSubpixelText(true); |
600 paint.setLCDRenderText(true); | 600 paint.setLCDRenderText(true); |
601 SkPoint point(SkPoint::Make(SkIntToScalar(offset.x()), | 601 SkPoint point(SkPoint::Make(SkIntToScalar(offset.x()), |
602 SkIntToScalar(display_rect().height() - offset.y()))); | 602 SkIntToScalar(display_rect().height() - offset.y()))); |
603 scoped_array<SkPoint> pos; | 603 scoped_array<SkPoint> pos; |
604 for (size_t i = 0; i < runs_.size(); ++i) { | 604 for (size_t i = 0; i < runs_.size(); ++i) { |
605 // Get the run specified by the visual-to-logical map. | 605 // Get the run specified by the visual-to-logical map. |
606 internal::TextRun* run = runs_[visual_to_logical_[i]]; | 606 internal::TextRun* run = runs_[visual_to_logical_[i]]; |
607 | 607 |
608 // TODO(msw): Font default/fallback and style integration. | 608 // TODO(msw): Font default/fallback and style integration. |
609 std::string font(UTF16ToASCII(run->font.GetFontName())); | 609 std::string font(run->font.GetFontName()); |
610 SkTypeface::Style style = SkTypeface::kNormal; | 610 SkTypeface::Style style = SkTypeface::kNormal; |
611 SkTypeface* typeface = SkTypeface::CreateFromName(font.c_str(), style); | 611 SkTypeface* typeface = SkTypeface::CreateFromName(font.c_str(), style); |
612 if (typeface) { | 612 if (typeface) { |
613 paint.setTypeface(typeface); | 613 paint.setTypeface(typeface); |
614 // |paint| adds its own ref. Release the ref from CreateFromName. | 614 // |paint| adds its own ref. Release the ref from CreateFromName. |
615 typeface->unref(); | 615 typeface->unref(); |
616 } | 616 } |
617 paint.setTextSize(run->font.GetFontSize()); | 617 paint.setTextSize(run->font.GetFontSize()); |
618 paint.setColor(run->foreground); | 618 paint.setColor(run->foreground); |
619 | 619 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 Rect r(GetUpdatedCursorBounds()); | 652 Rect r(GetUpdatedCursorBounds()); |
653 canvas->DrawRectInt(kCursorColor, r.x(), r.y(), r.width(), r.height()); | 653 canvas->DrawRectInt(kCursorColor, r.x(), r.y(), r.width(), r.height()); |
654 } | 654 } |
655 } | 655 } |
656 | 656 |
657 RenderText* RenderText::CreateRenderText() { | 657 RenderText* RenderText::CreateRenderText() { |
658 return new RenderTextWin; | 658 return new RenderTextWin; |
659 } | 659 } |
660 | 660 |
661 } // namespace gfx | 661 } // namespace gfx |
OLD | NEW |