Chromium Code Reviews| 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 } | |
|
Sergey Ulanov
2016/07/19 00:42:48
// namespace protocol
Yuwei
2016/07/19 20:34:23
Done.
| |
| 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 bool visible_ = true; | |
|
Sergey Ulanov
2016/07/19 00:42:48
add empty line here please
Yuwei
2016/07/19 20:34:23
Done.
| |
| 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 int cursor_x_ = 0; | |
| 60 int cursor_y_ = 0; | |
| 61 int canvas_width_ = 0; | |
| 62 int canvas_height_ = 0; | |
| 63 | |
| 64 DISALLOW_COPY_AND_ASSIGN(GlCursor); | |
| 65 }; | |
| 66 | |
| 67 } // namespace remoting | |
| 68 #endif // REMOTING_CLIENT_OPENGL_GL_CURSOR_H_ | |
| OLD | NEW |