From 450bb11464a54df7c1028ae5c2a686f870a16b2e Mon Sep 17 00:00:00 2001 From: Hixie Date: Mon, 17 Aug 2015 10:24:58 -0700 Subject: [PATCH 1/2] Fix spaces in lerp.dart to match style better. --- sky/packages/sky/lib/base/lerp.dart | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sky/packages/sky/lib/base/lerp.dart b/sky/packages/sky/lib/base/lerp.dart index 80e2a2ceed79f..da5c144e946b4 100644 --- a/sky/packages/sky/lib/base/lerp.dart +++ b/sky/packages/sky/lib/base/lerp.dart @@ -26,10 +26,11 @@ Color lerpColor(Color a, Color b, double t) { if (b == null) return _scaleAlpha(a, 1.0 - t); return new Color.fromARGB( - lerpNum(a.alpha, b.alpha, t).toInt(), - lerpNum(a.red, b.red, t).toInt(), - lerpNum(a.green, b.green, t).toInt(), - lerpNum(a.blue, b.blue, t).toInt()); + lerpNum(a.alpha, b.alpha, t).toInt(), + lerpNum(a.red, b.red, t).toInt(), + lerpNum(a.green, b.green, t).toInt(), + lerpNum(a.blue, b.blue, t).toInt() + ); } Offset lerpOffset(Offset a, Offset b, double t) { @@ -55,5 +56,6 @@ Rect lerpRect(Rect a, Rect b, double t) { lerpNum(a.left, b.left, t), lerpNum(a.top, b.top, t), lerpNum(a.right, b.right, t), - lerpNum(a.bottom, b.bottom, t)); + lerpNum(a.bottom, b.bottom, t) + ); } From 9e8074528e5677f29f367e9f2cfce352d6881e6c Mon Sep 17 00:00:00 2001 From: Hixie Date: Mon, 17 Aug 2015 10:36:30 -0700 Subject: [PATCH 2/2] Tweak box_painter.dart to match style better. --- .../sky/lib/painting/box_painter.dart | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/sky/packages/sky/lib/painting/box_painter.dart b/sky/packages/sky/lib/painting/box_painter.dart index 7cc5054a940e0..251aea7f229ef 100644 --- a/sky/packages/sky/lib/painting/box_painter.dart +++ b/sky/packages/sky/lib/painting/box_painter.dart @@ -91,9 +91,10 @@ BoxShadow lerpBoxShadow(BoxShadow a, BoxShadow b, double t) { if (b == null) return a.scale(1.0 - t); return new BoxShadow( - color: lerpColor(a.color, b.color, t), - offset: lerpOffset(a.offset, b.offset, t), - blur: lerpNum(a.blur, b.blur, t)); + color: lerpColor(a.color, b.color, t), + offset: lerpOffset(a.offset, b.offset, t), + blur: lerpNum(a.blur, b.blur, t) + ); } List lerpListBoxShadow(List a, List b, double t) { @@ -126,18 +127,19 @@ class LinearGradient extends Gradient { this.tileMode: sky.TileMode.clamp }); - String toString() => - 'LinearGradient($endPoints, $colors, $colorStops, $tileMode)'; - - sky.Shader createShader() { - return new sky.Gradient.linear(this.endPoints, this.colors, this.colorStops, - this.tileMode); - } - final List endPoints; final List colors; final List colorStops; final sky.TileMode tileMode; + + sky.Shader createShader() { + return new sky.Gradient.linear(this.endPoints, this.colors, + this.colorStops, this.tileMode); + } + + String toString() { + return 'LinearGradient($endPoints, $colors, $colorStops, $tileMode)'; + } } class RadialGradient extends Gradient { @@ -149,19 +151,20 @@ class RadialGradient extends Gradient { this.tileMode: sky.TileMode.clamp }); - String toString() => - 'RadialGradient($center, $radius, $colors, $colorStops, $tileMode)'; + final Point center; + final double radius; + final List colors; + final List colorStops; + final sky.TileMode tileMode; sky.Shader createShader() { return new sky.Gradient.radial(this.center, this.radius, this.colors, this.colorStops, this.tileMode); } - final Point center; - final double radius; - final List colors; - final List colorStops; - final sky.TileMode tileMode; + String toString() { + return 'RadialGradient($center, $radius, $colors, $colorStops, $tileMode)'; + } } enum BackgroundFit { fill, contain, cover, none, scaleDown } @@ -358,7 +361,8 @@ class BoxPainter { } void _paintBackgroundColor(sky.Canvas canvas, Rect rect) { - if (_decoration.backgroundColor != null || _decoration.boxShadow != null || + if (_decoration.backgroundColor != null || + _decoration.boxShadow != null || _decoration.gradient != null) { switch (_decoration.shape) { case Shape.circle: