| 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_PRODUCER_H_ | 5 #ifndef REMOTING_CLIENT_FRAME_PRODUCER_H_ |
| 6 #define REMOTING_CLIENT_FRAME_PRODUCER_H_ | 6 #define REMOTING_CLIENT_FRAME_PRODUCER_H_ |
| 7 | 7 |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "third_party/skia/include/core/SkRect.h" | 9 #include "third_party/skia/include/core/SkRect.h" |
| 10 #include "third_party/skia/include/core/SkRegion.h" | 10 #include "third_party/skia/include/core/SkRegion.h" |
| 11 #include "third_party/skia/include/core/SkSize.h" | 11 #include "third_party/skia/include/core/SkSize.h" |
| 12 | 12 |
| 13 namespace pp { | |
| 14 class ImageData; | |
| 15 } // namespace pp | |
| 16 | |
| 17 namespace remoting { | 13 namespace remoting { |
| 18 | 14 |
| 19 class FrameProducer { | 15 class FrameProducer { |
| 20 public: | 16 public: |
| 21 FrameProducer() {} | 17 FrameProducer() {} |
| 22 | 18 |
| 23 // Adds an image buffer to the pool of pending buffers for subsequent drawing. | 19 // Adds an image buffer to the pool of pending buffers for subsequent drawing. |
| 24 // Once drawing is completed the buffer will be returned to the consumer via | 20 // Once drawing is completed the buffer will be returned to the consumer via |
| 25 // the FrameConsumer::ApplyBuffer() call. Alternatively an empty buffer could | 21 // the FrameConsumer::ApplyBuffer() call. Alternatively an empty buffer could |
| 26 // be returned via the FrameConsumer::ReturnBuffer() call. | 22 // be returned via the FrameConsumer::ReturnBuffer() call. |
| 27 // | 23 // |
| 28 // The passed buffer must be large enough to hold the whole clipping area. | 24 // The passed buffer must be large enough to hold the whole clipping area. |
| 29 virtual void DrawBuffer(pp::ImageData* buffer) = 0; | 25 virtual void DrawBuffer(ImageBuffer* buffer) = 0; |
| 30 | 26 |
| 31 // Requests repainting of the specified |region| of the frame as soon as | 27 // Requests repainting of the specified |region| of the frame as soon as |
| 32 // possible. |region| is specified in output coordinates relative to | 28 // possible. |region| is specified in output coordinates relative to |
| 33 // the beginning of the frame. | 29 // the beginning of the frame. |
| 34 virtual void InvalidateRegion(const SkRegion& region) = 0; | 30 virtual void InvalidateRegion(const SkRegion& region) = 0; |
| 35 | 31 |
| 36 // Requests returing of all pending buffers to the consumer via | 32 // Requests returing of all pending buffers to the consumer via |
| 37 // FrameConsumer::ReturnBuffer() calls. | 33 // FrameConsumer::ReturnBuffer() calls. |
| 38 virtual void RequestReturnBuffers(const base::Closure& done) = 0; | 34 virtual void RequestReturnBuffers(const base::Closure& done) = 0; |
| 39 | 35 |
| 40 // Notifies the producer of changes to the output view size or clipping area. | 36 // Notifies the producer of changes to the output view size or clipping area. |
| 41 // Implementations must cope with empty |view_size| or |clip_area|. | 37 // Implementations must cope with empty |view_size| or |clip_area|. |
| 42 virtual void SetOutputSizeAndClip(const SkISize& view_size, | 38 virtual void SetOutputSizeAndClip(const SkISize& view_size, |
| 43 const SkIRect& clip_area) = 0; | 39 const SkIRect& clip_area) = 0; |
| 44 | 40 |
| 45 // Returns a reference to the shape of the most recently drawn buffer. | 41 // Returns a reference to the shape of the most recently drawn buffer. |
| 46 virtual const SkRegion* GetBufferShape() = 0; | 42 virtual const SkRegion* GetBufferShape() = 0; |
| 47 | 43 |
| 48 protected: | 44 protected: |
| 49 virtual ~FrameProducer() {} | 45 virtual ~FrameProducer() {} |
| 50 | 46 |
| 51 private: | 47 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(FrameProducer); | 48 DISALLOW_COPY_AND_ASSIGN(FrameProducer); |
| 53 }; | 49 }; |
| 54 | 50 |
| 55 } // namespace remoting | 51 } // namespace remoting |
| 56 | 52 |
| 57 #endif // REMOTING_CLIENT_FRAME_PRODUCER_H_ | 53 #endif // REMOTING_CLIENT_FRAME_PRODUCER_H_ |
| OLD | NEW |