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

Side by Side Diff: client/samples/spirodraw/ColorPicker.dart

Issue 8231031: Check for compile-time constants in DartCompiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Feedback from floitsch Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 typedef void PickerListener(String selectedColor); 5 typedef void PickerListener(String selectedColor);
6 6
7 class ColorPicker { 7 class ColorPicker {
8 8
9 static final hexValues = ['00', '33', '66', '99', 'CC', 'FF']; 9 static final hexValues = const ['00', '33', '66', '99', 'CC', 'FF'];
10 static final COLS = 18; 10 static final COLS = 18;
11 // Block height, width, padding 11 // Block height, width, padding
12 static final BH = 10; 12 static final BH = 10;
13 static final BW = 10; 13 static final BW = 10;
14 static final BP = 1; 14 static final BP = 1;
15 final List<PickerListener> _listeners; 15 final List<PickerListener> _listeners;
16 HTMLCanvasElement canvasElement; 16 HTMLCanvasElement canvasElement;
17 String _selectedColor = 'red'; 17 String _selectedColor = 'red';
18 final height = 160; 18 final height = 160;
19 final width = 180; 19 final width = 180;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 104 }
105 105
106 String getHexString(int i) { 106 String getHexString(int i) {
107 int r = i ~/ 36; 107 int r = i ~/ 36;
108 int g = (i % 36) ~/ 6; 108 int g = (i % 36) ~/ 6;
109 int b = i % 6; 109 int b = i % 6;
110 return '#${hexValues[r]}${hexValues[g]}${hexValues[b]}'; 110 return '#${hexValues[r]}${hexValues[g]}${hexValues[b]}';
111 } 111 }
112 112
113 } 113 }
OLDNEW
« no previous file with comments | « no previous file | client/samples/sunflower/Sunflower.dart » ('j') | compiler/java/com/google/dart/compiler/ast/DartExpression.java » ('J')

Powered by Google App Engine
This is Rietveld 408576698