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