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

Side by Side Diff: ui/base/resource/resource_bundle.cc

Issue 124693003: Makes the default ctor of gfx::FontList copy the pre-calculated metrics. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/gfx/font_list.h » ('j') | ui/gfx/font_list.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // PNG-related constants. 61 // PNG-related constants.
62 const unsigned char kPngMagic[8] = { 0x89, 'P', 'N', 'G', 13, 10, 26, 10 }; 62 const unsigned char kPngMagic[8] = { 0x89, 'P', 'N', 'G', 13, 10, 26, 10 };
63 const size_t kPngChunkMetadataSize = 12; // length, type, crc32 63 const size_t kPngChunkMetadataSize = 12; // length, type, crc32
64 const unsigned char kPngScaleChunkType[4] = { 'c', 's', 'C', 'l' }; 64 const unsigned char kPngScaleChunkType[4] = { 'c', 's', 'C', 'l' };
65 const unsigned char kPngDataChunkType[4] = { 'I', 'D', 'A', 'T' }; 65 const unsigned char kPngDataChunkType[4] = { 'I', 'D', 'A', 'T' };
66 66
67 ResourceBundle* g_shared_instance_ = NULL; 67 ResourceBundle* g_shared_instance_ = NULL;
68 68
69 void InitDefaultFontList() { 69 void InitDefaultFontList() {
70 #if defined(OS_CHROMEOS) 70 #if defined(OS_CHROMEOS)
71 gfx::FontList::SetDefaultFontDescription( 71 // gfx::PlatformFontPango::SetDefaultFontDescription must be called prior to
72 l10n_util::GetStringUTF8(IDS_UI_FONT_FAMILY_CROS)); 72 // gfx::FontList::SetDefaultFontDescription because the latter uses the
73 73 // default ctor of gfx::PlatformFontPango.
74 // TODO(yukishiino): Remove SetDefaultFontDescription() once the migration to 74 // TODO(yukishiino): Remove SetDefaultFontDescription() once the migration to
75 // the font list is done. We will no longer need SetDefaultFontDescription() 75 // the font list is done. We will no longer need SetDefaultFontDescription()
76 // after every client gets started using a FontList instead of a Font. 76 // after every client gets started using a FontList instead of a Font.
77 gfx::PlatformFontPango::SetDefaultFontDescription( 77 gfx::PlatformFontPango::SetDefaultFontDescription(
78 l10n_util::GetStringUTF8(IDS_UI_FONT_FAMILY_CROS)); 78 l10n_util::GetStringUTF8(IDS_UI_FONT_FAMILY_CROS));
79
80 gfx::FontList::SetDefaultFontDescription(
81 l10n_util::GetStringUTF8(IDS_UI_FONT_FAMILY_CROS));
79 #else 82 #else
80 // Use a single default font as the default font list. 83 // Use a single default font as the default font list.
81 gfx::FontList::SetDefaultFontDescription(std::string()); 84 gfx::FontList::SetDefaultFontDescription(std::string());
82 #endif 85 #endif
83 } 86 }
84 87
85 } // namespace 88 } // namespace
86 89
87 // An ImageSkiaSource that loads bitmaps for the requested scale factor from 90 // An ImageSkiaSource that loads bitmaps for the requested scale factor from
88 // ResourceBundle on demand for a given |resource_id|. If the bitmap for the 91 // ResourceBundle on demand for a given |resource_id|. If the bitmap for the
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 // static 799 // static
797 bool ResourceBundle::DecodePNG(const unsigned char* buf, 800 bool ResourceBundle::DecodePNG(const unsigned char* buf,
798 size_t size, 801 size_t size,
799 SkBitmap* bitmap, 802 SkBitmap* bitmap,
800 bool* fell_back_to_1x) { 803 bool* fell_back_to_1x) {
801 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); 804 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size);
802 return gfx::PNGCodec::Decode(buf, size, bitmap); 805 return gfx::PNGCodec::Decode(buf, size, bitmap);
803 } 806 }
804 807
805 } // namespace ui 808 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/font_list.h » ('j') | ui/gfx/font_list.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698