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

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

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/login_status.cc ('k') | ash/common/system/user/tray_user_separator.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 #include "skia/ext/image_operations.h" 6 #include "skia/ext/image_operations.h"
7 #include "third_party/skia/include/core/SkPaint.h" 7 #include "third_party/skia/include/core/SkPaint.h"
8 #include "third_party/skia/include/core/SkPath.h" 8 #include "third_party/skia/include/core/SkPath.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/gfx/image/image_skia_operations.h" 10 #include "ui/gfx/image/image_skia_operations.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 return gfx::Size(image_size_.width() + GetInsets().width(), 49 return gfx::Size(image_size_.width() + GetInsets().width(),
50 image_size_.height() + GetInsets().height()); 50 image_size_.height() + GetInsets().height());
51 } 51 }
52 52
53 void RoundedImageView::OnPaint(gfx::Canvas* canvas) { 53 void RoundedImageView::OnPaint(gfx::Canvas* canvas) {
54 View::OnPaint(canvas); 54 View::OnPaint(canvas);
55 gfx::Rect image_bounds(size()); 55 gfx::Rect image_bounds(size());
56 image_bounds.ClampToCenteredSize(GetPreferredSize()); 56 image_bounds.ClampToCenteredSize(GetPreferredSize());
57 image_bounds.Inset(GetInsets()); 57 image_bounds.Inset(GetInsets());
58 const SkScalar kRadius[8] = { 58 const SkScalar kRadius[8] = {
59 SkIntToScalar(corner_radius_[0]), 59 SkIntToScalar(corner_radius_[0]), SkIntToScalar(corner_radius_[0]),
60 SkIntToScalar(corner_radius_[0]), 60 SkIntToScalar(corner_radius_[1]), SkIntToScalar(corner_radius_[1]),
61 SkIntToScalar(corner_radius_[1]), 61 SkIntToScalar(corner_radius_[2]), SkIntToScalar(corner_radius_[2]),
62 SkIntToScalar(corner_radius_[1]), 62 SkIntToScalar(corner_radius_[3]), SkIntToScalar(corner_radius_[3])};
63 SkIntToScalar(corner_radius_[2]),
64 SkIntToScalar(corner_radius_[2]),
65 SkIntToScalar(corner_radius_[3]),
66 SkIntToScalar(corner_radius_[3])
67 };
68 SkPath path; 63 SkPath path;
69 path.addRoundRect(gfx::RectToSkRect(image_bounds), kRadius); 64 path.addRoundRect(gfx::RectToSkRect(image_bounds), kRadius);
70 SkPaint paint; 65 SkPaint paint;
71 paint.setAntiAlias(true); 66 paint.setAntiAlias(true);
72 paint.setXfermodeMode(active_user_ ? SkXfermode::kSrcOver_Mode 67 paint.setXfermodeMode(active_user_ ? SkXfermode::kSrcOver_Mode
73 : SkXfermode::kLuminosity_Mode); 68 : SkXfermode::kLuminosity_Mode);
74 canvas->DrawImageInPath( 69 canvas->DrawImageInPath(resized_, image_bounds.x(), image_bounds.y(), path,
75 resized_, image_bounds.x(), image_bounds.y(), path, paint); 70 paint);
76 } 71 }
77 72
78 } // namespace tray 73 } // namespace tray
79 } // namespace ash 74 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/user/login_status.cc ('k') | ash/common/system/user/tray_user_separator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698