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

Side by Side Diff: ui/views/animation/ink_drop_mask.cc

Issue 2832223003: Update profile switcher button on Linux. (Closed)
Patch Set: self review Created 3 years, 7 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "ui/views/animation/ink_drop_mask.h" 5 #include "ui/views/animation/ink_drop_mask.h"
6 6
7 #include "cc/paint/paint_flags.h" 7 #include "cc/paint/paint_flags.h"
8 #include "ui/compositor/paint_recorder.h" 8 #include "ui/compositor/paint_recorder.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 10
(...skipping 17 matching lines...) Expand all
28 layer_.SetBounds(gfx::Rect(new_layer_size)); 28 layer_.SetBounds(gfx::Rect(new_layer_size));
29 } 29 }
30 30
31 void InkDropMask::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) {} 31 void InkDropMask::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) {}
32 32
33 void InkDropMask::OnDeviceScaleFactorChanged(float device_scale_factor) {} 33 void InkDropMask::OnDeviceScaleFactorChanged(float device_scale_factor) {}
34 34
35 // RoundRectInkDropMask 35 // RoundRectInkDropMask
36 36
37 RoundRectInkDropMask::RoundRectInkDropMask(const gfx::Size& layer_size, 37 RoundRectInkDropMask::RoundRectInkDropMask(const gfx::Size& layer_size,
38 const gfx::Insets& mask_insets, 38 const gfx::InsetsF& mask_insets,
39 int corner_radius) 39 int corner_radius)
40 : InkDropMask(layer_size), 40 : InkDropMask(layer_size),
41 mask_insets_(mask_insets), 41 mask_insets_(mask_insets),
42 corner_radius_(corner_radius) {} 42 corner_radius_(corner_radius) {}
43 43
44 void RoundRectInkDropMask::OnPaintLayer(const ui::PaintContext& context) { 44 void RoundRectInkDropMask::OnPaintLayer(const ui::PaintContext& context) {
45 cc::PaintFlags flags; 45 cc::PaintFlags flags;
46 flags.setAlpha(255); 46 flags.setAlpha(255);
47 flags.setStyle(cc::PaintFlags::kFill_Style); 47 flags.setStyle(cc::PaintFlags::kFill_Style);
48 flags.setAntiAlias(true); 48 flags.setAntiAlias(true);
49 49
50 ui::PaintRecorder recorder(context, layer()->size()); 50 ui::PaintRecorder recorder(context, layer()->size());
51 gfx::Rect bounds = layer()->bounds(); 51 gfx::RectF bounds(layer()->bounds());
Peter Kasting 2017/04/27 02:13:18 Nit: I think this should have stayed as = per http
Evan Stade 2017/04/27 20:28:51 can't do that for rect=>rectf
52 bounds.Inset(mask_insets_); 52 bounds.Inset(mask_insets_);
53 recorder.canvas()->DrawRoundRect(bounds, corner_radius_, flags); 53 recorder.canvas()->DrawRoundRect(bounds, corner_radius_, flags);
54 } 54 }
55 55
56 // CircleInkDropMask 56 // CircleInkDropMask
57 57
58 CircleInkDropMask::CircleInkDropMask(const gfx::Size& layer_size, 58 CircleInkDropMask::CircleInkDropMask(const gfx::Size& layer_size,
59 const gfx::Point& mask_center, 59 const gfx::Point& mask_center,
60 int mask_radius) 60 int mask_radius)
61 : InkDropMask(layer_size), 61 : InkDropMask(layer_size),
62 mask_center_(mask_center), 62 mask_center_(mask_center),
63 mask_radius_(mask_radius) {} 63 mask_radius_(mask_radius) {}
64 64
65 void CircleInkDropMask::OnPaintLayer(const ui::PaintContext& context) { 65 void CircleInkDropMask::OnPaintLayer(const ui::PaintContext& context) {
66 cc::PaintFlags flags; 66 cc::PaintFlags flags;
67 flags.setAlpha(255); 67 flags.setAlpha(255);
68 flags.setStyle(cc::PaintFlags::kFill_Style); 68 flags.setStyle(cc::PaintFlags::kFill_Style);
69 flags.setAntiAlias(true); 69 flags.setAntiAlias(true);
70 70
71 ui::PaintRecorder recorder(context, layer()->size()); 71 ui::PaintRecorder recorder(context, layer()->size());
72 recorder.canvas()->DrawCircle(mask_center_, mask_radius_, flags); 72 recorder.canvas()->DrawCircle(mask_center_, mask_radius_, flags);
73 } 73 }
74 74
75 } // namespace views 75 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698