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/views/background.h" | 5 #include "ui/views/background.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "skia/ext/skia_utils_win.h" | 8 #include "skia/ext/skia_utils_win.h" |
9 #include "third_party/skia/include/core/SkPaint.h" | 9 #include "third_party/skia/include/core/SkPaint.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 SkColor color2) { | 107 SkColor color2) { |
108 Background* background = CreateBackgroundPainter( | 108 Background* background = CreateBackgroundPainter( |
109 true, Painter::CreateVerticalGradient(color1, color2)); | 109 true, Painter::CreateVerticalGradient(color1, color2)); |
110 background->SetNativeControlColor( | 110 background->SetNativeControlColor( |
111 color_utils::AlphaBlend(color1, color2, 128)); | 111 color_utils::AlphaBlend(color1, color2, 128)); |
112 | 112 |
113 return background; | 113 return background; |
114 } | 114 } |
115 | 115 |
116 //static | 116 //static |
| 117 Background* Background::CreateVerticalMultiColorGradientBackground( |
| 118 SkColor* colors, |
| 119 SkScalar* pos, |
| 120 int count) { |
| 121 Background* background = CreateBackgroundPainter( |
| 122 true, Painter::CreateVerticalGradientRange(colors, pos, count)); |
| 123 background->SetNativeControlColor( |
| 124 color_utils::AlphaBlend(colors[0], colors[count-1], 128)); |
| 125 |
| 126 return background; |
| 127 } |
| 128 |
| 129 //static |
117 Background* Background::CreateBackgroundPainter(bool owns_painter, | 130 Background* Background::CreateBackgroundPainter(bool owns_painter, |
118 Painter* painter) { | 131 Painter* painter) { |
119 return new BackgroundPainter(owns_painter, painter); | 132 return new BackgroundPainter(owns_painter, painter); |
120 } | 133 } |
121 | 134 |
122 } // namespace views | 135 } // namespace views |
OLD | NEW |