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/point_f.h" | |
21 #include "ui/gfx/geometry/size.h" | 22 #include "ui/gfx/geometry/size.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; |
(...skipping 48 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, const PP_Point& transform); | |
89 bool IsAlwaysOpaque() const; | 91 bool IsAlwaysOpaque() const; |
90 PPB_ImageData_Impl* ImageData(); | 92 PPB_ImageData_Impl* ImageData(); |
91 gfx::Size Size() const; | 93 gfx::Size Size() const; |
92 | 94 |
93 void ClearCache(); | 95 void ClearCache(); |
94 | 96 |
95 private: | 97 private: |
96 PepperGraphics2DHost(RendererPpapiHost* host, | 98 PepperGraphics2DHost(RendererPpapiHost* host, |
97 PP_Instance instance, | 99 PP_Instance instance, |
98 PP_Resource resource); | 100 PP_Resource resource); |
(...skipping 10 matching lines...) Expand all Loading... | |
109 const PP_Rect& src_rect); | 111 const PP_Rect& src_rect); |
110 int32_t OnHostMsgScroll(ppapi::host::HostMessageContext* context, | 112 int32_t OnHostMsgScroll(ppapi::host::HostMessageContext* context, |
111 bool clip_specified, | 113 bool clip_specified, |
112 const PP_Rect& clip, | 114 const PP_Rect& clip, |
113 const PP_Point& amount); | 115 const PP_Point& amount); |
114 int32_t OnHostMsgReplaceContents(ppapi::host::HostMessageContext* context, | 116 int32_t OnHostMsgReplaceContents(ppapi::host::HostMessageContext* context, |
115 const ppapi::HostResource& image_data); | 117 const ppapi::HostResource& image_data); |
116 int32_t OnHostMsgFlush(ppapi::host::HostMessageContext* context); | 118 int32_t OnHostMsgFlush(ppapi::host::HostMessageContext* context); |
117 int32_t OnHostMsgSetScale(ppapi::host::HostMessageContext* context, | 119 int32_t OnHostMsgSetScale(ppapi::host::HostMessageContext* context, |
118 float scale); | 120 float scale); |
121 int32_t OnHostMsgSetLayerTransform(ppapi::host::HostMessageContext* context, | |
122 float Scale, | |
123 const PP_FloatPoint& Transform); | |
119 int32_t OnHostMsgReadImageData(ppapi::host::HostMessageContext* context, | 124 int32_t OnHostMsgReadImageData(ppapi::host::HostMessageContext* context, |
120 PP_Resource image, | 125 PP_Resource image, |
121 const PP_Point& top_left); | 126 const PP_Point& top_left); |
122 | 127 |
123 // If |old_image_data| is not NULL, a previous used ImageData object will be | 128 // If |old_image_data| is not NULL, a previous used ImageData object will be |
124 // reused. This is used by ReplaceContents. | 129 // reused. Tis is used by ReplaceContents. |
raymes
2016/04/20 00:48:54
nit: This
| |
125 int32_t Flush(PP_Resource* old_image_data); | 130 int32_t Flush(PP_Resource* old_image_data); |
126 | 131 |
127 // Called internally to execute the different queued commands. The | 132 // Called internally to execute the different queued commands. The |
128 // parameters to these functions will have already been validated. The last | 133 // 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 | 134 // 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, | 135 // the update that requires invalidation. If there were no pixels changed, |
131 // this rect can be untouched. | 136 // this rect can be untouched. |
137 void ExecuteTransform(const float& scale, const gfx::PointF& translate); | |
132 void ExecutePaintImageData(PPB_ImageData_Impl* image, | 138 void ExecutePaintImageData(PPB_ImageData_Impl* image, |
133 int x, | 139 int x, |
134 int y, | 140 int y, |
135 const gfx::Rect& src_rect, | 141 const gfx::Rect& src_rect, |
136 gfx::Rect* invalidated_rect); | 142 gfx::Rect* invalidated_rect); |
137 void ExecuteScroll(const gfx::Rect& clip, | 143 void ExecuteScroll(const gfx::Rect& clip, |
138 int dx, | 144 int dx, |
139 int dy, | 145 int dy, |
140 gfx::Rect* invalidated_rect); | 146 gfx::Rect* invalidated_rect); |
141 void ExecuteReplaceContents(PPB_ImageData_Impl* image, | 147 void ExecuteReplaceContents(PPB_ImageData_Impl* image, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 std::unique_ptr<cc::SharedBitmap> cached_bitmap_; | 215 std::unique_ptr<cc::SharedBitmap> cached_bitmap_; |
210 gfx::Size cached_bitmap_size_; | 216 gfx::Size cached_bitmap_size_; |
211 | 217 |
212 friend class PepperGraphics2DHostTest; | 218 friend class PepperGraphics2DHostTest; |
213 DISALLOW_COPY_AND_ASSIGN(PepperGraphics2DHost); | 219 DISALLOW_COPY_AND_ASSIGN(PepperGraphics2DHost); |
214 }; | 220 }; |
215 | 221 |
216 } // namespace content | 222 } // namespace content |
217 | 223 |
218 #endif // CONTENT_RENDERER_PEPPER_PEPPER_GRAPHICS_2D_HOST_H_ | 224 #endif // CONTENT_RENDERER_PEPPER_PEPPER_GRAPHICS_2D_HOST_H_ |
OLD | NEW |