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/touch/touch_hud_projection.h" | 5 #include "ash/touch/touch_hud_projection.h" |
6 | 6 |
7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "third_party/skia/include/effects/SkGradientShader.h" | 9 #include "third_party/skia/include/effects/SkGradientShader.h" |
10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 delete this; | 71 delete this; |
72 } | 72 } |
73 | 73 |
74 private: | 74 private: |
75 virtual ~TouchPointView() { | 75 virtual ~TouchPointView() { |
76 GetWidget()->RemoveObserver(this); | 76 GetWidget()->RemoveObserver(this); |
77 parent()->RemoveChildView(this); | 77 parent()->RemoveChildView(this); |
78 } | 78 } |
79 | 79 |
80 // Overridden from views::View. | 80 // Overridden from views::View. |
81 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 81 virtual void OnPaint(gfx::Canvas* canvas) override { |
82 int alpha = kProjectionAlpha; | 82 int alpha = kProjectionAlpha; |
83 if (fadeout_) | 83 if (fadeout_) |
84 alpha = static_cast<int>(fadeout_->CurrentValueBetween(alpha, 0)); | 84 alpha = static_cast<int>(fadeout_->CurrentValueBetween(alpha, 0)); |
85 fill_paint_.setAlpha(alpha); | 85 fill_paint_.setAlpha(alpha); |
86 stroke_paint_.setAlpha(alpha); | 86 stroke_paint_.setAlpha(alpha); |
87 SkShader* shader = SkGradientShader::CreateRadial( | 87 SkShader* shader = SkGradientShader::CreateRadial( |
88 gradient_center_, | 88 gradient_center_, |
89 SkIntToScalar(kPointRadius), | 89 SkIntToScalar(kPointRadius), |
90 gradient_colors_, | 90 gradient_colors_, |
91 gradient_pos_, | 91 gradient_pos_, |
92 arraysize(gradient_colors_), | 92 arraysize(gradient_colors_), |
93 SkShader::kMirror_TileMode); | 93 SkShader::kMirror_TileMode); |
94 fill_paint_.setShader(shader); | 94 fill_paint_.setShader(shader); |
95 shader->unref(); | 95 shader->unref(); |
96 canvas->DrawCircle(circle_center_, SkIntToScalar(kPointRadius), | 96 canvas->DrawCircle(circle_center_, SkIntToScalar(kPointRadius), |
97 fill_paint_); | 97 fill_paint_); |
98 canvas->DrawCircle(circle_center_, SkIntToScalar(kPointRadius), | 98 canvas->DrawCircle(circle_center_, SkIntToScalar(kPointRadius), |
99 stroke_paint_); | 99 stroke_paint_); |
100 } | 100 } |
101 | 101 |
102 // Overridden from gfx::AnimationDelegate. | 102 // Overridden from gfx::AnimationDelegate. |
103 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE { | 103 virtual void AnimationEnded(const gfx::Animation* animation) override { |
104 DCHECK_EQ(fadeout_.get(), animation); | 104 DCHECK_EQ(fadeout_.get(), animation); |
105 delete this; | 105 delete this; |
106 } | 106 } |
107 | 107 |
108 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE { | 108 virtual void AnimationProgressed(const gfx::Animation* animation) override { |
109 DCHECK_EQ(fadeout_.get(), animation); | 109 DCHECK_EQ(fadeout_.get(), animation); |
110 SchedulePaint(); | 110 SchedulePaint(); |
111 } | 111 } |
112 | 112 |
113 virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE { | 113 virtual void AnimationCanceled(const gfx::Animation* animation) override { |
114 AnimationEnded(animation); | 114 AnimationEnded(animation); |
115 } | 115 } |
116 | 116 |
117 // Overridden from views::WidgetObserver. | 117 // Overridden from views::WidgetObserver. |
118 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE { | 118 virtual void OnWidgetDestroying(views::Widget* widget) override { |
119 if (fadeout_) | 119 if (fadeout_) |
120 fadeout_->Stop(); | 120 fadeout_->Stop(); |
121 else | 121 else |
122 Remove(); | 122 Remove(); |
123 } | 123 } |
124 | 124 |
125 const gfx::Point circle_center_; | 125 const gfx::Point circle_center_; |
126 const SkPoint gradient_center_; | 126 const SkPoint gradient_center_; |
127 | 127 |
128 SkPaint fill_paint_; | 128 SkPaint fill_paint_; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 RootWindowController* controller) { | 177 RootWindowController* controller) { |
178 controller->set_touch_hud_projection(this); | 178 controller->set_touch_hud_projection(this); |
179 } | 179 } |
180 | 180 |
181 void TouchHudProjection::UnsetHudForRootWindowController( | 181 void TouchHudProjection::UnsetHudForRootWindowController( |
182 RootWindowController* controller) { | 182 RootWindowController* controller) { |
183 controller->set_touch_hud_projection(NULL); | 183 controller->set_touch_hud_projection(NULL); |
184 } | 184 } |
185 | 185 |
186 } // namespace ash | 186 } // namespace ash |
OLD | NEW |