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