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

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

Issue 1209413004: Instead of applying a transform for every RenderObject, pass down an Offset for where to paint. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(RenderCanvas canvas) { 91 void paint(RenderCanvas canvas, Offset offset) {
92 if (!_splashes.isEmpty) { 92 if (!_splashes.isEmpty) {
93 canvas.save(); 93 canvas.save();
94 canvas.translate(offset.dx, offset.dy);
94 canvas.clipRect(new Rect.fromSize(size)); 95 canvas.clipRect(new Rect.fromSize(size));
95 for (InkSplash splash in _splashes) 96 for (InkSplash splash in _splashes)
96 splash.paint(canvas); 97 splash.paint(canvas);
97 canvas.restore(); 98 canvas.restore();
98 } 99 }
99 super.paint(canvas); 100 super.paint(canvas, offset);
100 } 101 }
101 } 102 }
102 103
103 class InkWell extends OneChildRenderObjectWrapper { 104 class InkWell extends OneChildRenderObjectWrapper {
104 InkWell({ String key, Widget child }) 105 InkWell({ String key, Widget child })
105 : super(key: key, child: child); 106 : super(key: key, child: child);
106 107
107 RenderInkWell get root => super.root; 108 RenderInkWell get root => super.root;
108 RenderInkWell createNode() => new RenderInkWell(); 109 RenderInkWell createNode() => new RenderInkWell();
109 } 110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698