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

Side by Side Diff: sky/sdk/lib/framework/components2/checkbox.dart

Issue 1172413002: Enable antialiasing on Paint by default. (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
« no previous file with comments | « sky/engine/core/painting/Paint.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 'package:sky/framework/theme2/colors.dart' as colors; 5 import 'package:sky/framework/theme2/colors.dart' as colors;
6 6
7 import 'dart:sky' as sky; 7 import 'dart:sky' as sky;
8 import '../fn2.dart'; 8 import '../fn2.dart';
9 import '../rendering/box.dart'; 9 import '../rendering/box.dart';
10 import '../rendering/object.dart'; 10 import '../rendering/object.dart';
(...skipping 25 matching lines...) Expand all
36 const double edgeRadius = 1.0; 36 const double edgeRadius = 1.0;
37 return new EventListenerNode( 37 return new EventListenerNode(
38 new Container( 38 new Container(
39 margin: const EdgeDims.symmetric(horizontal: 5.0), 39 margin: const EdgeDims.symmetric(horizontal: 5.0),
40 width: edgeSize + 2.0, 40 width: edgeSize + 2.0,
41 height: edgeSize + 2.0, 41 height: edgeSize + 2.0,
42 child: new CustomPaint( 42 child: new CustomPaint(
43 callback: (sky.Canvas canvas) { 43 callback: (sky.Canvas canvas) {
44 44
45 sky.Paint paint = new sky.Paint()..color = color 45 sky.Paint paint = new sky.Paint()..color = color
46 ..isAntiAlias = true
47 ..strokeWidth = 2.0; 46 ..strokeWidth = 2.0;
48 47
49 // Draw the outer rrect 48 // Draw the outer rrect
50 paint.setStyle(checked ? sky.PaintingStyle.strokeAndFill : sky.Paint ingStyle.stroke); 49 paint.setStyle(checked ? sky.PaintingStyle.strokeAndFill : sky.Paint ingStyle.stroke);
51 sky.Rect rect = new sky.Rect.fromLTRB(0.0, 0.0, edgeSize, edgeSize); 50 sky.Rect rect = new sky.Rect.fromLTRB(0.0, 0.0, edgeSize, edgeSize);
52 sky.RRect rrect = new sky.RRect()..setRectXY(rect, edgeRadius, edgeR adius); 51 sky.RRect rrect = new sky.RRect()..setRectXY(rect, edgeRadius, edgeR adius);
53 canvas.drawRRect(rrect, paint); 52 canvas.drawRRect(rrect, paint);
54 53
55 // Draw the inner check 54 // Draw the inner check
56 if (checked) { 55 if (checked) {
57 // TODO(jackson): Use the theme color 56 // TODO(jackson): Use the theme color
58 paint.color = const sky.Color(0xFFFFFFFF); 57 paint.color = const sky.Color(0xFFFFFFFF);
59 paint.setStyle(sky.PaintingStyle.stroke); 58 paint.setStyle(sky.PaintingStyle.stroke);
60 sky.Path path = new sky.Path(); 59 sky.Path path = new sky.Path();
61 path.moveTo(edgeSize * 0.2, edgeSize * 0.5); 60 path.moveTo(edgeSize * 0.2, edgeSize * 0.5);
62 path.lineTo(edgeSize * 0.4, edgeSize * 0.7); 61 path.lineTo(edgeSize * 0.4, edgeSize * 0.7);
63 path.lineTo(edgeSize * 0.8, edgeSize * 0.3); 62 path.lineTo(edgeSize * 0.8, edgeSize * 0.3);
64 canvas.drawPath(path, paint); 63 canvas.drawPath(path, paint);
65 } 64 }
66 } 65 }
67 ) 66 )
68 ), 67 ),
69 onGestureTap: _handleClick 68 onGestureTap: _handleClick
70 ); 69 );
71 } 70 }
72 71
73 } 72 }
OLDNEW
« no previous file with comments | « sky/engine/core/painting/Paint.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698