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

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

Issue 10272004: Move RefCountedMemory class to base namespace. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 7 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 | « chrome/browser/ui/webui/web_ui_util.cc ('k') | ui/base/theme_provider.h » ('j') | no next file with comments »
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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/web_ui_util.cc ('k') | ui/base/theme_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698