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

Side by Side Diff: test/codegen/sunflower/painter.dart

Issue 1147053003: Modified sunflower (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebased 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
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library painter;
6
7 import 'dom.dart';
8 import 'dart:math';
9
10 import 'circle.dart';
11
12 const ORANGE = "orange";
13 const RED = "red";
14 const BLUE = "blue";
15 const TAU = PI * 2;
16
17 Element querySelector(String selector) => document.querySelector(selector);
Jennifer Messerly 2015/05/28 21:04:22 move this to dom.dart?
vsm 2015/05/29 13:23:01 Moved it to sunflower - I've been using the type o
18
19 final canvas = querySelector("#canvas") as CanvasElement;
20 final context = canvas.getContext('2d') as CanvasRenderingContext2D;
Jennifer Messerly 2015/05/28 21:04:22 I wonder if "context" should be an input to "draw"
vsm 2015/05/29 13:23:01 Done. Moved to these to sunflower and passing in
21
22 abstract class CirclePainter implements Circle {
23 // This demonstrates a field in a mixin.
24 String color = ORANGE;
25
26 /// Draw a small circle representing a seed centered at (x,y).
27 void draw() {
28 context
29 ..beginPath()
30 ..lineWidth = 2
31 ..fillStyle = color
32 ..strokeStyle = color
33 ..arc(x, y, radius, 0, TAU, false)
34 ..fill()
35 ..closePath()
36 ..stroke();
37 }
38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698