OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/resource_bundle.h" | 5 #include "app/resource_bundle.h" |
6 | 6 |
7 #include "base/data_pack.h" | 7 #include "base/data_pack.h" |
8 #include "base/lock.h" | 8 #include "base/lock.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
168 void ResourceBundle::LoadFontsIfNecessary() { | 168 void ResourceBundle::LoadFontsIfNecessary() { |
169 AutoLock lock_scope(*lock_); | 169 AutoLock lock_scope(*lock_); |
170 if (!base_font_.get()) { | 170 if (!base_font_.get()) { |
171 base_font_.reset(new gfx::Font()); | 171 base_font_.reset(new gfx::Font()); |
172 | 172 |
173 bold_font_.reset(new gfx::Font()); | 173 bold_font_.reset(new gfx::Font()); |
174 *bold_font_ = | 174 *bold_font_ = |
175 base_font_->DeriveFont(0, base_font_->style() | gfx::Font::BOLD); | 175 base_font_->DeriveFont(0, base_font_->GetStyle() | gfx::Font::BOLD); |
176 | 176 |
177 small_font_.reset(new gfx::Font()); | 177 small_font_.reset(new gfx::Font()); |
178 *small_font_ = base_font_->DeriveFont(-2); | 178 *small_font_ = base_font_->DeriveFont(-2); |
179 | 179 |
180 medium_font_.reset(new gfx::Font()); | 180 medium_font_.reset(new gfx::Font()); |
181 *medium_font_ = base_font_->DeriveFont(3); | 181 *medium_font_ = base_font_->DeriveFont(3); |
182 | 182 |
183 medium_bold_font_.reset(new gfx::Font()); | 183 medium_bold_font_.reset(new gfx::Font()); |
184 *medium_bold_font_ = | 184 *medium_bold_font_ = |
185 base_font_->DeriveFont(3, base_font_->style() | gfx::Font::BOLD); | 185 base_font_->DeriveFont(3, base_font_->GetStyle() | gfx::Font::BOLD); |
186 | 186 |
187 large_font_.reset(new gfx::Font()); | 187 large_font_.reset(new gfx::Font()); |
188 *large_font_ = base_font_->DeriveFont(8); | 188 *large_font_ = base_font_->DeriveFont(8); |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 const gfx::Font& ResourceBundle::GetFont(FontStyle style) { | 192 const gfx::Font& ResourceBundle::GetFont(FontStyle style) { |
193 LoadFontsIfNecessary(); | 193 LoadFontsIfNecessary(); |
194 switch (style) { | 194 switch (style) { |
195 case BoldFont: | 195 case BoldFont: |
(...skipping 27 matching lines...) Expand all Loading... |
223 | 223 |
224 bool ResourceBundle::LoadedDataPack::GetStringPiece( | 224 bool ResourceBundle::LoadedDataPack::GetStringPiece( |
225 int resource_id, base::StringPiece* data) const { | 225 int resource_id, base::StringPiece* data) const { |
226 return data_pack_->GetStringPiece(static_cast<uint32>(resource_id), data); | 226 return data_pack_->GetStringPiece(static_cast<uint32>(resource_id), data); |
227 } | 227 } |
228 | 228 |
229 RefCountedStaticMemory* ResourceBundle::LoadedDataPack::GetStaticMemory( | 229 RefCountedStaticMemory* ResourceBundle::LoadedDataPack::GetStaticMemory( |
230 int resource_id) const { | 230 int resource_id) const { |
231 return data_pack_->GetStaticMemory(resource_id); | 231 return data_pack_->GetStaticMemory(resource_id); |
232 } | 232 } |
OLD | NEW |