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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 return paint; | 659 return paint; |
660 } | 660 } |
661 | 661 |
662 void paint(RenderObjectDisplayList canvas) { | 662 void paint(RenderObjectDisplayList canvas) { |
663 sky.Paint paint = _createShadowPaint(_shadow); | 663 sky.Paint paint = _createShadowPaint(_shadow); |
664 canvas.drawRect(new sky.Rect.fromLTRB(0.0, 0.0, size.width, size.height), pa
int); | 664 canvas.drawRect(new sky.Rect.fromLTRB(0.0, 0.0, size.width, size.height), pa
int); |
665 super.paint(canvas); | 665 super.paint(canvas); |
666 } | 666 } |
667 } | 667 } |
668 | 668 |
| 669 typedef void CustomPaintCallback(RenderObjectDisplayList canvas); |
| 670 |
| 671 class RenderCustomPaint extends RenderProxyBox { |
| 672 |
| 673 RenderCustomPaint({ |
| 674 CustomPaintCallback callback, |
| 675 RenderBox child |
| 676 }) : super(child) { |
| 677 assert(callback != null); |
| 678 _callback = callback; |
| 679 } |
| 680 |
| 681 CustomPaintCallback _callback; |
| 682 void set callback (CustomPaintCallback value) { |
| 683 assert(value != null); |
| 684 if (_callback == value) |
| 685 return; |
| 686 _callback = value; |
| 687 markNeedsPaint(); |
| 688 } |
| 689 |
| 690 void paint(RenderObjectDisplayList canvas) { |
| 691 _callback(canvas); |
| 692 super.paint(canvas); |
| 693 } |
| 694 } |
| 695 |
669 // RENDER VIEW LAYOUT MANAGER | 696 // RENDER VIEW LAYOUT MANAGER |
670 | 697 |
671 class ViewConstraints { | 698 class ViewConstraints { |
672 | 699 |
673 const ViewConstraints({ | 700 const ViewConstraints({ |
674 this.width: 0.0, this.height: 0.0, this.orientation: null | 701 this.width: 0.0, this.height: 0.0, this.orientation: null |
675 }); | 702 }); |
676 | 703 |
677 final double width; | 704 final double width; |
678 final double height; | 705 final double height; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 | 793 |
767 void defaultPaint(RenderObjectDisplayList canvas) { | 794 void defaultPaint(RenderObjectDisplayList canvas) { |
768 RenderBox child = firstChild; | 795 RenderBox child = firstChild; |
769 while (child != null) { | 796 while (child != null) { |
770 assert(child.parentData is ParentDataType); | 797 assert(child.parentData is ParentDataType); |
771 canvas.paintChild(child, child.parentData.position); | 798 canvas.paintChild(child, child.parentData.position); |
772 child = child.parentData.nextSibling; | 799 child = child.parentData.nextSibling; |
773 } | 800 } |
774 } | 801 } |
775 } | 802 } |
OLD | NEW |