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

Side by Side Diff: sky/sdk/lib/framework/widgets/ink_well.dart

Issue 1190123003: Decouple Canvas from DisplayList and map Picture and PictureRecorder more directly to their Skia co… (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 7
8 import '../animation/animated_value.dart'; 8 import '../animation/animated_value.dart';
9 import '../animation/curves.dart'; 9 import '../animation/curves.dart';
10 import '../rendering/box.dart'; 10 import '../rendering/box.dart';
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 return; 46 return;
47 _radius.animateTo(_targetRadius, duration, curve: easeOut); 47 _radius.animateTo(_targetRadius, duration, curve: easeOut);
48 } 48 }
49 49
50 void _handleRadiusChange() { 50 void _handleRadiusChange() {
51 if (_radius.value == _targetRadius) 51 if (_radius.value == _targetRadius)
52 well._splashes.remove(this); 52 well._splashes.remove(this);
53 well.markNeedsPaint(); 53 well.markNeedsPaint();
54 } 54 }
55 55
56 void paint(RenderObjectDisplayList canvas) { 56 void paint(sky.Canvas canvas) {
57 int opacity = (_kSplashInitialOpacity * (1.0 - (_radius.value / _targetRadiu s))).floor(); 57 int opacity = (_kSplashInitialOpacity * (1.0 - (_radius.value / _targetRadiu s))).floor();
58 sky.Paint paint = new sky.Paint()..color = new sky.Color(opacity << 24); 58 sky.Paint paint = new sky.Paint()..color = new sky.Color(opacity << 24);
59 canvas.drawCircle(position.x, position.y, _radius.value, paint); 59 canvas.drawCircle(position.x, position.y, _radius.value, paint);
60 } 60 }
61 } 61 }
62 62
63 class RenderInkWell extends RenderProxyBox { 63 class RenderInkWell extends RenderProxyBox {
64 RenderInkWell({ RenderBox child }) : super(child); 64 RenderInkWell({ RenderBox child }) : super(child);
65 65
66 final List<InkSplash> _splashes = new List<InkSplash>(); 66 final List<InkSplash> _splashes = new List<InkSplash>();
(...skipping 14 matching lines...) Expand all
81 _splashes.add(new InkSplash(pointer, position, this)); 81 _splashes.add(new InkSplash(pointer, position, this));
82 markNeedsPaint(); 82 markNeedsPaint();
83 } 83 }
84 84
85 void _confirmSplash(int pointer) { 85 void _confirmSplash(int pointer) {
86 _splashes.where((splash) => splash.pointer == pointer) 86 _splashes.where((splash) => splash.pointer == pointer)
87 .forEach((splash) { splash.confirm(); }); 87 .forEach((splash) { splash.confirm(); });
88 markNeedsPaint(); 88 markNeedsPaint();
89 } 89 }
90 90
91 void paint(RenderObjectDisplayList canvas) { 91 void paint(sky.Canvas canvas) {
92 if (!_splashes.isEmpty) { 92 if (!_splashes.isEmpty) {
93 canvas.save(); 93 canvas.save();
94 canvas.clipRect(new Rect.fromSize(size)); 94 canvas.clipRect(new Rect.fromSize(size));
95 for (InkSplash splash in _splashes) 95 for (InkSplash splash in _splashes)
96 splash.paint(canvas); 96 splash.paint(canvas);
97 canvas.restore(); 97 canvas.restore();
98 } 98 }
99 super.paint(canvas); 99 super.paint(canvas);
100 } 100 }
101 } 101 }
(...skipping 15 matching lines...) Expand all
117 UINode build() { 117 UINode build() {
118 return new InkWellWrapper( 118 return new InkWellWrapper(
119 child: new Flex( 119 child: new Flex(
120 children, 120 children,
121 direction: FlexDirection.horizontal, 121 direction: FlexDirection.horizontal,
122 justifyContent: FlexJustifyContent.center 122 justifyContent: FlexJustifyContent.center
123 ) 123 )
124 ); 124 );
125 } 125 }
126 } 126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698