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/frame/caption_buttons/frame_caption_button.h" | 5 #include "ash/frame/caption_buttons/frame_caption_button.h" |
6 | 6 |
7 #include "ui/base/resource/resource_bundle.h" | 7 #include "ui/base/resource/resource_bundle.h" |
8 #include "ui/gfx/animation/slide_animation.h" | 8 #include "ui/gfx/animation/slide_animation.h" |
9 #include "ui/gfx/animation/throb_animation.h" | 9 #include "ui/gfx/animation/throb_animation.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 NotifyClick(*event); | 163 NotifyClick(*event); |
164 event->StopPropagation(); | 164 event->StopPropagation(); |
165 } | 165 } |
166 } | 166 } |
167 CustomButton::OnGestureEvent(event); | 167 CustomButton::OnGestureEvent(event); |
168 } | 168 } |
169 | 169 |
170 void FrameCaptionButton::PaintCentered(gfx::Canvas* canvas, | 170 void FrameCaptionButton::PaintCentered(gfx::Canvas* canvas, |
171 const gfx::ImageSkia& to_center, | 171 const gfx::ImageSkia& to_center, |
172 int alpha) { | 172 int alpha) { |
173 if (!paint_as_active_) | 173 if (!paint_as_active_) { |
174 alpha *= kInactiveIconAlpha; | 174 // Paint icons as active when they are hovered over or pressed. |
| 175 double inactive_alpha = kInactiveIconAlpha; |
| 176 if (hover_animation_->is_animating()) { |
| 177 inactive_alpha = |
| 178 hover_animation_->CurrentValueBetween(inactive_alpha, 1.0f); |
| 179 } else if (state() == STATE_PRESSED || state() == STATE_HOVERED) { |
| 180 inactive_alpha = 1.0f; |
| 181 } |
| 182 alpha *= inactive_alpha; |
| 183 } |
175 | 184 |
176 SkPaint paint; | 185 SkPaint paint; |
177 paint.setAlpha(alpha); | 186 paint.setAlpha(alpha); |
178 canvas->DrawImageInt(to_center, | 187 canvas->DrawImageInt(to_center, |
179 (width() - to_center.width()) / 2, | 188 (width() - to_center.width()) / 2, |
180 (height() - to_center.height()) / 2, | 189 (height() - to_center.height()) / 2, |
181 paint); | 190 paint); |
182 } | 191 } |
183 | 192 |
184 } // namespace ash | 193 } // namespace ash |
OLD | NEW |