| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_FRAME_CONSUMER_H_ | 5 #ifndef REMOTING_CLIENT_FRAME_CONSUMER_H_ |
| 6 #define REMOTING_CLIENT_FRAME_CONSUMER_H_ | 6 #define REMOTING_CLIENT_FRAME_CONSUMER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 | 9 |
| 10 namespace webrtc { | 10 namespace webrtc { |
| 11 class DesktopFrame; | 11 class DesktopFrame; |
| 12 class DesktopRect; | 12 class DesktopRect; |
| 13 class DesktopRegion; | 13 class DesktopRegion; |
| 14 class DesktopSize; | 14 class DesktopSize; |
| 15 class DesktopVector; | 15 class DesktopVector; |
| 16 } // namespace webrtc | 16 } // namespace webrtc |
| 17 | 17 |
| 18 namespace remoting { | 18 namespace remoting { |
| 19 | 19 |
| 20 class FrameConsumer { | 20 class FrameConsumer { |
| 21 public: | 21 public: |
| 22 | |
| 23 // List of supported pixel formats needed by various platforms. | 22 // List of supported pixel formats needed by various platforms. |
| 24 enum PixelFormat { | 23 enum PixelFormat { |
| 25 FORMAT_BGRA, // Used by the Pepper plugin. | 24 FORMAT_BGRA, // Used by the Pepper plugin. |
| 26 FORMAT_RGBA, // Used for Android's Bitmap class. | 25 FORMAT_RGBA, // Used for Android's Bitmap class. |
| 27 }; | 26 }; |
| 28 | 27 |
| 29 // Paints the contents of |buffer| into the area of the view identified | 28 virtual scoped_ptr<webrtc::DesktopFrame> AllocateFrame( |
| 30 // by |clip_area|. |view_size| specifies the full-frame dimensions to which | 29 const webrtc::DesktopSize& size) = 0; |
| 31 // the |buffer|/|clip_area| portion was scaled. Implementations may be | |
| 32 // optimized to only paint pixels within the intersection of |region| and | |
| 33 // |clip_area|. If |shape| is non-NULL then it specifies the complete shape | |
| 34 // of the frame, otherwise the frame is un-shaped. | |
| 35 // | |
| 36 // N.B. |clip_area|, |region| and |shape| should be provided in output view | |
| 37 // coordinates. | |
| 38 virtual void ApplyBuffer(const webrtc::DesktopSize& view_size, | |
| 39 const webrtc::DesktopRect& clip_area, | |
| 40 webrtc::DesktopFrame* buffer, | |
| 41 const webrtc::DesktopRegion& region, | |
| 42 const webrtc::DesktopRegion* shape) = 0; | |
| 43 | 30 |
| 44 // Accepts a buffer that couldn't be used for drawing for any reason (shutdown | 31 virtual void DrawFrame(scoped_ptr<webrtc::DesktopFrame> frame, |
| 45 // is in progress, the view area has changed, etc.). The accepted buffer can | 32 const base::Closure& done) = 0; |
| 46 // be freed or reused for another drawing operation. | |
| 47 virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) = 0; | |
| 48 | |
| 49 // Set the dimension of the entire host screen. | |
| 50 virtual void SetSourceSize(const webrtc::DesktopSize& source_size, | |
| 51 const webrtc::DesktopVector& dpi) = 0; | |
| 52 | 33 |
| 53 // Returns the preferred pixel encoding for the platform. | 34 // Returns the preferred pixel encoding for the platform. |
| 54 virtual PixelFormat GetPixelFormat() = 0; | 35 virtual PixelFormat GetPixelFormat() = 0; |
| 55 | 36 |
| 56 protected: | 37 protected: |
| 57 FrameConsumer() {} | 38 FrameConsumer() {} |
| 58 virtual ~FrameConsumer() {} | 39 virtual ~FrameConsumer() {} |
| 59 | 40 |
| 60 private: | 41 private: |
| 61 DISALLOW_COPY_AND_ASSIGN(FrameConsumer); | 42 DISALLOW_COPY_AND_ASSIGN(FrameConsumer); |
| 62 }; | 43 }; |
| 63 | 44 |
| 64 } // namespace remoting | 45 } // namespace remoting |
| 65 | 46 |
| 66 #endif // REMOTING_CLIENT_FRAME_CONSUMER_H_ | 47 #endif // REMOTING_CLIENT_FRAME_CONSUMER_H_ |
| OLD | NEW |