| Index: remoting/client/plugin/pepper_view.h
|
| diff --git a/remoting/client/plugin/pepper_view.h b/remoting/client/plugin/pepper_view.h
|
| index 426ced09f7b4581eee1828cf2366c26d0a7f67de..525eb0bc547af556435e36d4432aef403319a757 100644
|
| --- a/remoting/client/plugin/pepper_view.h
|
| +++ b/remoting/client/plugin/pepper_view.h
|
| @@ -8,11 +8,10 @@
|
| #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_
|
| #define REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_
|
|
|
| -#include <vector>
|
| +#include <list>
|
|
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/memory/weak_ptr.h"
|
| -#include "media/base/video_frame.h"
|
| #include "ppapi/cpp/graphics_2d.h"
|
| #include "ppapi/cpp/point.h"
|
| #include "remoting/client/chromoting_view.h"
|
| @@ -22,13 +21,16 @@ namespace remoting {
|
|
|
| class ChromotingInstance;
|
| class ClientContext;
|
| +class FrameProducer;
|
|
|
| class PepperView : public ChromotingView,
|
| public FrameConsumer {
|
| public:
|
| - // Constructs a PepperView for the |instance|. The |instance| and
|
| - // |context| must outlive this class.
|
| - PepperView(ChromotingInstance* instance, ClientContext* context);
|
| + // Constructs a PepperView for the |instance|. The |instance|, |context|
|
| + // and |producer| must outlive this class.
|
| + PepperView(ChromotingInstance* instance,
|
| + ClientContext* context,
|
| + FrameProducer* producer);
|
| virtual ~PepperView();
|
|
|
| // ChromotingView implementation.
|
| @@ -42,44 +44,45 @@ class PepperView : public ChromotingView,
|
| protocol::ConnectionToHost::Error error) OVERRIDE;
|
|
|
| // FrameConsumer implementation.
|
| - virtual void AllocateFrame(media::VideoFrame::Format format,
|
| - const SkISize& size,
|
| - scoped_refptr<media::VideoFrame>* frame_out,
|
| - const base::Closure& done) OVERRIDE;
|
| - virtual void ReleaseFrame(media::VideoFrame* frame) OVERRIDE;
|
| - virtual void OnPartialFrameOutput(media::VideoFrame* frame,
|
| - SkRegion* region,
|
| - const base::Closure& done) OVERRIDE;
|
| -
|
| - // Sets the display size of this view. Returns true if plugin size has
|
| - // changed, false otherwise.
|
| - bool SetViewSize(const SkISize& plugin_size);
|
| + virtual void PaintBuffer(const SkISize& view_size,
|
| + const SkIRect& clip_area,
|
| + pp::ImageData* buffer,
|
| + const SkRegion& region) OVERRIDE;
|
| + virtual void ReturnBuffer(pp::ImageData* buffer) OVERRIDE;
|
| + virtual void SetScreenSize(const SkISize& screen_size) OVERRIDE;
|
| +
|
| + // Sets the display size and clipping area of this view. Returns true
|
| + // if plugin size or clipping area has changed, false otherwise.
|
| + bool SetView(const SkISize& view_size, const SkIRect& clip_area);
|
|
|
| // Return the client view and original host dimensions.
|
| const SkISize& get_view_size() const {
|
| return view_size_;
|
| }
|
| - const SkISize& get_host_size() const {
|
| - return host_size_;
|
| + const SkISize& get_screen_size() const {
|
| + return screen_size_;
|
| }
|
|
|
| private:
|
| - void OnPaintDone(base::Time paint_start);
|
| -
|
| - // Set the dimension of the entire host screen.
|
| - void SetHostSize(const SkISize& host_size);
|
| + // This routine allocates an image buffer.
|
| + pp::ImageData* AllocateBuffer();
|
|
|
| - void PaintFrame(media::VideoFrame* frame, const SkRegion& region);
|
| + // This routine frees an image buffer allocated by AllocateBuffer().
|
| + void FreeBuffer(pp::ImageData* buffer);
|
|
|
| - // Render the rectangle of |frame| to the backing store.
|
| - // Returns true if this rectangle is not clipped.
|
| - bool PaintRect(media::VideoFrame* frame, const SkIRect& rect);
|
| + // This routine makes sure that enough image buffers are in flight to keep
|
| + // the decoding pipeline busy.
|
| + void InitiateDrawing();
|
|
|
| - // Blanks out a rectangle in an image.
|
| - void BlankRect(pp::ImageData& image_data, const pp::Rect& rect);
|
| + // This routine applies the given image buffer to the screen taking into
|
| + // account |clip_area| of the buffer and |region| describing valid parts
|
| + // of the buffer.
|
| + void FlushBuffer(const SkIRect& clip_area,
|
| + pp::ImageData* buffer,
|
| + const SkRegion& region);
|
|
|
| - // Perform a flush on the graphics context.
|
| - void FlushGraphics(base::Time paint_start);
|
| + // This is a completion callback for FlushGraphics().
|
| + void OnFlushDone(base::Time paint_start, pp::ImageData* buffer);
|
|
|
| // Reference to the creating plugin instance. Needed for interacting with
|
| // pepper. Marking explicitly as const since it must be initialized at
|
| @@ -91,22 +94,36 @@ class PepperView : public ChromotingView,
|
|
|
| pp::Graphics2D graphics2d_;
|
|
|
| - // A backing store that saves the current desktop image.
|
| - scoped_ptr<pp::ImageData> backing_store_;
|
| + FrameProducer* producer_;
|
|
|
| - // True if there is pending paint commands in Pepper's queue. This is set to
|
| - // true if the last flush returns a PP_ERROR_INPROGRESS error.
|
| - bool flush_blocked_;
|
| + // List of allocated image buffers.
|
| + std::list<pp::ImageData*> buffers_;
|
| +
|
| + pp::ImageData* merge_buffer_;
|
| + SkIRect merge_clip_area_;
|
| + SkRegion merge_region_;
|
|
|
| // The size of the plugin element.
|
| SkISize view_size_;
|
|
|
| + // The current clip area rectangle.
|
| + SkIRect clip_area_;
|
| +
|
| // The size of the host screen.
|
| - SkISize host_size_;
|
| + SkISize screen_size_;
|
|
|
| - bool is_static_fill_;
|
| uint32 static_fill_color_;
|
|
|
| + // True if there is pending paint commands in Pepper's queue. This is set to
|
| + // true if the last flush returns a PP_ERROR_INPROGRESS error.
|
| + bool flush_pending_;
|
| +
|
| + // When true no new work should be posted to the producer.
|
| + bool producer_disabled_;
|
| +
|
| + // True if solid fill requested.
|
| + bool solid_fill_requested_;
|
| +
|
| base::WeakPtrFactory<PepperView> weak_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(PepperView);
|
|
|