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

Side by Side Diff: chrome/browser/chromeos/status/network_menu_icon.cc

Issue 11081007: Remove implicit flooring Scale() method from Point and Size. (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 | « ash/touch/touch_uma.cc ('k') | chrome/browser/extensions/extension_icon_image.cc » ('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 "chrome/browser/chromeos/status/network_menu_icon.h" 5 #include "chrome/browser/chromeos/status/network_menu_icon.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" 13 #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
14 #include "chrome/browser/chromeos/cros/cros_library.h" 14 #include "chrome/browser/chromeos/cros/cros_library.h"
15 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
16 #include "grit/theme_resources.h" 16 #include "grit/theme_resources.h"
17 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
18 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/gfx/canvas.h" 19 #include "ui/gfx/canvas.h"
20 #include "ui/gfx/image/image_skia_operations.h" 20 #include "ui/gfx/image/image_skia_operations.h"
21 #include "ui/gfx/image/image_skia_source.h" 21 #include "ui/gfx/image/image_skia_source.h"
22 #include "ui/gfx/size_conversions.h"
22 23
23 using std::max; 24 using std::max;
24 using std::min; 25 using std::min;
25 26
26 namespace chromeos { 27 namespace chromeos {
27 28
28 namespace { 29 namespace {
29 30
30 // Amount to fade icons while connecting. 31 // Amount to fade icons while connecting.
31 const double kConnectingImageAlpha = 0.5; 32 const double kConnectingImageAlpha = 0.5;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 176 }
176 177
177 class EmptyImageSource: public gfx::ImageSkiaSource { 178 class EmptyImageSource: public gfx::ImageSkiaSource {
178 public: 179 public:
179 explicit EmptyImageSource(const gfx::Size& size) 180 explicit EmptyImageSource(const gfx::Size& size)
180 : size_(size) { 181 : size_(size) {
181 } 182 }
182 183
183 virtual gfx::ImageSkiaRep GetImageForScale( 184 virtual gfx::ImageSkiaRep GetImageForScale(
184 ui::ScaleFactor scale_factor) OVERRIDE { 185 ui::ScaleFactor scale_factor) OVERRIDE {
185 gfx::Size pixel_size = size_.Scale(ui::GetScaleFactorScale(scale_factor)); 186 gfx::Size pixel_size = gfx::ToFlooredSize(
187 size_.Scale(ui::GetScaleFactorScale(scale_factor)));
186 SkBitmap empty_bitmap = GetEmptyBitmap(pixel_size); 188 SkBitmap empty_bitmap = GetEmptyBitmap(pixel_size);
187 return gfx::ImageSkiaRep(empty_bitmap, scale_factor); 189 return gfx::ImageSkiaRep(empty_bitmap, scale_factor);
188 } 190 }
189 private: 191 private:
190 const gfx::Size size_; 192 const gfx::Size size_;
191 193
192 DISALLOW_COPY_AND_ASSIGN(EmptyImageSource); 194 DISALLOW_COPY_AND_ASSIGN(EmptyImageSource);
193 }; 195 };
194 196
195 // This defines how we assemble a network icon. 197 // This defines how we assemble a network icon.
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 const gfx::ImageSkia NetworkMenuIcon::GetConnectedImage(ImageType type, 923 const gfx::ImageSkia NetworkMenuIcon::GetConnectedImage(ImageType type,
922 ResourceColorTheme color) { 924 ResourceColorTheme color) {
923 return GetImage(type, NumImages(type) - 1, color); 925 return GetImage(type, NumImages(type) - 1, color);
924 } 926 }
925 927
926 int NetworkMenuIcon::NumImages(ImageType type) { 928 int NetworkMenuIcon::NumImages(ImageType type) {
927 return (type == ARCS) ? kNumArcsImages : kNumBarsImages; 929 return (type == ARCS) ? kNumArcsImages : kNumBarsImages;
928 } 930 }
929 931
930 } // chromeos 932 } // chromeos
OLDNEW
« no previous file with comments | « ash/touch/touch_uma.cc ('k') | chrome/browser/extensions/extension_icon_image.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698