| 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_OPENGL_GL_CURSOR_H_ | 5 #ifndef REMOTING_CLIENT_OPENGL_GL_CURSOR_H_ |
| 6 #define REMOTING_CLIENT_OPENGL_GL_CURSOR_H_ | 6 #define REMOTING_CLIENT_OPENGL_GL_CURSOR_H_ |
| 7 | 7 |
| 8 #include <array> | 8 #include <array> |
| 9 #include <cstdint> | 9 #include <cstdint> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // This class draws the cursor on the canvas. | 23 // This class draws the cursor on the canvas. |
| 24 class GlCursor { | 24 class GlCursor { |
| 25 public: | 25 public: |
| 26 GlCursor(); | 26 GlCursor(); |
| 27 ~GlCursor(); | 27 ~GlCursor(); |
| 28 | 28 |
| 29 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape); | 29 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape); |
| 30 | 30 |
| 31 // Sets the cursor hotspot positions. Does nothing if the cursor shape or the | 31 // Sets the cursor hotspot positions. Does nothing if the cursor shape or the |
| 32 // canvas size has not been set. | 32 // canvas size has not been set. |
| 33 void SetCursorPosition(int x, int y); | 33 void SetCursorPosition(float x, float y); |
| 34 | 34 |
| 35 // Draw() will do nothing if cursor is not visible. | 35 // Draw() will do nothing if cursor is not visible. |
| 36 void SetCursorVisible(bool visible); | 36 void SetCursorVisible(bool visible); |
| 37 | 37 |
| 38 // Sets the canvas on which the cursor will be drawn. Resumes the current | 38 // Sets the canvas on which the cursor will be drawn. Resumes the current |
| 39 // state of the cursor to the context of the new canvas. | 39 // state of the cursor to the context of the new canvas. |
| 40 // If |canvas| is nullptr, nothing will happen when calling Draw(). | 40 // If |canvas| is nullptr, nothing will happen when calling Draw(). |
| 41 void SetCanvas(GlCanvas* canvas); | 41 void SetCanvas(GlCanvas* canvas); |
| 42 | 42 |
| 43 void Draw(); | 43 void Draw(); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 void SetCurrentCursorShape(bool size_changed); | 46 void SetCurrentCursorShape(bool size_changed); |
| 47 | 47 |
| 48 bool visible_ = true; | 48 bool visible_ = true; |
| 49 | 49 |
| 50 std::unique_ptr<GlRenderLayer> layer_; | 50 std::unique_ptr<GlRenderLayer> layer_; |
| 51 | 51 |
| 52 std::unique_ptr<uint8_t[]> current_cursor_data_; | 52 std::unique_ptr<uint8_t[]> current_cursor_data_; |
| 53 int current_cursor_data_size_ = 0; | 53 int current_cursor_data_size_ = 0; |
| 54 int current_cursor_width_ = 0; | 54 int current_cursor_width_ = 0; |
| 55 int current_cursor_height_ = 0; | 55 int current_cursor_height_ = 0; |
| 56 int current_cursor_hotspot_x_ = 0; | 56 int current_cursor_hotspot_x_ = 0; |
| 57 int current_cursor_hotspot_y_ = 0; | 57 int current_cursor_hotspot_y_ = 0; |
| 58 | 58 |
| 59 int cursor_x_ = 0; | 59 float cursor_x_ = 0; |
| 60 int cursor_y_ = 0; | 60 float cursor_y_ = 0; |
| 61 | 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(GlCursor); | 62 DISALLOW_COPY_AND_ASSIGN(GlCursor); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 } // namespace remoting | 65 } // namespace remoting |
| 66 #endif // REMOTING_CLIENT_OPENGL_GL_CURSOR_H_ | 66 #endif // REMOTING_CLIENT_OPENGL_GL_CURSOR_H_ |
| OLD | NEW |