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

Side by Side Diff: ash/common/shelf/overflow_button.cc

Issue 2690583002: Make cc/paint have concrete types (Closed)
Patch Set: PaintRecord as typedef, fixup playback calls Created 3 years, 9 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 | « no previous file | ash/common/shelf/shelf_button.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/shelf/overflow_button.h" 5 #include "ash/common/shelf/overflow_button.h"
6 6
7 #include "ash/common/shelf/shelf_constants.h" 7 #include "ash/common/shelf/shelf_constants.h"
8 #include "ash/common/shelf/shelf_view.h" 8 #include "ash/common/shelf/shelf_view.h"
9 #include "ash/common/shelf/wm_shelf.h" 9 #include "ash/common/shelf/wm_shelf.h"
10 #include "ash/resources/vector_icons/vector_icons.h" 10 #include "ash/resources/vector_icons/vector_icons.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 std::unique_ptr<views::InkDropMask> OverflowButton::CreateInkDropMask() const { 94 std::unique_ptr<views::InkDropMask> OverflowButton::CreateInkDropMask() const {
95 gfx::Insets insets = GetLocalBounds().InsetsFrom(CalculateButtonBounds()); 95 gfx::Insets insets = GetLocalBounds().InsetsFrom(CalculateButtonBounds());
96 return base::MakeUnique<views::RoundRectInkDropMask>( 96 return base::MakeUnique<views::RoundRectInkDropMask>(
97 size(), insets, kOverflowButtonCornerRadius); 97 size(), insets, kOverflowButtonCornerRadius);
98 } 98 }
99 99
100 void OverflowButton::PaintBackground(gfx::Canvas* canvas, 100 void OverflowButton::PaintBackground(gfx::Canvas* canvas,
101 const gfx::Rect& bounds) { 101 const gfx::Rect& bounds) {
102 cc::PaintFlags flags; 102 cc::PaintFlags flags;
103 flags.setFlags(cc::PaintFlags::kAntiAlias_Flag); 103 flags.setAntiAlias(true);
104 flags.setColor(background_color_); 104 flags.setColor(background_color_);
105 canvas->DrawRoundRect(bounds, kOverflowButtonCornerRadius, flags); 105 canvas->DrawRoundRect(bounds, kOverflowButtonCornerRadius, flags);
106 } 106 }
107 107
108 void OverflowButton::PaintForeground(gfx::Canvas* canvas, 108 void OverflowButton::PaintForeground(gfx::Canvas* canvas,
109 const gfx::Rect& bounds) { 109 const gfx::Rect& bounds) {
110 const gfx::ImageSkia* image = nullptr; 110 const gfx::ImageSkia* image = nullptr;
111 111
112 switch (wm_shelf_->GetAlignment()) { 112 switch (wm_shelf_->GetAlignment()) {
113 case SHELF_ALIGNMENT_LEFT: 113 case SHELF_ALIGNMENT_LEFT:
(...skipping 27 matching lines...) Expand all
141 // a left-aligned shelf, and to the left edge of a right-aligned shelf. 141 // a left-aligned shelf, and to the left edge of a right-aligned shelf.
142 const int inset = (GetShelfConstant(SHELF_SIZE) - kOverflowButtonSize) / 2; 142 const int inset = (GetShelfConstant(SHELF_SIZE) - kOverflowButtonSize) / 2;
143 const int x = alignment == SHELF_ALIGNMENT_LEFT 143 const int x = alignment == SHELF_ALIGNMENT_LEFT
144 ? content_bounds.right() - inset - kOverflowButtonSize 144 ? content_bounds.right() - inset - kOverflowButtonSize
145 : content_bounds.x() + inset; 145 : content_bounds.x() + inset;
146 return gfx::Rect(x, content_bounds.y() + inset, kOverflowButtonSize, 146 return gfx::Rect(x, content_bounds.y() + inset, kOverflowButtonSize,
147 kOverflowButtonSize); 147 kOverflowButtonSize);
148 } 148 }
149 149
150 } // namespace ash 150 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/shelf/shelf_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698