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

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

Issue 1152963009: Add support for linear gradients, implemented as skia shaders. (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
« no previous file with comments | « sky/engine/core/painting/CanvasGradient.cpp ('k') | sky/engine/core/painting/Gradient.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Extends the generated _Gradient interface via the CustomDart attribute.
6
7 class Gradient extends _Gradient {
8 // TODO(mpcomplete): Support other gradient types.
9 // TODO(mpcomplete): Maybe pass a list of (color, colorStop) pairs instead?
10 Gradient.Linear(List<Point> endPoints,
11 List<Color> colors,
12 List<double> colorStops)
13 : super(0, endPoints, colors, _validate(colorStops, colors));
14
15 // TODO(mpcomplete): Figure out a good way to validate arguments.
16 static List<double> _validate(colorStops, colors) {
17 if (colorStops != null && colors.length != colorStops.length) {
18 throw new ArgumentError(
19 "[colors] and [colorStops] parameters must be equal length.");
20 }
21 return colorStops;
22 }
23 }
OLDNEW
« no previous file with comments | « sky/engine/core/painting/CanvasGradient.cpp ('k') | sky/engine/core/painting/Gradient.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698