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