OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef REMOTING_CLIENT_DISPLAY_GL_CURSOR_FEEDBACK_H_ | 5 #ifndef REMOTING_CLIENT_DISPLAY_GL_CURSOR_FEEDBACK_H_ |
6 #define REMOTING_CLIENT_DISPLAY_GL_CURSOR_FEEDBACK_H_ | 6 #define REMOTING_CLIENT_DISPLAY_GL_CURSOR_FEEDBACK_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
joedow
2017/01/10 00:19:44
nit: not your change but I've been removing the ol
nicholss
2017/01/10 21:43:10
Done.
| |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "remoting/client/display/drawable.h" | |
14 | 16 |
15 namespace remoting { | 17 namespace remoting { |
16 | 18 |
17 class GlCanvas; | 19 class Canvas; |
18 class GlRenderLayer; | 20 class GlRenderLayer; |
19 | 21 |
20 // This class draws the cursor feedback on the canvas. | 22 // This class draws the cursor feedback on the canvas. |
21 class GlCursorFeedback { | 23 class GlCursorFeedback : public Drawable { |
22 public: | 24 public: |
23 GlCursorFeedback(); | 25 GlCursorFeedback(); |
24 ~GlCursorFeedback(); | 26 ~GlCursorFeedback() override; |
25 | 27 |
26 // Sets the canvas on which the cursor feedback will be drawn. Resumes the | 28 // Sets the canvas on which the cursor feedback will be drawn. Resumes the |
27 // feedback texture to the context of the new canvas. | 29 // feedback texture to the context of the new canvas. |
28 // If |canvas| is nullptr, nothing will happen when calling Draw(). | 30 // If |canvas| is nullptr, nothing will happen when calling Draw(). |
29 void SetCanvas(GlCanvas* canvas); | 31 void SetCanvas(Canvas* canvas) override; |
30 | 32 |
31 void StartAnimation(float x, float y, float diameter); | 33 void StartAnimation(float x, float y, float diameter); |
32 | 34 |
33 // Returns true if animation is not finished, false otherwise. Does nothing | 35 // Returns true if there is more animation pending, otherwise false. |
34 // if the animation has stopped. | 36 // Does nothing if the animation has completed or canvas is null. |
35 bool Draw(); | 37 bool Draw() override; |
38 | |
39 base::WeakPtr<Drawable> GetWeakPtr() override; | |
36 | 40 |
37 private: | 41 private: |
38 std::unique_ptr<GlRenderLayer> layer_; | 42 std::unique_ptr<GlRenderLayer> layer_; |
39 float max_diameter_ = 0; | 43 float max_diameter_ = 0; |
40 float cursor_x_ = 0; | 44 float cursor_x_ = 0; |
41 float cursor_y_ = 0; | 45 float cursor_y_ = 0; |
42 base::TimeTicks animation_start_time_; | 46 base::TimeTicks animation_start_time_; |
43 | 47 |
48 base::WeakPtrFactory<Drawable> weak_factory_; | |
44 DISALLOW_COPY_AND_ASSIGN(GlCursorFeedback); | 49 DISALLOW_COPY_AND_ASSIGN(GlCursorFeedback); |
45 }; | 50 }; |
46 | 51 |
47 } // namespace remoting | 52 } // namespace remoting |
48 #endif // REMOTING_CLIENT_DISPLAY_GL_CURSOR_FEEDBACK_H_ | 53 #endif // REMOTING_CLIENT_DISPLAY_GL_CURSOR_FEEDBACK_H_ |
OLD | NEW |