OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_CLIENT_OPENGL_GL_CURSOR_FEEDBACK_H_ |
| 6 #define REMOTING_CLIENT_OPENGL_GL_CURSOR_FEEDBACK_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <memory> |
| 11 |
| 12 #include "base/macros.h" |
| 13 #include "base/time/time.h" |
| 14 |
| 15 namespace remoting { |
| 16 |
| 17 class GlCanvas; |
| 18 class GlRenderLayer; |
| 19 |
| 20 // This class draws the cursor feedback on the canvas. |
| 21 class GlCursorFeedback { |
| 22 public: |
| 23 GlCursorFeedback(); |
| 24 ~GlCursorFeedback(); |
| 25 |
| 26 // Sets the canvas on which the cursor feedback will be drawn. Resumes the |
| 27 // feedback texture to the context of the new canvas. |
| 28 // If |canvas| is nullptr, nothing will happen when calling Draw(). |
| 29 void SetCanvas(GlCanvas* canvas); |
| 30 |
| 31 void StartAnimation(float normalized_x, |
| 32 float normalized_y, |
| 33 float normalized_width, |
| 34 float normalized_height); |
| 35 |
| 36 // Returns true if animation is not finished, false otherwise. Does nothing |
| 37 // if the animation has stopped. |
| 38 bool Draw(); |
| 39 |
| 40 private: |
| 41 std::unique_ptr<GlRenderLayer> layer_; |
| 42 float max_width_ = 0; |
| 43 float max_height_ = 0; |
| 44 float cursor_x_ = 0; |
| 45 float cursor_y_ = 0; |
| 46 base::TimeTicks animation_start_time_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(GlCursorFeedback); |
| 49 }; |
| 50 |
| 51 } // namespace remoting |
| 52 #endif // REMOTING_CLIENT_OPENGL_GL_CURSOR_FEEDBACK_H_ |
OLD | NEW |