Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: sky/sdk/lib/framework/rendering/box.dart

Issue 1175683002: Add a shadow to the FloatingActionButton. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 '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 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 695
695 Paint _cachedBackgroundPaint; 696 Paint _cachedBackgroundPaint;
696 Paint get _backgroundPaint { 697 Paint get _backgroundPaint {
697 if (_cachedBackgroundPaint == null) { 698 if (_cachedBackgroundPaint == null) {
698 Paint paint = new Paint(); 699 Paint paint = new Paint();
699 700
700 if (_decoration.backgroundColor != null) 701 if (_decoration.backgroundColor != null)
701 paint.color = _decoration.backgroundColor; 702 paint.color = _decoration.backgroundColor;
702 703
703 if (_decoration.boxShadow != null) { 704 if (_decoration.boxShadow != null) {
704 var builder = new sky.LayerDrawLooperBuilder(); 705 var builder = new ShadowDrawLooperBuilder();
705 for (BoxShadow boxShadow in _decoration.boxShadow) { 706 for (BoxShadow boxShadow in _decoration.boxShadow)
706 builder.addLayerOnTop( 707 builder.addShadow(boxShadow.offset, boxShadow.color, boxShadow.blur);
707 new sky.DrawLooperLayerInfo()
708 ..setPaintBits(-1)
709 ..setOffset(boxShadow.offset.toPoint())
710 ..setColorMode(sky.TransferMode.srcMode),
711 (Paint layerPaint) {
712 layerPaint.color = boxShadow.color;
713 layerPaint.setMaskFilter(
714 new sky.MaskFilter.Blur(sky.BlurStyle.normal,
715 boxShadow.blur,
716 highQuality: true));
717 });
718 }
719 builder.addLayerOnTop(new sky.DrawLooperLayerInfo(), (_) {});
720 paint.setDrawLooper(builder.build()); 708 paint.setDrawLooper(builder.build());
721 } 709 }
722 710
723 _cachedBackgroundPaint = paint; 711 _cachedBackgroundPaint = paint;
724 } 712 }
725 713
726 return _cachedBackgroundPaint; 714 return _cachedBackgroundPaint;
727 } 715 }
728 716
729 void paint(RenderObjectDisplayList canvas) { 717 void paint(RenderObjectDisplayList canvas) {
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 997
1010 void defaultPaint(RenderObjectDisplayList canvas) { 998 void defaultPaint(RenderObjectDisplayList canvas) {
1011 RenderBox child = firstChild; 999 RenderBox child = firstChild;
1012 while (child != null) { 1000 while (child != null) {
1013 assert(child.parentData is ParentDataType); 1001 assert(child.parentData is ParentDataType);
1014 canvas.paintChild(child, child.parentData.position); 1002 canvas.paintChild(child, child.parentData.position);
1015 child = child.parentData.nextSibling; 1003 child = child.parentData.nextSibling;
1016 } 1004 }
1017 } 1005 }
1018 } 1006 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698