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

Side by Side Diff: sky/engine/core/painting/Gradient.dart

Issue 1171743002: Change the way we provide custom dart code for IDL bindings. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // Extends the generated _Gradient interface via the CustomDart attribute. 5 part of dart.sky;
6 6
7 // Extends the generated _Gradient interface via the PrivateDart attribute.
7 class Gradient extends _Gradient { 8 class Gradient extends _Gradient {
8 // TODO(mpcomplete): Support other gradient types. 9 // TODO(mpcomplete): Support other gradient types.
9 // TODO(mpcomplete): Maybe pass a list of (color, colorStop) pairs instead? 10 // TODO(mpcomplete): Maybe pass a list of (color, colorStop) pairs instead?
10 Gradient.Linear(List<Point> endPoints, 11 Gradient.Linear(List<Point> endPoints,
11 List<Color> colors, 12 List<Color> colors,
12 List<double> colorStops) 13 List<double> colorStops)
13 : super(0, endPoints, colors, _validate(colorStops, colors)); 14 : super(0, endPoints, colors, _validate(colorStops, colors));
14 15
15 // TODO(mpcomplete): Figure out a good way to validate arguments. 16 // TODO(mpcomplete): Figure out a good way to validate arguments.
16 static List<double> _validate(colorStops, colors) { 17 static List<double> _validate(colorStops, colors) {
17 if (colorStops != null && colors.length != colorStops.length) { 18 if (colorStops != null && colors.length != colorStops.length) {
18 throw new ArgumentError( 19 throw new ArgumentError(
19 "[colors] and [colorStops] parameters must be equal length."); 20 "[colors] and [colorStops] parameters must be equal length.");
20 } 21 }
21 return colorStops; 22 return colorStops;
22 } 23 }
23 } 24 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698