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 "chrome/browser/extensions/extension_icon_manager.h" | 5 #include "chrome/browser/extensions/extension_icon_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "chrome/browser/extensions/image_loader.h" | 10 #include "chrome/browser/extensions/image_loader.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 // Helper function to create a new bitmap with |padding| amount of empty space | 28 // Helper function to create a new bitmap with |padding| amount of empty space |
29 // around the original bitmap. | 29 // around the original bitmap. |
30 static SkBitmap ApplyPadding(const SkBitmap& source, | 30 static SkBitmap ApplyPadding(const SkBitmap& source, |
31 const gfx::Insets& padding) { | 31 const gfx::Insets& padding) { |
32 scoped_ptr<gfx::Canvas> result( | 32 scoped_ptr<gfx::Canvas> result( |
33 new gfx::Canvas(gfx::Size(source.width() + padding.width(), | 33 new gfx::Canvas(gfx::Size(source.width() + padding.width(), |
34 source.height() + padding.height()), | 34 source.height() + padding.height()), |
35 1.0f, | 35 ui::SCALE_FACTOR_100P, |
36 false)); | 36 false)); |
37 result->DrawImageInt( | 37 result->DrawImageInt( |
38 gfx::ImageSkia::CreateFrom1xBitmap(source), | 38 gfx::ImageSkia::CreateFrom1xBitmap(source), |
39 0, 0, source.width(), source.height(), | 39 0, 0, source.width(), source.height(), |
40 padding.left(), padding.top(), source.width(), source.height(), | 40 padding.left(), padding.top(), source.width(), source.height(), |
41 false); | 41 false); |
42 return result->ExtractImageRep().sk_bitmap(); | 42 return result->ExtractImageRep().sk_bitmap(); |
43 } | 43 } |
44 | 44 |
45 } // namespace | 45 } // namespace |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 if (monochrome_) { | 127 if (monochrome_) { |
128 color_utils::HSL shift = {-1, 0, 0.6}; | 128 color_utils::HSL shift = {-1, 0, 0.6}; |
129 result = SkBitmapOperations::CreateHSLShiftedBitmap(result, shift); | 129 result = SkBitmapOperations::CreateHSLShiftedBitmap(result, shift); |
130 } | 130 } |
131 | 131 |
132 if (!padding_.empty()) | 132 if (!padding_.empty()) |
133 result = ApplyPadding(result, padding_); | 133 result = ApplyPadding(result, padding_); |
134 | 134 |
135 return result; | 135 return result; |
136 } | 136 } |
OLD | NEW |