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

Side by Side Diff: ash/frame/caption_buttons/frame_caption_button.cc

Issue 994303004: Show hovered and pressed unfocused ash caption buttons as active. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit Created 5 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 | no next file » | 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/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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698