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:typed_data'; | 7 import 'dart:typed_data'; |
8 import 'object.dart'; | 8 import 'object.dart'; |
9 import 'package:vector_math/vector_math.dart'; | 9 import 'package:vector_math/vector_math.dart'; |
10 import 'package:sky/framework/net/image_cache.dart' as image_cache; | 10 import 'package:sky/framework/net/image_cache.dart' as image_cache; |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 return paint; | 651 return paint; |
652 } | 652 } |
653 | 653 |
654 void paint(RenderObjectDisplayList canvas) { | 654 void paint(RenderObjectDisplayList canvas) { |
655 sky.Paint paint = _createShadowPaint(_shadow); | 655 sky.Paint paint = _createShadowPaint(_shadow); |
656 canvas.drawRect(new sky.Rect.fromLTRB(0.0, 0.0, size.width, size.height), pa
int); | 656 canvas.drawRect(new sky.Rect.fromLTRB(0.0, 0.0, size.width, size.height), pa
int); |
657 super.paint(canvas); | 657 super.paint(canvas); |
658 } | 658 } |
659 } | 659 } |
660 | 660 |
| 661 typedef void CustomPaintCallback(RenderObjectDisplayList canvas); |
| 662 |
| 663 class RenderCustomPaint extends RenderProxyBox { |
| 664 |
| 665 RenderCustomPaint({ |
| 666 CustomPaintCallback callback, |
| 667 RenderBox child |
| 668 }) : super(child) { |
| 669 assert(callback != null); |
| 670 _callback = callback; |
| 671 } |
| 672 |
| 673 CustomPaintCallback _callback; |
| 674 void set callback (CustomPaintCallback value) { |
| 675 assert(value != null); |
| 676 if (_callback == value) |
| 677 return; |
| 678 _callback = value; |
| 679 markNeedsPaint(); |
| 680 } |
| 681 |
| 682 void paint(RenderObjectDisplayList canvas) { |
| 683 _callback(canvas); |
| 684 super.paint(canvas); |
| 685 } |
| 686 } |
| 687 |
661 // RENDER VIEW LAYOUT MANAGER | 688 // RENDER VIEW LAYOUT MANAGER |
662 | 689 |
663 class ViewConstraints { | 690 class ViewConstraints { |
664 | 691 |
665 const ViewConstraints({ | 692 const ViewConstraints({ |
666 this.width: 0.0, this.height: 0.0, this.orientation: null | 693 this.width: 0.0, this.height: 0.0, this.orientation: null |
667 }); | 694 }); |
668 | 695 |
669 final double width; | 696 final double width; |
670 final double height; | 697 final double height; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 | 785 |
759 void defaultPaint(RenderObjectDisplayList canvas) { | 786 void defaultPaint(RenderObjectDisplayList canvas) { |
760 RenderBox child = firstChild; | 787 RenderBox child = firstChild; |
761 while (child != null) { | 788 while (child != null) { |
762 assert(child.parentData is ParentDataType); | 789 assert(child.parentData is ParentDataType); |
763 canvas.paintChild(child, child.parentData.position); | 790 canvas.paintChild(child, child.parentData.position); |
764 child = child.parentData.nextSibling; | 791 child = child.parentData.nextSibling; |
765 } | 792 } |
766 } | 793 } |
767 } | 794 } |
OLD | NEW |