Chromium Code Reviews| 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 #ifndef UI_VIEWS_BACKGROUND_H_ | 5 #ifndef UI_VIEWS_BACKGROUND_H_ |
| 6 #define UI_VIEWS_BACKGROUND_H_ | 6 #define UI_VIEWS_BACKGROUND_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 // Creates a background that fills the canvas in the specified color. | 47 // Creates a background that fills the canvas in the specified color. |
| 48 static Background* CreateSolidBackground(int r, int g, int b) { | 48 static Background* CreateSolidBackground(int r, int g, int b) { |
| 49 return CreateSolidBackground(SkColorSetRGB(r, g, b)); | 49 return CreateSolidBackground(SkColorSetRGB(r, g, b)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 // Creates a background that fills the canvas in the specified color. | 52 // Creates a background that fills the canvas in the specified color. |
| 53 static Background* CreateSolidBackground(int r, int g, int b, int a) { | 53 static Background* CreateSolidBackground(int r, int g, int b, int a) { |
| 54 return CreateSolidBackground(SkColorSetARGB(a, r, g, b)); | 54 return CreateSolidBackground(SkColorSetARGB(a, r, g, b)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Creates a background that paints a rectangle with color |background|. This | |
| 58 // will also paint a one pixel border around the rectangle of color |border|, | |
| 59 // accounting for the scaling of the canvas. If |round| the rectangle will | |
| 60 // have rounded corners. | |
| 61 static Background* CreateSolidScaledBackground(SkColor background, | |
|
Peter Kasting
2015/10/19 21:09:44
Why put this here? Are you going to be using it o
Evan Stade
2015/10/19 23:21:30
The plan is to use it for chips as well (e.g. ev_b
Peter Kasting
2015/10/19 23:32:23
Ah, helpful. Yeah, I would probably avoid touchin
jonross
2015/10/20 18:54:54
Evan was going to use this for the omnibox chips
| |
| 62 SkColor border, | |
| 63 bool round); | |
| 64 | |
| 57 // Creates a background that contains a vertical gradient that varies | 65 // Creates a background that contains a vertical gradient that varies |
| 58 // from |color1| to |color2| | 66 // from |color1| to |color2| |
| 59 static Background* CreateVerticalGradientBackground(SkColor color1, | 67 static Background* CreateVerticalGradientBackground(SkColor color1, |
| 60 SkColor color2); | 68 SkColor color2); |
| 61 | 69 |
| 62 // Creates a background that contains a vertical gradient. The gradient can | 70 // Creates a background that contains a vertical gradient. The gradient can |
| 63 // have multiple |colors|. The |pos| array contains the relative positions of | 71 // have multiple |colors|. The |pos| array contains the relative positions of |
| 64 // each corresponding color. |colors| and |pos| must be the same size. The | 72 // each corresponding color. |colors| and |pos| must be the same size. The |
| 65 // first element in |pos| must be 0.0 and the last element must be 1.0. | 73 // first element in |pos| must be 0.0 and the last element must be 1.0. |
| 66 // |count| contains the number of elements in |colors| and |pos|. | 74 // |count| contains the number of elements in |colors| and |pos|. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 // TODO(port): Create portable replacement for HBRUSH. | 110 // TODO(port): Create portable replacement for HBRUSH. |
| 103 mutable HBRUSH native_control_brush_; | 111 mutable HBRUSH native_control_brush_; |
| 104 #endif // defined(OS_WIN) | 112 #endif // defined(OS_WIN) |
| 105 | 113 |
| 106 DISALLOW_COPY_AND_ASSIGN(Background); | 114 DISALLOW_COPY_AND_ASSIGN(Background); |
| 107 }; | 115 }; |
| 108 | 116 |
| 109 } // namespace views | 117 } // namespace views |
| 110 | 118 |
| 111 #endif // UI_VIEWS_BACKGROUND_H_ | 119 #endif // UI_VIEWS_BACKGROUND_H_ |
| OLD | NEW |