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

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: moved to painting/ 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
« no previous file with comments | « sky/sdk/lib/framework/painting/shadows.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 '../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
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
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 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/painting/shadows.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698