Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: remoting/client/plugin/pepper_view.h

Issue 7453003: Change Chromoting client to use Pepper's new Resource-base InputEvents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tweaks Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/client/plugin/pepper_input_handler.cc ('k') | remoting/client/plugin/pepper_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This class is an implementation of the ChromotingView using Pepper devices 5 // This class is an implementation of the ChromotingView using Pepper devices
6 // as the backing stores. This class is used only on pepper thread. 6 // as the backing stores. This class is used only on pepper thread.
7 // Chromoting objects access this object through PepperViewProxy which 7 // Chromoting objects access this object through PepperViewProxy which
8 // delegates method calls on the pepper thread. 8 // delegates method calls on the pepper thread.
9 9
10 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_ 10 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_
11 #define REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_ 11 #define REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_
12 12
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/task.h" 14 #include "base/task.h"
15 #include "media/base/video_frame.h" 15 #include "media/base/video_frame.h"
16 #include "ppapi/cpp/graphics_2d.h" 16 #include "ppapi/cpp/graphics_2d.h"
17 #include "ppapi/cpp/point.h"
17 #include "remoting/client/chromoting_view.h" 18 #include "remoting/client/chromoting_view.h"
18 #include "remoting/client/frame_consumer.h" 19 #include "remoting/client/frame_consumer.h"
19 20
20 namespace remoting { 21 namespace remoting {
21 22
22 class ChromotingInstance; 23 class ChromotingInstance;
23 class ClientContext; 24 class ClientContext;
24 25
25 class PepperView : public ChromotingView, 26 class PepperView : public ChromotingView,
26 public FrameConsumer { 27 public FrameConsumer {
27 public: 28 public:
28 // Constructs a PepperView that draws to the |rendering_device|. The 29 // Constructs a PepperView that draws to the |rendering_device|. The
29 // |rendering_device| instance must outlive this class. 30 // |rendering_device| instance must outlive this class.
30 PepperView(ChromotingInstance* instance, ClientContext* context); 31 PepperView(ChromotingInstance* instance, ClientContext* context);
31 virtual ~PepperView(); 32 virtual ~PepperView();
32 33
33 // ChromotingView implementation. 34 // ChromotingView implementation.
34 virtual bool Initialize() OVERRIDE; 35 virtual bool Initialize() OVERRIDE;
35 virtual void TearDown() OVERRIDE; 36 virtual void TearDown() OVERRIDE;
36 virtual void Paint() OVERRIDE; 37 virtual void Paint() OVERRIDE;
37 virtual void SetSolidFill(uint32 color) OVERRIDE; 38 virtual void SetSolidFill(uint32 color) OVERRIDE;
38 virtual void UnsetSolidFill() OVERRIDE; 39 virtual void UnsetSolidFill() OVERRIDE;
39 virtual void SetConnectionState(ConnectionState state) OVERRIDE; 40 virtual void SetConnectionState(ConnectionState state) OVERRIDE;
40 virtual void UpdateLoginStatus(bool success, const std::string& info) 41 virtual void UpdateLoginStatus(bool success, const std::string& info)
41 OVERRIDE; 42 OVERRIDE;
42 virtual void SetViewport(int x, int y, int width, int height) OVERRIDE; 43 virtual void SetViewport(int x, int y, int width, int height) OVERRIDE;
43 virtual gfx::Point ConvertScreenToHost(const gfx::Point& p) const OVERRIDE;
44 44
45 // FrameConsumer implementation. 45 // FrameConsumer implementation.
46 virtual void AllocateFrame(media::VideoFrame::Format format, 46 virtual void AllocateFrame(media::VideoFrame::Format format,
47 size_t width, 47 size_t width,
48 size_t height, 48 size_t height,
49 base::TimeDelta timestamp, 49 base::TimeDelta timestamp,
50 base::TimeDelta duration, 50 base::TimeDelta duration,
51 scoped_refptr<media::VideoFrame>* frame_out, 51 scoped_refptr<media::VideoFrame>* frame_out,
52 Task* done); 52 Task* done);
53 virtual void ReleaseFrame(media::VideoFrame* frame); 53 virtual void ReleaseFrame(media::VideoFrame* frame);
54 virtual void OnPartialFrameOutput(media::VideoFrame* frame, 54 virtual void OnPartialFrameOutput(media::VideoFrame* frame,
55 UpdatedRects* rects, 55 UpdatedRects* rects,
56 Task* done); 56 Task* done);
57 57
58 // Converts screen co-ordinates to host co-ordinates, and clips to the host
59 // screen.
60 pp::Point ConvertScreenToHost(const pp::Point& p) const;
61
58 // Sets the size of the visible screen area that this object can render into. 62 // Sets the size of the visible screen area that this object can render into.
59 void SetScreenSize(int width, int height); 63 void SetScreenSize(int width, int height);
60 64
61 // Sets whether the host screen is scaled to fit the visible screen area. 65 // Sets whether the host screen is scaled to fit the visible screen area.
62 void SetScaleToFit(bool enabled); 66 void SetScaleToFit(bool enabled);
63 67
64 private: 68 private:
65 void OnPaintDone(base::Time paint_start); 69 void OnPaintDone(base::Time paint_start);
66 void OnRefreshPaintDone(); 70 void OnRefreshPaintDone();
67 void PaintFrame(media::VideoFrame* frame, UpdatedRects* rects); 71 void PaintFrame(media::VideoFrame* frame, UpdatedRects* rects);
68 72
69 // Blits the pixels in |r| in the backing store into the corresponding 73 // Blits the pixels in |r| in the backing store into the corresponding
70 // rectangle in the scaled backing store. Returns that rectangle. 74 // rectangle in the scaled backing store. Returns that rectangle.
71 gfx::Rect UpdateScaledBackingStore(const gfx::Rect& r); 75 pp::Rect UpdateScaledBackingStore(const pp::Rect& r);
72 76
73 // Blanks out a rectangle in an image. 77 // Blanks out a rectangle in an image.
74 void BlankRect(pp::ImageData& image_data, const gfx::Rect& rect); 78 void BlankRect(pp::ImageData& image_data, const pp::Rect& rect);
75 79
76 // Converts host co-ordinates to screen co-ordinates. 80 // Converts host co-ordinates to screen co-ordinates.
77 gfx::Point ConvertHostToScreen(const gfx::Point& p) const; 81 pp::Point ConvertHostToScreen(const pp::Point& p) const;
78 82
79 // Sets the screen scale. A value of 1.0 indicates no scaling. 83 // Sets the screen scale. A value of 1.0 indicates no scaling.
80 void SetScreenScale(double screen_scale); 84 void SetScreenScale(double screen_scale);
81 85
82 // Paints the entire host screen. 86 // Paints the entire host screen.
83 // This is called, for example, when the screen scale is changed. 87 // This is called, for example, when the screen scale is changed.
84 void RefreshPaint(); 88 void RefreshPaint();
85 89
86 // Resizes internals of this object after the host screen size has changed, 90 // Resizes internals of this object after the host screen size has changed,
87 // or the scale applied to that screen has changed. 91 // or the scale applied to that screen has changed.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 uint32 static_fill_color_; 136 uint32 static_fill_color_;
133 137
134 ScopedRunnableMethodFactory<PepperView> task_factory_; 138 ScopedRunnableMethodFactory<PepperView> task_factory_;
135 139
136 DISALLOW_COPY_AND_ASSIGN(PepperView); 140 DISALLOW_COPY_AND_ASSIGN(PepperView);
137 }; 141 };
138 142
139 } // namespace remoting 143 } // namespace remoting
140 144
141 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_ 145 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_
OLDNEW
« no previous file with comments | « remoting/client/plugin/pepper_input_handler.cc ('k') | remoting/client/plugin/pepper_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698