| 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 | 7 |
| 8 import 'package:vector_math/vector_math.dart'; | 8 import 'package:vector_math/vector_math.dart'; |
| 9 | 9 |
| 10 import '../base/debug.dart'; | 10 import '../base/debug.dart'; |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 | 959 |
| 960 RenderDecoratedBox({ | 960 RenderDecoratedBox({ |
| 961 BoxDecoration decoration, | 961 BoxDecoration decoration, |
| 962 RenderBox child | 962 RenderBox child |
| 963 }) : _painter = new BoxPainter(decoration), super(child); | 963 }) : _painter = new BoxPainter(decoration), super(child); |
| 964 | 964 |
| 965 BoxPainter _painter; | 965 BoxPainter _painter; |
| 966 BoxDecoration get decoration => _painter.decoration; | 966 BoxDecoration get decoration => _painter.decoration; |
| 967 void set decoration (BoxDecoration value) { | 967 void set decoration (BoxDecoration value) { |
| 968 assert(value != null); | 968 assert(value != null); |
| 969 if (_painter.decoration.backgroundImage != null) |
| 970 _painter.decoration.backgroundImage.removeChangeListener(markNeedsPaint); |
| 971 if (value.backgroundImage != null) |
| 972 value.backgroundImage.addChangeListener(markNeedsPaint); |
| 969 if (value == _painter.decoration) | 973 if (value == _painter.decoration) |
| 970 return; | 974 return; |
| 971 _painter.decoration = value; | 975 _painter.decoration = value; |
| 972 markNeedsPaint(); | 976 markNeedsPaint(); |
| 973 } | 977 } |
| 974 | 978 |
| 975 void paint(PaintingCanvas canvas, Offset offset) { | 979 void paint(PaintingCanvas canvas, Offset offset) { |
| 976 assert(size.width != null); | 980 assert(size.width != null); |
| 977 assert(size.height != null); | 981 assert(size.height != null); |
| 978 _painter.paint(canvas, offset & size); | 982 _painter.paint(canvas, offset & size); |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 | 1261 |
| 1258 void defaultPaint(PaintingCanvas canvas, Offset offset) { | 1262 void defaultPaint(PaintingCanvas canvas, Offset offset) { |
| 1259 RenderBox child = firstChild; | 1263 RenderBox child = firstChild; |
| 1260 while (child != null) { | 1264 while (child != null) { |
| 1261 assert(child.parentData is ParentDataType); | 1265 assert(child.parentData is ParentDataType); |
| 1262 canvas.paintChild(child, child.parentData.position + offset); | 1266 canvas.paintChild(child, child.parentData.position + offset); |
| 1263 child = child.parentData.nextSibling; | 1267 child = child.parentData.nextSibling; |
| 1264 } | 1268 } |
| 1265 } | 1269 } |
| 1266 } | 1270 } |
| OLD | NEW |