| 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 'shadows.dart'; | 9 import 'shadows.dart'; |
| 10 import 'package:sky/mojo/net/image_cache.dart' as image_cache; | 10 import 'package:sky/mojo/net/image_cache.dart' as image_cache; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 class BackgroundImage { | 134 class BackgroundImage { |
| 135 final String src; | 135 final String src; |
| 136 final BackgroundFit fit; | 136 final BackgroundFit fit; |
| 137 final BackgroundRepeat repeat; | 137 final BackgroundRepeat repeat; |
| 138 BackgroundImage({ | 138 BackgroundImage({ |
| 139 this.src, | 139 this.src, |
| 140 this.fit: BackgroundFit.scaleDown, | 140 this.fit: BackgroundFit.scaleDown, |
| 141 this.repeat: BackgroundRepeat.noRepeat | 141 this.repeat: BackgroundRepeat.noRepeat |
| 142 }) { | 142 }) { |
| 143 image_cache.load(src, (image) { | 143 image_cache.load(src).then((image) { |
| 144 if (image == null) | 144 if (image == null) |
| 145 return; | 145 return; |
| 146 _image = image; | 146 _image = image; |
| 147 _size = new Size(image.width.toDouble(), image.height.toDouble()); | 147 _size = new Size(image.width.toDouble(), image.height.toDouble()); |
| 148 for (Function listener in _listeners) { | 148 for (Function listener in _listeners) { |
| 149 listener(); | 149 listener(); |
| 150 } | 150 } |
| 151 }); | 151 }); |
| 152 } | 152 } |
| 153 | 153 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 path.close(); | 373 path.close(); |
| 374 canvas.drawPath(path, paint); | 374 canvas.drawPath(path, paint); |
| 375 } | 375 } |
| 376 | 376 |
| 377 void paint(sky.Canvas canvas, Rect rect) { | 377 void paint(sky.Canvas canvas, Rect rect) { |
| 378 _paintBackgroundColor(canvas, rect); | 378 _paintBackgroundColor(canvas, rect); |
| 379 _paintBackgroundImage(canvas, rect); | 379 _paintBackgroundImage(canvas, rect); |
| 380 _paintBorder(canvas, rect); | 380 _paintBorder(canvas, rect); |
| 381 } | 381 } |
| 382 } | 382 } |
| OLD | NEW |