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

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

Issue 10785041: Make Chromoting client plugin always render at device DPI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
OLDNEW
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 // This class is an implementation of the ChromotingView for Pepper. It is 5 // This class is an implementation of the ChromotingView for Pepper. It is
6 // callable only on the Pepper thread. 6 // callable only on the Pepper thread.
7 7
8 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_ 8 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_
9 #define REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_ 9 #define REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_
10 10
11 #include <list> 11 #include <list>
12 12
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "ppapi/cpp/graphics_2d.h" 14 #include "ppapi/cpp/graphics_2d.h"
15 #include "ppapi/cpp/view.h"
15 #include "ppapi/cpp/point.h" 16 #include "ppapi/cpp/point.h"
16 #include "remoting/client/chromoting_view.h" 17 #include "remoting/client/chromoting_view.h"
17 #include "remoting/client/frame_consumer.h" 18 #include "remoting/client/frame_consumer.h"
18 19
19 namespace remoting { 20 namespace remoting {
20 21
21 class ChromotingInstance; 22 class ChromotingInstance;
22 class ClientContext; 23 class ClientContext;
23 class FrameProducer; 24 class FrameProducer;
24 25
(...skipping 18 matching lines...) Expand all
43 virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE; 44 virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE;
44 45
45 // FrameConsumer implementation. 46 // FrameConsumer implementation.
46 virtual void ApplyBuffer(const SkISize& view_size, 47 virtual void ApplyBuffer(const SkISize& view_size,
47 const SkIRect& clip_area, 48 const SkIRect& clip_area,
48 pp::ImageData* buffer, 49 pp::ImageData* buffer,
49 const SkRegion& region) OVERRIDE; 50 const SkRegion& region) OVERRIDE;
50 virtual void ReturnBuffer(pp::ImageData* buffer) OVERRIDE; 51 virtual void ReturnBuffer(pp::ImageData* buffer) OVERRIDE;
51 virtual void SetSourceSize(const SkISize& source_size) OVERRIDE; 52 virtual void SetSourceSize(const SkISize& source_size) OVERRIDE;
52 53
53 // Sets the display size and clipping area of this view. 54 // Updates the PepperView's size, clipping area and scale factor.
54 void SetView(const SkISize& view_size, const SkIRect& clip_area); 55 void SetView(const pp::View& view);
55 56
56 // Return the client view and original host dimensions. 57 // Return the dimensions of the view and source in device pixels.
57 const SkISize& get_view_size() const { 58 const SkISize& get_view_size() const {
58 return view_size_; 59 return view_size_;
59 } 60 }
60 const SkISize& get_screen_size() const { 61 const SkISize& get_screen_size() const {
61 return source_size_; 62 return source_size_;
62 } 63 }
63 64
65 // Return the dimensions of the view in Density Independent Pixels (DIPs).
66 // On high-DPI devices this will be smaller than the size in device pixels.
67 const SkISize& get_view_size_dips() const {
68 return view_size_dips_;
69 }
70
64 private: 71 private:
65 // This routine allocates an image buffer. 72 // This routine allocates an image buffer.
66 pp::ImageData* AllocateBuffer(); 73 pp::ImageData* AllocateBuffer();
67 74
68 // This routine frees an image buffer allocated by AllocateBuffer(). 75 // This routine frees an image buffer allocated by AllocateBuffer().
69 void FreeBuffer(pp::ImageData* buffer); 76 void FreeBuffer(pp::ImageData* buffer);
70 77
71 // This routine makes sure that enough image buffers are in flight to keep 78 // This routine makes sure that enough image buffers are in flight to keep
72 // the decoding pipeline busy. 79 // the decoding pipeline busy.
73 void InitiateDrawing(); 80 void InitiateDrawing();
(...skipping 16 matching lines...) Expand all
90 // Context should be constant for the lifetime of the plugin. 97 // Context should be constant for the lifetime of the plugin.
91 ClientContext* const context_; 98 ClientContext* const context_;
92 99
93 pp::Graphics2D graphics2d_; 100 pp::Graphics2D graphics2d_;
94 101
95 FrameProducer* producer_; 102 FrameProducer* producer_;
96 103
97 // List of allocated image buffers. 104 // List of allocated image buffers.
98 std::list<pp::ImageData*> buffers_; 105 std::list<pp::ImageData*> buffers_;
99 106
107 // Queued buffer to paint, with clip area and dirty region in device pixels.
100 pp::ImageData* merge_buffer_; 108 pp::ImageData* merge_buffer_;
101 SkIRect merge_clip_area_; 109 SkIRect merge_clip_area_;
102 SkRegion merge_region_; 110 SkRegion merge_region_;
103 111
104 // The size of the plugin element. 112 // View size, clip area and host dimensions, in device pixels.
105 SkISize view_size_; 113 SkISize view_size_;
114 SkIRect clip_area_;
115 SkISize source_size_;
106 116
107 // The current clip area rectangle. 117 // View size in Density-Independent pixels.
108 SkIRect clip_area_; 118 SkISize view_size_dips_;
109 119
110 // The size of the host screen. 120 // DIP-to-device pixel scale factor.
111 SkISize source_size_; 121 float view_scale_;
112 122
113 // True if there is already a Flush() pending on the Graphics2D context. 123 // True if there is already a Flush() pending on the Graphics2D context.
114 bool flush_pending_; 124 bool flush_pending_;
115 125
116 // True after Initialize() has been called, until TearDown(). 126 // True after Initialize() has been called, until TearDown().
117 bool is_initialized_; 127 bool is_initialized_;
118 128
119 // True after the first call to ApplyBuffer(). 129 // True after the first call to ApplyBuffer().
120 bool frame_received_; 130 bool frame_received_;
121 131
122 DISALLOW_COPY_AND_ASSIGN(PepperView); 132 DISALLOW_COPY_AND_ASSIGN(PepperView);
123 }; 133 };
124 134
125 } // namespace remoting 135 } // namespace remoting
126 136
127 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_ 137 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698