Re-land: C++ readability review
[chromium-blink-merge.git] / remoting / client / frame_consumer.h
blob0996332accd5353c80f61e725e2b024921e7ae27
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
3 // found in the LICENSE file.
5 #ifndef REMOTING_CLIENT_FRAME_CONSUMER_H_
6 #define REMOTING_CLIENT_FRAME_CONSUMER_H_
8 #include "base/basictypes.h"
10 namespace webrtc {
11 class DesktopFrame;
12 class DesktopRect;
13 class DesktopRegion;
14 class DesktopSize;
15 class DesktopVector;
16 } // namespace webrtc
18 namespace remoting {
20 class FrameConsumer {
21 public:
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.
29 // Accepts a buffer to be painted to the screen. The buffer's dimensions and
30 // relative position within the frame are specified by |clip_area|. Only
31 // pixels falling within |region| and the current clipping area are painted.
32 // The function assumes that the passed buffer was scaled to fit a window
33 // having |view_size| dimensions.
35 // N.B. Both |clip_area| and |region| are in output coordinates relative to
36 // the frame.
37 virtual void ApplyBuffer(const webrtc::DesktopSize& view_size,
38 const webrtc::DesktopRect& clip_area,
39 webrtc::DesktopFrame* buffer,
40 const webrtc::DesktopRegion& region,
41 const webrtc::DesktopRegion& shape) = 0;
43 // Accepts a buffer that couldn't be used for drawing for any reason (shutdown
44 // is in progress, the view area has changed, etc.). The accepted buffer can
45 // be freed or reused for another drawing operation.
46 virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) = 0;
48 // Set the dimension of the entire host screen.
49 virtual void SetSourceSize(const webrtc::DesktopSize& source_size,
50 const webrtc::DesktopVector& dpi) = 0;
52 // Returns the preferred pixel encoding for the platform.
53 virtual PixelFormat GetPixelFormat() = 0;
55 protected:
56 FrameConsumer() {}
57 virtual ~FrameConsumer() {}
59 private:
60 DISALLOW_COPY_AND_ASSIGN(FrameConsumer);
63 } // namespace remoting
65 #endif // REMOTING_CLIENT_FRAME_CONSUMER_H_