OLD | NEW |
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 return animation_.IsShowing() || animation_.is_animating(); | 76 return animation_.IsShowing() || animation_.is_animating(); |
77 } | 77 } |
78 | 78 |
79 void GlowHoverController::Draw(gfx::Canvas* canvas, | 79 void GlowHoverController::Draw(gfx::Canvas* canvas, |
80 const gfx::ImageSkia& mask_image) const { | 80 const gfx::ImageSkia& mask_image) const { |
81 if (!ShouldDraw()) | 81 if (!ShouldDraw()) |
82 return; | 82 return; |
83 | 83 |
84 // Draw a radial gradient to hover_canvas. | 84 // Draw a radial gradient to hover_canvas. |
85 gfx::Canvas hover_canvas(gfx::Size(mask_image.width(), mask_image.height()), | 85 gfx::Canvas hover_canvas(gfx::Size(mask_image.width(), mask_image.height()), |
86 canvas->image_scale(), | 86 canvas->scale_factor(), |
87 false); | 87 false); |
88 | 88 |
89 // Draw a radial gradient to hover_canvas. | 89 // Draw a radial gradient to hover_canvas. |
90 int radius = view_->width() / 3; | 90 int radius = view_->width() / 3; |
91 | 91 |
92 SkPoint center_point; | 92 SkPoint center_point; |
93 center_point.iset(location_.x(), location_.y()); | 93 center_point.iset(location_.x(), location_.y()); |
94 SkColor colors[2]; | 94 SkColor colors[2]; |
95 int hover_alpha = | 95 int hover_alpha = |
96 static_cast<int>(255 * opacity_scale_ * animation_.GetCurrentValue()); | 96 static_cast<int>(255 * opacity_scale_ * animation_.GetCurrentValue()); |
(...skipping 22 matching lines...) Expand all Loading... |
119 | 119 |
120 void GlowHoverController::AnimationEnded(const gfx::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 gfx::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 |
OLD | NEW |