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

Side by Side Diff: ash/common/system/user/rounded_image_view.cc

Issue 2678353005: Remove pre-MD code related to tray/menu user profiles. (Closed)
Patch Set: back out a11y changes and rebase Created 3 years, 10 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 | « ash/common/system/user/rounded_image_view.h ('k') | ash/common/system/user/tray_user.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ash/common/system/user/rounded_image_view.h" 5 #include "ash/common/system/user/rounded_image_view.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h"
8 #include "skia/ext/image_operations.h" 7 #include "skia/ext/image_operations.h"
9 #include "third_party/skia/include/core/SkPath.h" 8 #include "third_party/skia/include/core/SkPath.h"
10 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
11 #include "ui/gfx/image/image_skia_operations.h" 10 #include "ui/gfx/image/image_skia_operations.h"
12 #include "ui/gfx/skia_util.h" 11 #include "ui/gfx/skia_util.h"
13 12
14 namespace ash { 13 namespace ash {
15 namespace tray { 14 namespace tray {
16 15
17 RoundedImageView::RoundedImageView(int corner_radius, bool active_user) 16 RoundedImageView::RoundedImageView(int corner_radius) {
18 : active_user_(active_user) {
19 for (int i = 0; i < 4; ++i) 17 for (int i = 0; i < 4; ++i)
20 corner_radius_[i] = corner_radius; 18 corner_radius_[i] = corner_radius;
21 } 19 }
22 20
23 RoundedImageView::~RoundedImageView() {} 21 RoundedImageView::~RoundedImageView() {}
24 22
25 void RoundedImageView::SetImage(const gfx::ImageSkia& img, 23 void RoundedImageView::SetImage(const gfx::ImageSkia& img,
26 const gfx::Size& size) { 24 const gfx::Size& size) {
27 image_ = img; 25 image_ = img;
28 image_size_ = size; 26 image_size_ = size;
(...skipping 29 matching lines...) Expand all
58 image_bounds.Inset(GetInsets()); 56 image_bounds.Inset(GetInsets());
59 const SkScalar kRadius[8] = { 57 const SkScalar kRadius[8] = {
60 SkIntToScalar(corner_radius_[0]), SkIntToScalar(corner_radius_[0]), 58 SkIntToScalar(corner_radius_[0]), SkIntToScalar(corner_radius_[0]),
61 SkIntToScalar(corner_radius_[1]), SkIntToScalar(corner_radius_[1]), 59 SkIntToScalar(corner_radius_[1]), SkIntToScalar(corner_radius_[1]),
62 SkIntToScalar(corner_radius_[2]), SkIntToScalar(corner_radius_[2]), 60 SkIntToScalar(corner_radius_[2]), SkIntToScalar(corner_radius_[2]),
63 SkIntToScalar(corner_radius_[3]), SkIntToScalar(corner_radius_[3])}; 61 SkIntToScalar(corner_radius_[3]), SkIntToScalar(corner_radius_[3])};
64 SkPath path; 62 SkPath path;
65 path.addRoundRect(gfx::RectToSkRect(image_bounds), kRadius); 63 path.addRoundRect(gfx::RectToSkRect(image_bounds), kRadius);
66 cc::PaintFlags flags; 64 cc::PaintFlags flags;
67 flags.setAntiAlias(true); 65 flags.setAntiAlias(true);
68 const bool grayscale =
69 !active_user_ && !MaterialDesignController::IsSystemTrayMenuMaterial();
70 flags.setBlendMode(grayscale ? SkBlendMode::kLuminosity
71 : SkBlendMode::kSrcOver);
72 canvas->DrawImageInPath(resized_, image_bounds.x(), image_bounds.y(), path, 66 canvas->DrawImageInPath(resized_, image_bounds.x(), image_bounds.y(), path,
73 flags); 67 flags);
74 } 68 }
75 69
76 } // namespace tray 70 } // namespace tray
77 } // namespace ash 71 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/user/rounded_image_view.h ('k') | ash/common/system/user/tray_user.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698