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/base/resource/resource_bundle.h" | 5 #include "ui/base/resource/resource_bundle.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 medium_bold_font_list_ = GetFontListFromDelegate(MediumBoldFont); | 631 medium_bold_font_list_ = GetFontListFromDelegate(MediumBoldFont); |
632 large_font_list_ = GetFontListFromDelegate(LargeFont); | 632 large_font_list_ = GetFontListFromDelegate(LargeFont); |
633 large_bold_font_list_ = GetFontListFromDelegate(LargeBoldFont); | 633 large_bold_font_list_ = GetFontListFromDelegate(LargeBoldFont); |
634 } | 634 } |
635 | 635 |
636 if (!base_font_list_.get()) | 636 if (!base_font_list_.get()) |
637 base_font_list_.reset(new gfx::FontList()); | 637 base_font_list_.reset(new gfx::FontList()); |
638 | 638 |
639 if (!bold_font_list_.get()) { | 639 if (!bold_font_list_.get()) { |
640 bold_font_list_.reset(new gfx::FontList()); | 640 bold_font_list_.reset(new gfx::FontList()); |
641 *bold_font_list_ = base_font_list_->DeriveFontList( | 641 *bold_font_list_ = base_font_list_->DeriveWithStyle( |
642 base_font_list_->GetFontStyle() | gfx::Font::BOLD); | 642 base_font_list_->GetFontStyle() | gfx::Font::BOLD); |
643 } | 643 } |
644 | 644 |
645 if (!small_font_list_.get()) { | 645 if (!small_font_list_.get()) { |
646 small_font_list_.reset(new gfx::FontList()); | 646 small_font_list_.reset(new gfx::FontList()); |
647 *small_font_list_ = base_font_list_->DeriveFontListWithSize( | 647 *small_font_list_ = |
648 base_font_list_->GetFontSize() + kSmallFontSizeDelta); | 648 base_font_list_->DeriveWithSizeDelta(kSmallFontSizeDelta); |
649 } | 649 } |
650 | 650 |
651 if (!small_bold_font_list_.get()) { | 651 if (!small_bold_font_list_.get()) { |
652 small_bold_font_list_.reset(new gfx::FontList()); | 652 small_bold_font_list_.reset(new gfx::FontList()); |
653 *small_bold_font_list_ = small_font_list_->DeriveFontList( | 653 *small_bold_font_list_ = small_font_list_->DeriveWithStyle( |
654 small_font_list_->GetFontStyle() | gfx::Font::BOLD); | 654 small_font_list_->GetFontStyle() | gfx::Font::BOLD); |
655 } | 655 } |
656 | 656 |
657 if (!medium_font_list_.get()) { | 657 if (!medium_font_list_.get()) { |
658 medium_font_list_.reset(new gfx::FontList()); | 658 medium_font_list_.reset(new gfx::FontList()); |
659 *medium_font_list_ = base_font_list_->DeriveFontListWithSize( | 659 *medium_font_list_ = |
660 base_font_list_->GetFontSize() + kMediumFontSizeDelta); | 660 base_font_list_->DeriveWithSizeDelta(kMediumFontSizeDelta); |
661 } | 661 } |
662 | 662 |
663 if (!medium_bold_font_list_.get()) { | 663 if (!medium_bold_font_list_.get()) { |
664 medium_bold_font_list_.reset(new gfx::FontList()); | 664 medium_bold_font_list_.reset(new gfx::FontList()); |
665 *medium_bold_font_list_ = medium_font_list_->DeriveFontList( | 665 *medium_bold_font_list_ = medium_font_list_->DeriveWithStyle( |
666 medium_font_list_->GetFontStyle() | gfx::Font::BOLD); | 666 medium_font_list_->GetFontStyle() | gfx::Font::BOLD); |
667 } | 667 } |
668 | 668 |
669 if (!large_font_list_.get()) { | 669 if (!large_font_list_.get()) { |
670 large_font_list_.reset(new gfx::FontList()); | 670 large_font_list_.reset(new gfx::FontList()); |
671 *large_font_list_ = base_font_list_->DeriveFontListWithSize( | 671 *large_font_list_ = |
672 base_font_list_->GetFontSize() + kLargeFontSizeDelta); | 672 base_font_list_->DeriveWithSizeDelta(kLargeFontSizeDelta); |
673 } | 673 } |
674 | 674 |
675 if (!large_bold_font_list_.get()) { | 675 if (!large_bold_font_list_.get()) { |
676 large_bold_font_list_.reset(new gfx::FontList()); | 676 large_bold_font_list_.reset(new gfx::FontList()); |
677 *large_bold_font_list_ = large_font_list_->DeriveFontList( | 677 *large_bold_font_list_ = large_font_list_->DeriveWithStyle( |
678 large_font_list_->GetFontStyle() | gfx::Font::BOLD); | 678 large_font_list_->GetFontStyle() | gfx::Font::BOLD); |
679 } | 679 } |
680 } | 680 } |
681 } | 681 } |
682 | 682 |
683 scoped_ptr<gfx::FontList> ResourceBundle::GetFontListFromDelegate( | 683 scoped_ptr<gfx::FontList> ResourceBundle::GetFontListFromDelegate( |
684 FontStyle style) { | 684 FontStyle style) { |
685 DCHECK(delegate_); | 685 DCHECK(delegate_); |
686 scoped_ptr<gfx::Font> font = delegate_->GetFont(style); | 686 scoped_ptr<gfx::Font> font = delegate_->GetFont(style); |
687 if (font.get()) | 687 if (font.get()) |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 // static | 798 // static |
799 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 799 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
800 size_t size, | 800 size_t size, |
801 SkBitmap* bitmap, | 801 SkBitmap* bitmap, |
802 bool* fell_back_to_1x) { | 802 bool* fell_back_to_1x) { |
803 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 803 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
804 return gfx::PNGCodec::Decode(buf, size, bitmap); | 804 return gfx::PNGCodec::Decode(buf, size, bitmap); |
805 } | 805 } |
806 | 806 |
807 } // namespace ui | 807 } // namespace ui |
OLD | NEW |