| 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 '../base/hit_test.dart'; | 9 import '../base/hit_test.dart'; |
| 10 import '../base/node.dart'; | 10 import '../base/node.dart'; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 void merge(ParentData other) { | 22 void merge(ParentData other) { |
| 23 // override this in subclasses to merge in data from other into this | 23 // override this in subclasses to merge in data from other into this |
| 24 assert(other.runtimeType == this.runtimeType); | 24 assert(other.runtimeType == this.runtimeType); |
| 25 } | 25 } |
| 26 String toString() => '<none>'; | 26 String toString() => '<none>'; |
| 27 } | 27 } |
| 28 | 28 |
| 29 class RenderCanvas extends sky.Canvas { | 29 class RenderCanvas extends sky.Canvas { |
| 30 RenderCanvas(sky.PictureRecorder recorder, Size bounds) : super(recorder, boun
ds); | 30 RenderCanvas(sky.PictureRecorder recorder, Size bounds) : super(recorder, boun
ds); |
| 31 | 31 |
| 32 void paintChild(RenderObject child, Point position) { | 32 void paintChild(RenderObject child, Point point) { |
| 33 translate(position.x, position.y); | 33 child.paint(this, point.toOffset()); |
| 34 child.paint(this); | |
| 35 translate(-position.x, -position.y); | |
| 36 } | 34 } |
| 37 } | 35 } |
| 38 | 36 |
| 39 abstract class Constraints { | 37 abstract class Constraints { |
| 40 const Constraints(); | 38 const Constraints(); |
| 41 bool get isTight; | 39 bool get isTight; |
| 42 } | 40 } |
| 43 | 41 |
| 44 abstract class RenderObject extends AbstractNode implements HitTestTarget { | 42 abstract class RenderObject extends AbstractNode implements HitTestTarget { |
| 45 | 43 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 }) { } | 236 }) { } |
| 239 | 237 |
| 240 | 238 |
| 241 // PAINTING | 239 // PAINTING |
| 242 | 240 |
| 243 static bool debugDoingPaint = false; | 241 static bool debugDoingPaint = false; |
| 244 void markNeedsPaint() { | 242 void markNeedsPaint() { |
| 245 assert(!debugDoingPaint); | 243 assert(!debugDoingPaint); |
| 246 scheduler.ensureVisualUpdate(); | 244 scheduler.ensureVisualUpdate(); |
| 247 } | 245 } |
| 248 void paint(RenderCanvas canvas) { } | 246 void paint(RenderCanvas canvas, Offset offset) { } |
| 249 | 247 |
| 250 | 248 |
| 251 // EVENTS | 249 // EVENTS |
| 252 | 250 |
| 253 void handleEvent(sky.Event event, HitTestEntry entry) { | 251 void handleEvent(sky.Event event, HitTestEntry entry) { |
| 254 // override this if you have a client, to hand it to the client | 252 // override this if you have a client, to hand it to the client |
| 255 // override this if you want to do anything with the event | 253 // override this if you want to do anything with the event |
| 256 } | 254 } |
| 257 | 255 |
| 258 | 256 |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 int count = 1; | 529 int count = 1; |
| 532 ChildType child = _firstChild; | 530 ChildType child = _firstChild; |
| 533 while (child != null) { | 531 while (child != null) { |
| 534 result += '${prefix}child ${count}: ${child.toString(prefix)}'; | 532 result += '${prefix}child ${count}: ${child.toString(prefix)}'; |
| 535 count += 1; | 533 count += 1; |
| 536 child = child.parentData.nextSibling; | 534 child = child.parentData.nextSibling; |
| 537 } | 535 } |
| 538 return result; | 536 return result; |
| 539 } | 537 } |
| 540 } | 538 } |
| OLD | NEW |