OLD | NEW |
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/ash_constants.h" | 7 #include "ash/common/ash_constants.h" |
8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
9 #include "ash/common/shelf/ink_drop_button_listener.h" | 9 #include "ash/common/shelf/ink_drop_button_listener.h" |
10 #include "ash/common/shelf/shelf_constants.h" | 10 #include "ash/common/shelf/shelf_constants.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 std::unique_ptr<views::InkDropMask> OverflowButton::CreateInkDropMask() const { | 113 std::unique_ptr<views::InkDropMask> OverflowButton::CreateInkDropMask() const { |
114 gfx::Insets insets = GetLocalBounds().InsetsFrom(CalculateButtonBounds()); | 114 gfx::Insets insets = GetLocalBounds().InsetsFrom(CalculateButtonBounds()); |
115 return base::MakeUnique<views::RoundRectInkDropMask>( | 115 return base::MakeUnique<views::RoundRectInkDropMask>( |
116 size(), insets, kOverflowButtonCornerRadius); | 116 size(), insets, kOverflowButtonCornerRadius); |
117 } | 117 } |
118 | 118 |
119 void OverflowButton::PaintBackground(gfx::Canvas* canvas, | 119 void OverflowButton::PaintBackground(gfx::Canvas* canvas, |
120 const gfx::Rect& bounds) { | 120 const gfx::Rect& bounds) { |
121 if (MaterialDesignController::IsShelfMaterial()) { | 121 if (MaterialDesignController::IsShelfMaterial()) { |
122 cc::PaintFlags flags; | 122 cc::PaintFlags flags; |
123 flags.setFlags(cc::PaintFlags::kAntiAlias_Flag); | 123 flags.setAntiAlias(true); |
124 flags.setColor(background_color_); | 124 flags.setColor(background_color_); |
125 canvas->DrawRoundRect(bounds, kOverflowButtonCornerRadius, flags); | 125 canvas->DrawRoundRect(bounds, kOverflowButtonCornerRadius, flags); |
126 } else { | 126 } else { |
127 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 127 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
128 const gfx::ImageSkia* background = | 128 const gfx::ImageSkia* background = |
129 rb.GetImageNamed(NonMaterialBackgroundImageId()).ToImageSkia(); | 129 rb.GetImageNamed(NonMaterialBackgroundImageId()).ToImageSkia(); |
130 canvas->DrawImageInt(*background, bounds.x(), bounds.y()); | 130 canvas->DrawImageInt(*background, bounds.x(), bounds.y()); |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 bounds = | 196 bounds = |
197 gfx::Rect(bounds.x() + (bounds.width() - background->width()) / 2, | 197 gfx::Rect(bounds.x() + (bounds.width() - background->width()) / 2, |
198 bounds.y() + kShelfItemInset, background->width(), | 198 bounds.y() + kShelfItemInset, background->width(), |
199 background->height()); | 199 background->height()); |
200 } | 200 } |
201 } | 201 } |
202 return bounds; | 202 return bounds; |
203 } | 203 } |
204 | 204 |
205 } // namespace ash | 205 } // namespace ash |
OLD | NEW |