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/color_chooser/color_chooser_view.h" | 5 #include "ui/views/color_chooser/color_chooser_view.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 SkColor end_color, bool is_horizontal, | 98 SkColor end_color, bool is_horizontal, |
99 gfx::Canvas* canvas) { | 99 gfx::Canvas* canvas) { |
100 SkColor colors[2] = { start_color, end_color }; | 100 SkColor colors[2] = { start_color, end_color }; |
101 SkPoint points[2]; | 101 SkPoint points[2]; |
102 points[0].iset(0, 0); | 102 points[0].iset(0, 0); |
103 if (is_horizontal) | 103 if (is_horizontal) |
104 points[1].iset(rect.width() + 1, 0); | 104 points[1].iset(rect.width() + 1, 0); |
105 else | 105 else |
106 points[1].iset(0, rect.height() + 1); | 106 points[1].iset(0, rect.height() + 1); |
107 cc::PaintFlags flags; | 107 cc::PaintFlags flags; |
108 flags.setShader(cc::WrapSkShader(SkGradientShader::MakeLinear( | 108 flags.setShader(cc::PaintShader::MakeLinearGradient( |
109 points, colors, NULL, 2, SkShader::kClamp_TileMode))); | 109 points, colors, nullptr, 2, SkShader::kClamp_TileMode)); |
110 canvas->DrawRect(rect, flags); | 110 canvas->DrawRect(rect, flags); |
111 } | 111 } |
112 | 112 |
113 } // namespace | 113 } // namespace |
114 | 114 |
115 namespace views { | 115 namespace views { |
116 | 116 |
117 //////////////////////////////////////////////////////////////////////////////// | 117 //////////////////////////////////////////////////////////////////////////////// |
118 // ColorChooserView::HueView | 118 // ColorChooserView::HueView |
119 // | 119 // |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 if (key_event.type() != ui::ET_KEY_PRESSED || | 466 if (key_event.type() != ui::ET_KEY_PRESSED || |
467 (key_event.key_code() != ui::VKEY_RETURN && | 467 (key_event.key_code() != ui::VKEY_RETURN && |
468 key_event.key_code() != ui::VKEY_ESCAPE)) | 468 key_event.key_code() != ui::VKEY_ESCAPE)) |
469 return false; | 469 return false; |
470 | 470 |
471 GetWidget()->Close(); | 471 GetWidget()->Close(); |
472 return true; | 472 return true; |
473 } | 473 } |
474 | 474 |
475 } // namespace views | 475 } // namespace views |
OLD | NEW |