Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 import 'dart:math' as math; | 5 import 'dart:math' as math; |
| 6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
| 7 import 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path; | 7 import 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path; |
| 8 | 8 |
| 9 import '../base/lerp.dart'; | |
| 9 import 'shadows.dart'; | 10 import 'shadows.dart'; |
| 10 import 'package:sky/mojo/net/image_cache.dart' as image_cache; | 11 import 'package:sky/mojo/net/image_cache.dart' as image_cache; |
| 11 | 12 |
| 12 class BorderSide { | 13 class BorderSide { |
| 13 const BorderSide({ | 14 const BorderSide({ |
| 14 this.color: const Color(0xFF000000), | 15 this.color: const Color(0xFF000000), |
| 15 this.width: 1.0 | 16 this.width: 1.0 |
| 16 }); | 17 }); |
| 17 final Color color; | 18 final Color color; |
| 18 final double width; | 19 final double width; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 this.color, | 64 this.color, |
| 64 this.offset, | 65 this.offset, |
| 65 this.blur | 66 this.blur |
| 66 }); | 67 }); |
| 67 | 68 |
| 68 final Color color; | 69 final Color color; |
| 69 final Offset offset; | 70 final Offset offset; |
| 70 final double blur; | 71 final double blur; |
| 71 | 72 |
| 72 String toString() => 'BoxShadow($color, $offset, $blur)'; | 73 String toString() => 'BoxShadow($color, $offset, $blur)'; |
| 74 | |
| 75 static BoxShadow lerp(BoxShadow a, BoxShadow b, double t) => | |
|
Hixie
2015/06/30 23:11:56
Why BoxShadow.lerp() but lerpColor()?
Matt Perry
2015/07/01 18:17:43
Good question. Made it a global.
| |
| 76 new BoxShadow(color: lerpColor(a.color, b.color, t), | |
| 77 offset: lerpOffset(a.offset, b.offset, t), | |
| 78 blur: lerpNum(a.blur, b.blur, t)); | |
| 73 } | 79 } |
| 74 | 80 |
| 75 abstract class Gradient { | 81 abstract class Gradient { |
| 76 sky.Shader createShader(); | 82 sky.Shader createShader(); |
| 77 } | 83 } |
| 78 | 84 |
| 79 class LinearGradient extends Gradient { | 85 class LinearGradient extends Gradient { |
| 80 LinearGradient({ | 86 LinearGradient({ |
| 81 this.endPoints, | 87 this.endPoints, |
| 82 this.colors, | 88 this.colors, |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 path.close(); | 379 path.close(); |
| 374 canvas.drawPath(path, paint); | 380 canvas.drawPath(path, paint); |
| 375 } | 381 } |
| 376 | 382 |
| 377 void paint(sky.Canvas canvas, Rect rect) { | 383 void paint(sky.Canvas canvas, Rect rect) { |
| 378 _paintBackgroundColor(canvas, rect); | 384 _paintBackgroundColor(canvas, rect); |
| 379 _paintBackgroundImage(canvas, rect); | 385 _paintBackgroundImage(canvas, rect); |
| 380 _paintBorder(canvas, rect); | 386 _paintBorder(canvas, rect); |
| 381 } | 387 } |
| 382 } | 388 } |
| OLD | NEW |