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

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

Issue 10988002: Remove some dead code in ResourceBundle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | no next file » | 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 24 matching lines...) Expand all
35 35
36 namespace { 36 namespace {
37 37
38 // Font sizes relative to base font. 38 // Font sizes relative to base font.
39 const int kSmallFontSizeDelta = -2; 39 const int kSmallFontSizeDelta = -2;
40 const int kMediumFontSizeDelta = 3; 40 const int kMediumFontSizeDelta = 3;
41 const int kLargeFontSizeDelta = 8; 41 const int kLargeFontSizeDelta = 8;
42 42
43 ResourceBundle* g_shared_instance_ = NULL; 43 ResourceBundle* g_shared_instance_ = NULL;
44 44
45 // Returns the actual scale factor of |bitmap| given the image representations
46 // which have already been added to |image|.
47 // TODO(pkotwicz): Remove this once we are no longer loading 1x resources
48 // as part of non 1x data packs.
49 ui::ScaleFactor GetActualScaleFactor(const gfx::ImageSkia& image,
50 const SkBitmap& bitmap,
51 ui::ScaleFactor data_pack_scale_factor) {
52 if (image.isNull())
53 return data_pack_scale_factor;
54
55 return ui::GetScaleFactorFromScale(
56 static_cast<float>(bitmap.width()) / image.width());
57 }
58
59 bool ShouldHighlightMissingScaledResources() { 45 bool ShouldHighlightMissingScaledResources() {
60 return CommandLine::ForCurrentProcess()->HasSwitch( 46 return CommandLine::ForCurrentProcess()->HasSwitch(
61 switches::kHighlightMissingScaledResources); 47 switches::kHighlightMissingScaledResources);
62 } 48 }
63 49
64 } // namespace 50 } // namespace
65 51
66 // An ImageSkiaSource that loads bitmaps for requested scale factor from 52 // An ImageSkiaSource that loads bitmaps for requested scale factor from
67 // ResourceBundle on demand for given resource_id. It falls back 53 // ResourceBundle on demand for given resource_id. It falls back
68 // to the 1x bitmap if the bitmap for the requested scale factor does not 54 // to the 1x bitmap if the bitmap for the requested scale factor does not
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 SkBitmap bitmap; 630 SkBitmap bitmap;
645 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 32, 32); 631 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 32, 32);
646 bitmap.allocPixels(); 632 bitmap.allocPixels();
647 bitmap.eraseARGB(255, 255, 0, 0); 633 bitmap.eraseARGB(255, 255, 0, 0);
648 empty_image_ = gfx::Image(bitmap); 634 empty_image_ = gfx::Image(bitmap);
649 } 635 }
650 return empty_image_; 636 return empty_image_;
651 } 637 }
652 638
653 } // namespace ui 639 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698