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

Unified Diff: sky/sdk/lib/example/rendering/touch_demo.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, 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 side-by-side diff with in-line comments
Download patch
Index: sky/sdk/lib/example/rendering/touch_demo.dart
diff --git a/sky/sdk/lib/example/rendering/touch_demo.dart b/sky/sdk/lib/example/rendering/touch_demo.dart
index c3a54697f393273d5ebe27b348b9582b93c0e204..eb59da4fe7014f896732132a18567a97f64be1d3 100644
--- a/sky/sdk/lib/example/rendering/touch_demo.dart
+++ b/sky/sdk/lib/example/rendering/touch_demo.dart
@@ -33,8 +33,8 @@ class Dot {
radius = 5 + (95 * event.pressure);
}
- void paint(RenderCanvas canvas) {
- canvas.drawCircle(position, radius, _paint);
+ void paint(RenderCanvas canvas, Offset offset) {
+ canvas.drawCircle(position + offset, radius, _paint);
}
}
@@ -68,11 +68,12 @@ class RenderTouchDemo extends RenderBox {
size = constraints.biggest;
}
- void paint(RenderCanvas canvas) {
- Paint white = new Paint()..color = const Color(0xFFFFFFFF);
- canvas.drawRect(new Rect.fromSize(size), white);
+ void paint(RenderCanvas canvas, Offset offset) {
+ Paint white = new Paint()
+ ..color = const Color(0xFFFFFFFF);
+ canvas.drawRect(offset + size, white);
for (Dot dot in dots.values)
- dot.paint(canvas);
+ dot.paint(canvas, offset);
}
}

Powered by Google App Engine
This is Rietveld 408576698