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

Side by Side Diff: sky/sdk/lib/painting/box_painter.dart

Issue 1216303005: Convert image_cache to using Futures rather than callbacks (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix _loadComplete 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 unified diff | Download patch
« no previous file with comments | « sky/sdk/lib/mojo/net/image_cache.dart ('k') | sky/sdk/lib/rendering/box.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/mojo/net/image_cache.dart ('k') | sky/sdk/lib/rendering/box.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698