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

Side by Side Diff: ui/views/controls/glow_hover_controller.cc

Issue 23531053: ui/base/animation -> ui/gfx/animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 2 trunk Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/controls/glow_hover_controller.h" 5 #include "ui/views/controls/glow_hover_controller.h"
6 6
7 #include "third_party/skia/include/effects/SkGradientShader.h" 7 #include "third_party/skia/include/effects/SkGradientShader.h"
8 #include "ui/gfx/canvas.h" 8 #include "ui/gfx/canvas.h"
9 #include "ui/gfx/image/image_skia.h" 9 #include "ui/gfx/image/image_skia.h"
10 #include "ui/gfx/image/image_skia_operations.h" 10 #include "ui/gfx/image/image_skia_operations.h"
(...skipping 12 matching lines...) Expand all
23 : view_(view), 23 : view_(view),
24 animation_(this), 24 animation_(this),
25 opacity_scale_(kTrackOpacityScale) { 25 opacity_scale_(kTrackOpacityScale) {
26 animation_.set_delegate(this); 26 animation_.set_delegate(this);
27 } 27 }
28 28
29 GlowHoverController::~GlowHoverController() { 29 GlowHoverController::~GlowHoverController() {
30 } 30 }
31 31
32 void GlowHoverController::SetAnimationContainer( 32 void GlowHoverController::SetAnimationContainer(
33 ui::AnimationContainer* container) { 33 gfx::AnimationContainer* container) {
34 animation_.SetContainer(container); 34 animation_.SetContainer(container);
35 } 35 }
36 36
37 void GlowHoverController::SetLocation(const gfx::Point& location) { 37 void GlowHoverController::SetLocation(const gfx::Point& location) {
38 location_ = location; 38 location_ = location;
39 if (ShouldDraw()) 39 if (ShouldDraw())
40 view_->SchedulePaint(); 40 view_->SchedulePaint();
41 } 41 }
42 42
43 void GlowHoverController::Show(Style style) { 43 void GlowHoverController::Show(Style style) {
44 switch (style) { 44 switch (style) {
45 case SUBTLE: 45 case SUBTLE:
46 opacity_scale_ = kTrackOpacityScale; 46 opacity_scale_ = kTrackOpacityScale;
47 animation_.SetSlideDuration(kTrackHoverDurationMs); 47 animation_.SetSlideDuration(kTrackHoverDurationMs);
48 animation_.SetTweenType(ui::Tween::EASE_OUT); 48 animation_.SetTweenType(gfx::Tween::EASE_OUT);
49 animation_.Show(); 49 animation_.Show();
50 break; 50 break;
51 case PRONOUNCED: 51 case PRONOUNCED:
52 opacity_scale_ = kHighlightOpacityScale; 52 opacity_scale_ = kHighlightOpacityScale;
53 // Force the end state to show immediately. 53 // Force the end state to show immediately.
54 animation_.Show(); 54 animation_.Show();
55 animation_.End(); 55 animation_.End();
56 break; 56 break;
57 } 57 }
58 } 58 }
59 59
60 void GlowHoverController::Hide() { 60 void GlowHoverController::Hide() {
61 animation_.SetTweenType(ui::Tween::EASE_IN); 61 animation_.SetTweenType(gfx::Tween::EASE_IN);
62 animation_.Hide(); 62 animation_.Hide();
63 } 63 }
64 64
65 void GlowHoverController::HideImmediately() { 65 void GlowHoverController::HideImmediately() {
66 if (ShouldDraw()) 66 if (ShouldDraw())
67 view_->SchedulePaint(); 67 view_->SchedulePaint();
68 animation_.Reset(); 68 animation_.Reset();
69 } 69 }
70 70
71 double GlowHoverController::GetAnimationValue() const { 71 double GlowHoverController::GetAnimationValue() const {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 hover_canvas.DrawRect(gfx::Rect(location_.x() - radius, 110 hover_canvas.DrawRect(gfx::Rect(location_.x() - radius,
111 location_.y() - radius, 111 location_.y() - radius,
112 radius * 2, radius * 2), paint); 112 radius * 2, radius * 2), paint);
113 } 113 }
114 gfx::ImageSkia result = gfx::ImageSkiaOperations::CreateMaskedImage( 114 gfx::ImageSkia result = gfx::ImageSkiaOperations::CreateMaskedImage(
115 gfx::ImageSkia(hover_canvas.ExtractImageRep()), mask_image); 115 gfx::ImageSkia(hover_canvas.ExtractImageRep()), mask_image);
116 canvas->DrawImageInt(result, (view_->width() - mask_image.width()) / 2, 116 canvas->DrawImageInt(result, (view_->width() - mask_image.width()) / 2,
117 (view_->height() - mask_image.height()) / 2); 117 (view_->height() - mask_image.height()) / 2);
118 } 118 }
119 119
120 void GlowHoverController::AnimationEnded(const ui::Animation* animation) { 120 void GlowHoverController::AnimationEnded(const gfx::Animation* animation) {
121 view_->SchedulePaint(); 121 view_->SchedulePaint();
122 } 122 }
123 123
124 void GlowHoverController::AnimationProgressed(const ui::Animation* animation) { 124 void GlowHoverController::AnimationProgressed(const gfx::Animation* animation) {
125 view_->SchedulePaint(); 125 view_->SchedulePaint();
126 } 126 }
127 127
128 } // namespace views 128 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/glow_hover_controller.h ('k') | ui/views/controls/scrollbar/overlay_scroll_bar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698