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

Side by Side Diff: sky/sdk/lib/painting/box_painter.dart

Issue 1216013003: Fix the floating action button. (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
« no previous file with comments | « sky/engine/core/painting/Rect.dart ('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 'dart:math' as math; 5 import 'dart:math' as math;
6 import 'dart:sky' as sky; 6 import 'dart:sky' as sky;
7 import 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path; 7 import 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path;
8 8
9 import 'shadows.dart'; 9 import 'shadows.dart';
10 10
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 return _cachedBackgroundPaint; 200 return _cachedBackgroundPaint;
201 } 201 }
202 202
203 void paint(sky.Canvas canvas, Rect rect) { 203 void paint(sky.Canvas canvas, Rect rect) {
204 if (_decoration.backgroundColor != null || _decoration.boxShadow != null || 204 if (_decoration.backgroundColor != null || _decoration.boxShadow != null ||
205 _decoration.gradient != null) { 205 _decoration.gradient != null) {
206 switch (_decoration.shape) { 206 switch (_decoration.shape) {
207 case Shape.circle: 207 case Shape.circle:
208 assert(_decoration.borderRadius == null); 208 assert(_decoration.borderRadius == null);
209 Point center = rect.center; 209 Point center = rect.center;
210 Size size = rect.size; 210 double radius = rect.shortestSide / 2.0;
211 double radius = math.min(size.width, size.height) / 2.0;
212 canvas.drawCircle(center, radius, _backgroundPaint); 211 canvas.drawCircle(center, radius, _backgroundPaint);
213 break; 212 break;
214 case Shape.rectangle: 213 case Shape.rectangle:
215 if (_decoration.borderRadius == null) 214 if (_decoration.borderRadius == null)
216 canvas.drawRect(rect, _backgroundPaint); 215 canvas.drawRect(rect, _backgroundPaint);
217 else 216 else
218 canvas.drawRRect(new sky.RRect()..setRectXY(rect, _decoration.border Radius, _decoration.borderRadius), _backgroundPaint); 217 canvas.drawRRect(new sky.RRect()..setRectXY(rect, _decoration.border Radius, _decoration.borderRadius), _backgroundPaint);
219 break; 218 break;
220 } 219 }
221 } 220 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 path = new Path(); 262 path = new Path();
264 path.moveTo(rect.left, rect.bottom); 263 path.moveTo(rect.left, rect.bottom);
265 path.lineTo(rect.left + _decoration.border.left.width, rect.bottom - _deco ration.border.bottom.width); 264 path.lineTo(rect.left + _decoration.border.left.width, rect.bottom - _deco ration.border.bottom.width);
266 path.lineTo(rect.left + _decoration.border.left.width, rect.top + _decorat ion.border.top.width); 265 path.lineTo(rect.left + _decoration.border.left.width, rect.top + _decorat ion.border.top.width);
267 path.lineTo(rect.left, rect.top); 266 path.lineTo(rect.left, rect.top);
268 path.close(); 267 path.close();
269 canvas.drawPath(path, paint); 268 canvas.drawPath(path, paint);
270 } 269 }
271 } 270 }
272 } 271 }
OLDNEW
« no previous file with comments | « sky/engine/core/painting/Rect.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698