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

Side by Side Diff: ui/views/color_chooser/color_chooser_view.cc

Issue 2893083002: cc: Move SkShader construction to a single spot in PaintShader (Closed)
Patch Set: update Created 3 years, 6 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
« no previous file with comments | « ui/native_theme/native_theme_base.cc ('k') | ui/views/controls/scrollbar/cocoa_scroll_bar.mm » ('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 "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
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
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
OLDNEW
« no previous file with comments | « ui/native_theme/native_theme_base.cc ('k') | ui/views/controls/scrollbar/cocoa_scroll_bar.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698