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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 367 |
368 large_bold_font_.reset(new gfx::Font()); | 368 large_bold_font_.reset(new gfx::Font()); |
369 *large_bold_font_ = | 369 *large_bold_font_ = |
370 base_font_->DeriveFont(kLargeFontSizeDelta, | 370 base_font_->DeriveFont(kLargeFontSizeDelta, |
371 base_font_->GetStyle() | gfx::Font::BOLD); | 371 base_font_->GetStyle() | gfx::Font::BOLD); |
372 } | 372 } |
373 } | 373 } |
374 | 374 |
375 SkBitmap* ResourceBundle::LoadBitmap(const ResourceHandle& data_handle, | 375 SkBitmap* ResourceBundle::LoadBitmap(const ResourceHandle& data_handle, |
376 int resource_id) { | 376 int resource_id) { |
377 scoped_refptr<RefCountedMemory> memory( | 377 scoped_refptr<base::RefCountedMemory> memory( |
378 data_handle.GetStaticMemory(resource_id)); | 378 data_handle.GetStaticMemory(resource_id)); |
379 if (!memory) | 379 if (!memory) |
380 return NULL; | 380 return NULL; |
381 | 381 |
382 SkBitmap bitmap; | 382 SkBitmap bitmap; |
383 if (gfx::PNGCodec::Decode(memory->front(), memory->size(), &bitmap)) | 383 if (gfx::PNGCodec::Decode(memory->front(), memory->size(), &bitmap)) |
384 return new SkBitmap(bitmap); | 384 return new SkBitmap(bitmap); |
385 | 385 |
386 // 99% of our assets are PNGs, however fallback to JPEG. | 386 // 99% of our assets are PNGs, however fallback to JPEG. |
387 SkBitmap* allocated_bitmap = | 387 SkBitmap* allocated_bitmap = |
(...skipping 15 matching lines...) Expand all Loading... |
403 SkBitmap* bitmap = new SkBitmap(); | 403 SkBitmap* bitmap = new SkBitmap(); |
404 bitmap->setConfig(SkBitmap::kARGB_8888_Config, 32, 32); | 404 bitmap->setConfig(SkBitmap::kARGB_8888_Config, 32, 32); |
405 bitmap->allocPixels(); | 405 bitmap->allocPixels(); |
406 bitmap->eraseARGB(255, 255, 0, 0); | 406 bitmap->eraseARGB(255, 255, 0, 0); |
407 empty_image = new gfx::Image(bitmap); | 407 empty_image = new gfx::Image(bitmap); |
408 } | 408 } |
409 return empty_image; | 409 return empty_image; |
410 } | 410 } |
411 | 411 |
412 } // namespace ui | 412 } // namespace ui |
OLD | NEW |