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