Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: remoting/client/display/gl_cursor.h

Issue 2591363002: Adding drawable to CRD andorid and iOS gl rendering pipeline. (Closed)
Patch Set: More like GetZIndex. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_DISPLAY_GL_CURSOR_H_ 5 #ifndef REMOTING_CLIENT_DISPLAY_GL_CURSOR_H_
6 #define REMOTING_CLIENT_DISPLAY_GL_CURSOR_H_ 6 #define REMOTING_CLIENT_DISPLAY_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 "base/memory/weak_ptr.h"
14 #include "base/threading/thread_checker.h"
15 #include "remoting/client/display/drawable.h"
13 16
14 namespace remoting { 17 namespace remoting {
15 18
16 namespace protocol { 19 namespace protocol {
17 class CursorShapeInfo; 20 class CursorShapeInfo;
18 } // namespace protocol 21 } // namespace protocol
19 22
20 class GlCanvas; 23 class Canvas;
21 class GlRenderLayer; 24 class GlRenderLayer;
22 25
23 // This class draws the cursor on the canvas. 26 // This class draws the cursor on the canvas.
24 class GlCursor { 27 class GlCursor : public Drawable {
25 public: 28 public:
26 GlCursor(); 29 GlCursor();
27 ~GlCursor(); 30 ~GlCursor() override;
28 31
29 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape); 32 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape);
30 33
31 // Sets the cursor hotspot positions. Does nothing if the cursor shape or the 34 // Sets the cursor hotspot positions. Does nothing if the cursor shape or the
32 // canvas size has not been set. 35 // canvas size has not been set.
33 void SetCursorPosition(float x, float y); 36 void SetCursorPosition(float x, float y);
34 37
35 // Draw() will do nothing if cursor is not visible. 38 // Draw() will do nothing if cursor is not visible.
36 void SetCursorVisible(bool visible); 39 void SetCursorVisible(bool visible);
37 40
38 // Sets the canvas on which the cursor will be drawn. Resumes the current 41 // Drawable implementation.
39 // state of the cursor to the context of the new canvas. 42 void SetCanvas(base::WeakPtr<Canvas> canvas) override;
40 // If |canvas| is nullptr, nothing will happen when calling Draw(). 43 bool Draw() override;
41 void SetCanvas(GlCanvas* canvas); 44 int GetZIndex() override;
42 45 base::WeakPtr<Drawable> GetWeakPtr() override;
43 void Draw();
44 46
45 private: 47 private:
46 void SetCurrentCursorShape(bool size_changed); 48 void SetCurrentCursorShape(bool size_changed);
47 49
48 bool visible_ = true; 50 bool visible_ = true;
49 51
50 std::unique_ptr<GlRenderLayer> layer_; 52 std::unique_ptr<GlRenderLayer> layer_;
51 53
52 std::unique_ptr<uint8_t[]> current_cursor_data_; 54 std::unique_ptr<uint8_t[]> current_cursor_data_;
53 int current_cursor_data_size_ = 0; 55 int current_cursor_data_size_ = 0;
54 int current_cursor_width_ = 0; 56 int current_cursor_width_ = 0;
55 int current_cursor_height_ = 0; 57 int current_cursor_height_ = 0;
56 int current_cursor_hotspot_x_ = 0; 58 int current_cursor_hotspot_x_ = 0;
57 int current_cursor_hotspot_y_ = 0; 59 int current_cursor_hotspot_y_ = 0;
58 60
59 float cursor_x_ = 0; 61 float cursor_x_ = 0;
60 float cursor_y_ = 0; 62 float cursor_y_ = 0;
61 63
64 base::ThreadChecker thread_checker_;
65 base::WeakPtrFactory<Drawable> weak_factory_;
66
62 DISALLOW_COPY_AND_ASSIGN(GlCursor); 67 DISALLOW_COPY_AND_ASSIGN(GlCursor);
63 }; 68 };
64 69
65 } // namespace remoting 70 } // namespace remoting
66 #endif // REMOTING_CLIENT_DISPLAY_GL_CURSOR_H_ 71 #endif // REMOTING_CLIENT_DISPLAY_GL_CURSOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698