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_DESKTOP_H_ | 5 #ifndef REMOTING_CLIENT_OPENGL_GL_DESKTOP_H_ |
6 #define REMOTING_CLIENT_OPENGL_GL_DESKTOP_H_ | 6 #define REMOTING_CLIENT_OPENGL_GL_DESKTOP_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "remoting/client/gl_drawable.h" |
12 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 13 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
13 | 14 |
14 namespace webrtc { | 15 namespace webrtc { |
15 class DesktopFrame; | 16 class DesktopFrame; |
16 } // namespace webrtc | 17 } // namespace webrtc |
17 | 18 |
18 namespace remoting { | 19 namespace remoting { |
19 | 20 |
20 class GlCanvas; | 21 class GlCanvas; |
21 class GlRenderLayer; | |
22 | 22 |
23 // This class draws the desktop on the canvas. | 23 // This class draws the desktop on the canvas. |
24 class GlDesktop { | 24 class GlDesktop : public GlDrawable { |
25 public: | 25 public: |
26 GlDesktop(); | 26 GlDesktop(); |
27 virtual ~GlDesktop(); | 27 ~GlDesktop() override; |
28 | 28 |
29 // |frame| can be either a full frame or updated regions only frame. | 29 // |frame| can be either a full frame or updated regions only frame. |
30 void SetVideoFrame(const webrtc::DesktopFrame& frame); | 30 void SetVideoFrame(const webrtc::DesktopFrame& frame); |
31 | 31 |
32 // Sets the canvas on which the desktop will be drawn. Caller must feed a | 32 // Sets the canvas on which the desktop will be drawn. Caller must feed a |
33 // full desktop frame after calling this function. | 33 // full desktop frame after calling this function. |
34 // If |canvas| is nullptr, nothing will happen when calling Draw(). | 34 // If |canvas| is nullptr, nothing will happen when calling Draw(). |
35 void SetCanvas(GlCanvas* canvas); | 35 void SetCanvas(GlCanvas* canvas) override; |
36 | 36 |
37 // Draws the desktop on the canvas. | 37 // Draws the desktop on the canvas. |
38 void Draw(); | 38 void Draw() override; |
39 | 39 |
40 private: | 40 private: |
41 struct GlDesktopTextureContainer; | 41 struct GlDesktopTextureContainer; |
42 | 42 |
43 void ReallocateTextures(const webrtc::DesktopSize& size); | 43 void ReallocateTextures(const webrtc::DesktopSize& size); |
44 | 44 |
45 std::vector<std::unique_ptr<GlDesktopTextureContainer>> textures_; | 45 std::vector<std::unique_ptr<GlDesktopTextureContainer>> textures_; |
46 | 46 |
47 webrtc::DesktopSize last_desktop_size_; | 47 webrtc::DesktopSize last_desktop_size_; |
48 int max_texture_size_ = 0; | 48 int max_texture_size_ = 0; |
49 GlCanvas* canvas_ = nullptr; | 49 GlCanvas* canvas_ = nullptr; |
50 | 50 |
51 DISALLOW_COPY_AND_ASSIGN(GlDesktop); | 51 DISALLOW_COPY_AND_ASSIGN(GlDesktop); |
52 }; | 52 }; |
53 | 53 |
54 } // namespace remoting | 54 } // namespace remoting |
55 | 55 |
56 #endif // REMOTING_CLIENT_OPENGL_GL_DESKTOP_H_ | 56 #endif // REMOTING_CLIENT_OPENGL_GL_DESKTOP_H_ |
OLD | NEW |