| 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 '../painting/shadows.dart'; |
| 9 import 'package:vector_math/vector_math.dart'; | 10 import 'package:vector_math/vector_math.dart'; |
| 10 import 'package:sky/framework/net/image_cache.dart' as image_cache; | 11 import 'package:sky/framework/net/image_cache.dart' as image_cache; |
| 11 | 12 |
| 12 // GENERIC BOX RENDERING | 13 // GENERIC BOX RENDERING |
| 13 // Anything that has a concept of x, y, width, height is going to derive from th
is | 14 // Anything that has a concept of x, y, width, height is going to derive from th
is |
| 14 | 15 |
| 15 class EdgeDims { | 16 class EdgeDims { |
| 16 // used for e.g. padding | 17 // used for e.g. padding |
| 17 const EdgeDims(this.top, this.right, this.bottom, this.left); | 18 const EdgeDims(this.top, this.right, this.bottom, this.left); |
| 18 const EdgeDims.all(double value) | 19 const EdgeDims.all(double value) |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 | 697 |
| 697 Paint _cachedBackgroundPaint; | 698 Paint _cachedBackgroundPaint; |
| 698 Paint get _backgroundPaint { | 699 Paint get _backgroundPaint { |
| 699 if (_cachedBackgroundPaint == null) { | 700 if (_cachedBackgroundPaint == null) { |
| 700 Paint paint = new Paint(); | 701 Paint paint = new Paint(); |
| 701 | 702 |
| 702 if (_decoration.backgroundColor != null) | 703 if (_decoration.backgroundColor != null) |
| 703 paint.color = _decoration.backgroundColor; | 704 paint.color = _decoration.backgroundColor; |
| 704 | 705 |
| 705 if (_decoration.boxShadow != null) { | 706 if (_decoration.boxShadow != null) { |
| 706 var builder = new sky.LayerDrawLooperBuilder(); | 707 var builder = new ShadowDrawLooperBuilder(); |
| 707 for (BoxShadow boxShadow in _decoration.boxShadow) { | 708 for (BoxShadow boxShadow in _decoration.boxShadow) |
| 708 builder.addLayerOnTop( | 709 builder.addShadow(boxShadow.offset, boxShadow.color, boxShadow.blur); |
| 709 new sky.DrawLooperLayerInfo() | |
| 710 ..setPaintBits(-1) | |
| 711 ..setOffset(boxShadow.offset.toPoint()) | |
| 712 ..setColorMode(sky.TransferMode.srcMode), | |
| 713 (Paint layerPaint) { | |
| 714 layerPaint.color = boxShadow.color; | |
| 715 layerPaint.setMaskFilter( | |
| 716 new sky.MaskFilter.Blur(sky.BlurStyle.normal, | |
| 717 boxShadow.blur, | |
| 718 highQuality: true)); | |
| 719 }); | |
| 720 } | |
| 721 builder.addLayerOnTop(new sky.DrawLooperLayerInfo(), (_) {}); | |
| 722 paint.setDrawLooper(builder.build()); | 710 paint.setDrawLooper(builder.build()); |
| 723 } | 711 } |
| 724 | 712 |
| 725 _cachedBackgroundPaint = paint; | 713 _cachedBackgroundPaint = paint; |
| 726 } | 714 } |
| 727 | 715 |
| 728 return _cachedBackgroundPaint; | 716 return _cachedBackgroundPaint; |
| 729 } | 717 } |
| 730 | 718 |
| 731 void paint(RenderObjectDisplayList canvas) { | 719 void paint(RenderObjectDisplayList canvas) { |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 | 1006 |
| 1019 void defaultPaint(RenderObjectDisplayList canvas) { | 1007 void defaultPaint(RenderObjectDisplayList canvas) { |
| 1020 RenderBox child = firstChild; | 1008 RenderBox child = firstChild; |
| 1021 while (child != null) { | 1009 while (child != null) { |
| 1022 assert(child.parentData is ParentDataType); | 1010 assert(child.parentData is ParentDataType); |
| 1023 canvas.paintChild(child, child.parentData.position); | 1011 canvas.paintChild(child, child.parentData.position); |
| 1024 child = child.parentData.nextSibling; | 1012 child = child.parentData.nextSibling; |
| 1025 } | 1013 } |
| 1026 } | 1014 } |
| 1027 } | 1015 } |
| OLD | NEW |