| 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. |
| 24 enum PixelFormat { |
| 25 FORMAT_BGRA, // Used by the Pepper plugin. |
| 26 FORMAT_RGBA, // Used for Android's Bitmap class. |
| 27 }; |
| 28 |
| 22 // Accepts a buffer to be painted to the screen. The buffer's dimensions and | 29 // Accepts a buffer to be painted to the screen. The buffer's dimensions and |
| 23 // relative position within the frame are specified by |clip_area|. Only | 30 // relative position within the frame are specified by |clip_area|. Only |
| 24 // pixels falling within |region| and the current clipping area are painted. | 31 // pixels falling within |region| and the current clipping area are painted. |
| 25 // The function assumes that the passed buffer was scaled to fit a window | 32 // The function assumes that the passed buffer was scaled to fit a window |
| 26 // having |view_size| dimensions. | 33 // having |view_size| dimensions. |
| 27 // | 34 // |
| 28 // N.B. Both |clip_area| and |region| are in output coordinates relative to | 35 // N.B. Both |clip_area| and |region| are in output coordinates relative to |
| 29 // the frame. | 36 // the frame. |
| 30 virtual void ApplyBuffer(const webrtc::DesktopSize& view_size, | 37 virtual void ApplyBuffer(const webrtc::DesktopSize& view_size, |
| 31 const webrtc::DesktopRect& clip_area, | 38 const webrtc::DesktopRect& clip_area, |
| 32 webrtc::DesktopFrame* buffer, | 39 webrtc::DesktopFrame* buffer, |
| 33 const webrtc::DesktopRegion& region) = 0; | 40 const webrtc::DesktopRegion& region) = 0; |
| 34 | 41 |
| 35 // Accepts a buffer that couldn't be used for drawing for any reason (shutdown | 42 // Accepts a buffer that couldn't be used for drawing for any reason (shutdown |
| 36 // is in progress, the view area has changed, etc.). The accepted buffer can | 43 // is in progress, the view area has changed, etc.). The accepted buffer can |
| 37 // be freed or reused for another drawing operation. | 44 // be freed or reused for another drawing operation. |
| 38 virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) = 0; | 45 virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) = 0; |
| 39 | 46 |
| 40 // Set the dimension of the entire host screen. | 47 // Set the dimension of the entire host screen. |
| 41 virtual void SetSourceSize(const webrtc::DesktopSize& source_size, | 48 virtual void SetSourceSize(const webrtc::DesktopSize& source_size, |
| 42 const webrtc::DesktopVector& dpi) = 0; | 49 const webrtc::DesktopVector& dpi) = 0; |
| 43 | 50 |
| 51 // Returns the preferred pixel encoding for the platform. |
| 52 virtual PixelFormat GetPixelFormat() = 0; |
| 53 |
| 44 protected: | 54 protected: |
| 45 FrameConsumer() {} | 55 FrameConsumer() {} |
| 46 virtual ~FrameConsumer() {} | 56 virtual ~FrameConsumer() {} |
| 47 | 57 |
| 48 private: | 58 private: |
| 49 DISALLOW_COPY_AND_ASSIGN(FrameConsumer); | 59 DISALLOW_COPY_AND_ASSIGN(FrameConsumer); |
| 50 }; | 60 }; |
| 51 | 61 |
| 52 } // namespace remoting | 62 } // namespace remoting |
| 53 | 63 |
| 54 #endif // REMOTING_CLIENT_FRAME_CONSUMER_H_ | 64 #endif // REMOTING_CLIENT_FRAME_CONSUMER_H_ |
| OLD | NEW |