| OLD | NEW |
| 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 |
| 7 #include "ash/common/material_design/material_design_controller.h" |
| 6 #include "skia/ext/image_operations.h" | 8 #include "skia/ext/image_operations.h" |
| 7 #include "third_party/skia/include/core/SkPaint.h" | 9 #include "third_party/skia/include/core/SkPaint.h" |
| 8 #include "third_party/skia/include/core/SkPath.h" | 10 #include "third_party/skia/include/core/SkPath.h" |
| 9 #include "ui/gfx/canvas.h" | 11 #include "ui/gfx/canvas.h" |
| 10 #include "ui/gfx/image/image_skia_operations.h" | 12 #include "ui/gfx/image/image_skia_operations.h" |
| 11 #include "ui/gfx/skia_util.h" | 13 #include "ui/gfx/skia_util.h" |
| 12 | 14 |
| 13 namespace ash { | 15 namespace ash { |
| 14 namespace tray { | 16 namespace tray { |
| 15 | 17 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 image_bounds.Inset(GetInsets()); | 59 image_bounds.Inset(GetInsets()); |
| 58 const SkScalar kRadius[8] = { | 60 const SkScalar kRadius[8] = { |
| 59 SkIntToScalar(corner_radius_[0]), SkIntToScalar(corner_radius_[0]), | 61 SkIntToScalar(corner_radius_[0]), SkIntToScalar(corner_radius_[0]), |
| 60 SkIntToScalar(corner_radius_[1]), SkIntToScalar(corner_radius_[1]), | 62 SkIntToScalar(corner_radius_[1]), SkIntToScalar(corner_radius_[1]), |
| 61 SkIntToScalar(corner_radius_[2]), SkIntToScalar(corner_radius_[2]), | 63 SkIntToScalar(corner_radius_[2]), SkIntToScalar(corner_radius_[2]), |
| 62 SkIntToScalar(corner_radius_[3]), SkIntToScalar(corner_radius_[3])}; | 64 SkIntToScalar(corner_radius_[3]), SkIntToScalar(corner_radius_[3])}; |
| 63 SkPath path; | 65 SkPath path; |
| 64 path.addRoundRect(gfx::RectToSkRect(image_bounds), kRadius); | 66 path.addRoundRect(gfx::RectToSkRect(image_bounds), kRadius); |
| 65 SkPaint paint; | 67 SkPaint paint; |
| 66 paint.setAntiAlias(true); | 68 paint.setAntiAlias(true); |
| 67 paint.setBlendMode(active_user_ ? SkBlendMode::kSrcOver | 69 const bool grayscale = |
| 68 : SkBlendMode::kLuminosity); | 70 !active_user_ && !MaterialDesignController::IsSystemTrayMenuMaterial(); |
| 71 paint.setBlendMode(grayscale ? SkBlendMode::kLuminosity |
| 72 : SkBlendMode::kSrcOver); |
| 69 canvas->DrawImageInPath(resized_, image_bounds.x(), image_bounds.y(), path, | 73 canvas->DrawImageInPath(resized_, image_bounds.x(), image_bounds.y(), path, |
| 70 paint); | 74 paint); |
| 71 } | 75 } |
| 72 | 76 |
| 73 } // namespace tray | 77 } // namespace tray |
| 74 } // namespace ash | 78 } // namespace ash |
| OLD | NEW |