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