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

Unified Diff: sky/sdk/lib/painting/box_painter.dart

Issue 1212343009: SkyDemo.apk should show thumbmails when offline (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/sdk/example/demo_launcher/lib/main.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/painting/box_painter.dart
diff --git a/sky/sdk/lib/painting/box_painter.dart b/sky/sdk/lib/painting/box_painter.dart
index 4ce567f51fba1d3bb3120105137806d7a49310c4..a8a92abf30f0cfa82a00f2fe1a16cce3b59b672b 100644
--- a/sky/sdk/lib/painting/box_painter.dart
+++ b/sky/sdk/lib/painting/box_painter.dart
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import 'dart:async';
import 'dart:math' as math;
import 'dart:sky' as sky;
import 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path;
@@ -140,19 +141,18 @@ enum BackgroundRepeat { repeat, repeatX, repeatY, noRepeat }
// to do animated images.
class BackgroundImage {
- final String src;
final BackgroundFit fit;
final BackgroundRepeat repeat;
BackgroundImage({
- this.src,
+ Future<sky.Image> image,
this.fit: BackgroundFit.scaleDown,
this.repeat: BackgroundRepeat.noRepeat
}) {
- image_cache.load(src).then((image) {
- if (image == null)
+ image.then((resolvedImage) {
+ if (resolvedImage == null)
return;
- _image = image;
- _size = new Size(image.width.toDouble(), image.height.toDouble());
+ _image = resolvedImage;
+ _size = new Size(resolvedImage.width.toDouble(), resolvedImage.height.toDouble());
for (Function listener in _listeners) {
listener();
}
@@ -174,7 +174,7 @@ class BackgroundImage {
_listeners.remove(listener);
}
- String toString() => 'BackgroundImage($src, $fit, $repeat)';
+ String toString() => 'BackgroundImage($fit, $repeat)';
}
enum Shape { rectangle, circle }
« no previous file with comments | « sky/sdk/example/demo_launcher/lib/main.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698