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 CONTENT_RENDERER_PEPPER_PEPPER_GRAPHICS_2D_HOST_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_GRAPHICS_2D_HOST_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_GRAPHICS_2D_HOST_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_GRAPHICS_2D_HOST_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 #include "ppapi/c/ppb_graphics_2d.h" | 16 #include "ppapi/c/ppb_graphics_2d.h" |
17 #include "ppapi/host/host_message_context.h" | 17 #include "ppapi/host/host_message_context.h" |
18 #include "ppapi/host/resource_host.h" | 18 #include "ppapi/host/resource_host.h" |
19 #include "third_party/WebKit/public/platform/WebCanvas.h" | 19 #include "third_party/WebKit/public/platform/WebCanvas.h" |
20 #include "ui/gfx/geometry/point.h" | 20 #include "ui/gfx/geometry/point.h" |
21 #include "ui/gfx/geometry/size.h" | 21 #include "ui/gfx/geometry/size.h" |
22 #include "ui/gfx/transform.h" | |
22 | 23 |
23 namespace cc { | 24 namespace cc { |
24 class SharedBitmap; | 25 class SharedBitmap; |
25 class SingleReleaseCallback; | 26 class SingleReleaseCallback; |
26 class TextureMailbox; | 27 class TextureMailbox; |
27 } | 28 } |
28 | 29 |
29 namespace gfx { | 30 namespace gfx { |
30 class Rect; | 31 class Rect; |
31 } | 32 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 cc::TextureMailbox* mailbox, | 80 cc::TextureMailbox* mailbox, |
80 std::unique_ptr<cc::SingleReleaseCallback>* release_callback); | 81 std::unique_ptr<cc::SingleReleaseCallback>* release_callback); |
81 void AttachedToNewLayer(); | 82 void AttachedToNewLayer(); |
82 | 83 |
83 // Notifications about the view's progress painting. See PluginInstance. | 84 // Notifications about the view's progress painting. See PluginInstance. |
84 // These messages are used to send Flush callbacks to the plugin. | 85 // These messages are used to send Flush callbacks to the plugin. |
85 void ViewInitiatedPaint(); | 86 void ViewInitiatedPaint(); |
86 | 87 |
87 void SetScale(float scale); | 88 void SetScale(float scale); |
88 float GetScale() const; | 89 float GetScale() const; |
90 void SetLayerTransform(float Scale, | |
91 const PP_Point& Origin, | |
92 const PP_Point& Transform); | |
89 bool IsAlwaysOpaque() const; | 93 bool IsAlwaysOpaque() const; |
90 PPB_ImageData_Impl* ImageData(); | 94 PPB_ImageData_Impl* ImageData(); |
91 gfx::Size Size() const; | 95 gfx::Size Size() const; |
92 | 96 |
93 void ClearCache(); | 97 void ClearCache(); |
94 | 98 |
95 private: | 99 private: |
96 PepperGraphics2DHost(RendererPpapiHost* host, | 100 PepperGraphics2DHost(RendererPpapiHost* host, |
97 PP_Instance instance, | 101 PP_Instance instance, |
98 PP_Resource resource); | 102 PP_Resource resource); |
(...skipping 10 matching lines...) Expand all Loading... | |
109 const PP_Rect& src_rect); | 113 const PP_Rect& src_rect); |
110 int32_t OnHostMsgScroll(ppapi::host::HostMessageContext* context, | 114 int32_t OnHostMsgScroll(ppapi::host::HostMessageContext* context, |
111 bool clip_specified, | 115 bool clip_specified, |
112 const PP_Rect& clip, | 116 const PP_Rect& clip, |
113 const PP_Point& amount); | 117 const PP_Point& amount); |
114 int32_t OnHostMsgReplaceContents(ppapi::host::HostMessageContext* context, | 118 int32_t OnHostMsgReplaceContents(ppapi::host::HostMessageContext* context, |
115 const ppapi::HostResource& image_data); | 119 const ppapi::HostResource& image_data); |
116 int32_t OnHostMsgFlush(ppapi::host::HostMessageContext* context); | 120 int32_t OnHostMsgFlush(ppapi::host::HostMessageContext* context); |
117 int32_t OnHostMsgSetScale(ppapi::host::HostMessageContext* context, | 121 int32_t OnHostMsgSetScale(ppapi::host::HostMessageContext* context, |
118 float scale); | 122 float scale); |
123 int32_t OnHostMsgSetLayerTransform(ppapi::host::HostMessageContext* context, | |
124 float Scale, | |
125 const PP_Point& Origin, | |
126 const PP_Point& Transform); | |
119 int32_t OnHostMsgReadImageData(ppapi::host::HostMessageContext* context, | 127 int32_t OnHostMsgReadImageData(ppapi::host::HostMessageContext* context, |
120 PP_Resource image, | 128 PP_Resource image, |
121 const PP_Point& top_left); | 129 const PP_Point& top_left); |
122 | 130 |
123 // If |old_image_data| is not NULL, a previous used ImageData object will be | 131 // If |old_image_data| is not NULL, a previous used ImageData object will be |
124 // reused. This is used by ReplaceContents. | 132 // reused. This is used by ReplaceContents. |
125 int32_t Flush(PP_Resource* old_image_data); | 133 int32_t Flush(PP_Resource* old_image_data); |
126 | 134 |
127 // Called internally to execute the different queued commands. The | 135 // Called internally to execute the different queued commands. The |
128 // parameters to these functions will have already been validated. The last | 136 // parameters to these functions will have already been validated. The last |
129 // rect argument will be filled by each function with the area affected by | 137 // rect argument will be filled by each function with the area affected by |
130 // the update that requires invalidation. If there were no pixels changed, | 138 // the update that requires invalidation. If there were no pixels changed, |
131 // this rect can be untouched. | 139 // this rect can be untouched. |
140 void ExecuteTransform(gfx::Transform transform); | |
132 void ExecutePaintImageData(PPB_ImageData_Impl* image, | 141 void ExecutePaintImageData(PPB_ImageData_Impl* image, |
133 int x, | 142 int x, |
134 int y, | 143 int y, |
135 const gfx::Rect& src_rect, | 144 const gfx::Rect& src_rect, |
136 gfx::Rect* invalidated_rect); | 145 gfx::Rect* invalidated_rect); |
137 void ExecuteScroll(const gfx::Rect& clip, | 146 void ExecuteScroll(const gfx::Rect& clip, |
138 int dx, | 147 int dx, |
139 int dy, | 148 int dy, |
140 gfx::Rect* invalidated_rect); | 149 gfx::Rect* invalidated_rect); |
141 void ExecuteReplaceContents(PPB_ImageData_Impl* image, | 150 void ExecuteReplaceContents(PPB_ImageData_Impl* image, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 bool offscreen_flush_pending_; | 199 bool offscreen_flush_pending_; |
191 | 200 |
192 // Set to true if the plugin declares that this device will always be opaque. | 201 // Set to true if the plugin declares that this device will always be opaque. |
193 // This allows us to do more optimized painting in some cases. | 202 // This allows us to do more optimized painting in some cases. |
194 bool is_always_opaque_; | 203 bool is_always_opaque_; |
195 | 204 |
196 // Set to the scale between what the plugin considers to be one pixel and one | 205 // Set to the scale between what the plugin considers to be one pixel and one |
197 // DIP | 206 // DIP |
198 float scale_; | 207 float scale_; |
199 | 208 |
209 // This is the transform that will be applied to the layer | |
wjmaclean
2016/04/14 20:14:16
A comment is a sentence, so it needs a period.
alessandroa
2016/04/21 15:39:21
Done.
| |
210 gfx::Transform transform_; | |
200 ppapi::host::ReplyMessageContext flush_reply_context_; | 211 ppapi::host::ReplyMessageContext flush_reply_context_; |
201 | 212 |
202 bool is_running_in_process_; | 213 bool is_running_in_process_; |
203 | 214 |
204 bool texture_mailbox_modified_; | 215 bool texture_mailbox_modified_; |
205 bool is_using_texture_layer_; | 216 bool is_using_texture_layer_; |
206 | 217 |
207 // This is a bitmap that was recently released by the compositor and may be | 218 // This is a bitmap that was recently released by the compositor and may be |
208 // used to transfer bytes to the compositor again. | 219 // used to transfer bytes to the compositor again. |
209 std::unique_ptr<cc::SharedBitmap> cached_bitmap_; | 220 std::unique_ptr<cc::SharedBitmap> cached_bitmap_; |
210 gfx::Size cached_bitmap_size_; | 221 gfx::Size cached_bitmap_size_; |
211 | 222 |
212 friend class PepperGraphics2DHostTest; | 223 friend class PepperGraphics2DHostTest; |
213 DISALLOW_COPY_AND_ASSIGN(PepperGraphics2DHost); | 224 DISALLOW_COPY_AND_ASSIGN(PepperGraphics2DHost); |
214 }; | 225 }; |
215 | 226 |
216 } // namespace content | 227 } // namespace content |
217 | 228 |
218 #endif // CONTENT_RENDERER_PEPPER_PEPPER_GRAPHICS_2D_HOST_H_ | 229 #endif // CONTENT_RENDERER_PEPPER_PEPPER_GRAPHICS_2D_HOST_H_ |
OLD | NEW |