| OLD | NEW |
| 1 // Copyright (c) 2010 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 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "ppapi/c/pp_completion_callback.h" | 11 #include "ppapi/c/pp_completion_callback.h" |
| 12 #include "ppapi/c/ppb_graphics_2d.h" | 12 #include "ppapi/c/ppb_graphics_2d.h" |
| 13 #include "ppapi/thunk/ppb_graphics_2d_api.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" |
| 14 #include "webkit/plugins/ppapi/resource.h" | 15 #include "webkit/plugins/ppapi/resource.h" |
| 15 | 16 |
| 16 struct PPB_Graphics2D; | 17 struct PPB_Graphics2D; |
| 17 | 18 |
| 18 namespace gfx { | 19 namespace gfx { |
| 19 class Rect; | 20 class Rect; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace webkit { | 23 namespace webkit { |
| 23 namespace ppapi { | 24 namespace ppapi { |
| 24 | 25 |
| 25 class PPB_ImageData_Impl; | 26 class PPB_ImageData_Impl; |
| 26 class PluginInstance; | 27 class PluginInstance; |
| 27 class PluginModule; | 28 class PluginModule; |
| 28 | 29 |
| 29 class PPB_Graphics2D_Impl : public Resource { | 30 class PPB_Graphics2D_Impl |
| 31 : public Resource, |
| 32 public ::ppapi::thunk::PPB_Graphics2D_API { |
| 30 public: | 33 public: |
| 31 PPB_Graphics2D_Impl(PluginInstance* instance); | 34 PPB_Graphics2D_Impl(PluginInstance* instance); |
| 32 virtual ~PPB_Graphics2D_Impl(); | 35 virtual ~PPB_Graphics2D_Impl(); |
| 33 | 36 |
| 34 // Returns a pointer to the interface implementing PPB_ImageData that is | 37 // Returns a pointer to the interface implementing PPB_ImageData that is |
| 35 // exposed to the plugin. | 38 // exposed to the plugin. |
| 36 static const PPB_Graphics2D* GetInterface(); | 39 static const PPB_Graphics2D* GetInterface(); |
| 37 | 40 |
| 38 bool Init(int width, int height, bool is_always_opaque); | 41 bool Init(int width, int height, bool is_always_opaque); |
| 39 | 42 |
| 40 bool is_always_opaque() const { return is_always_opaque_; } | 43 bool is_always_opaque() const { return is_always_opaque_; } |
| 41 | 44 |
| 45 virtual ::ppapi::thunk::PPB_Graphics2D_API* AsGraphics2D_API(); |
| 46 |
| 42 // Resource override. | 47 // Resource override. |
| 43 virtual PPB_Graphics2D_Impl* AsPPB_Graphics2D_Impl(); | 48 virtual PPB_Graphics2D_Impl* AsPPB_Graphics2D_Impl(); |
| 44 | 49 |
| 45 // PPB_Graphics2D functions. | 50 // PPB_Graphics2D functions. |
| 46 PP_Bool Describe(PP_Size* size, PP_Bool* is_always_opaque); | 51 virtual PP_Bool Describe(PP_Size* size, PP_Bool* is_always_opaque); |
| 47 void PaintImageData(PP_Resource image_data, | 52 virtual void PaintImageData(PP_Resource image_data, |
| 48 const PP_Point* top_left, | 53 const PP_Point* top_left, |
| 49 const PP_Rect* src_rect); | 54 const PP_Rect* src_rect); |
| 50 void Scroll(const PP_Rect* clip_rect, const PP_Point* amount); | 55 virtual void Scroll(const PP_Rect* clip_rect, const PP_Point* amount); |
| 51 void ReplaceContents(PP_Resource image_data); | 56 virtual void ReplaceContents(PP_Resource image_data); |
| 52 int32_t Flush(const PP_CompletionCallback& callback); | 57 virtual int32_t Flush(PP_CompletionCallback callback); |
| 53 | 58 |
| 54 bool ReadImageData(PP_Resource image, const PP_Point* top_left); | 59 bool ReadImageData(PP_Resource image, const PP_Point* top_left); |
| 55 | 60 |
| 56 // Assciates this device with the given plugin instance. You can pass NULL to | 61 // Assciates this device with the given plugin instance. You can pass NULL to |
| 57 // clear the existing device. Returns true on success. In this case, a | 62 // clear the existing device. Returns true on success. In this case, a |
| 58 // repaint of the page will also be scheduled. Failure means that the device | 63 // repaint of the page will also be scheduled. Failure means that the device |
| 59 // is already bound to a different instance, and nothing will happen. | 64 // is already bound to a different instance, and nothing will happen. |
| 60 bool BindToInstance(PluginInstance* new_instance); | 65 bool BindToInstance(PluginInstance* new_instance); |
| 61 | 66 |
| 62 // Paints the current backing store to the web page. | 67 // Paints the current backing store to the web page. |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // This allows us to do more optimized painting in some cases. | 178 // This allows us to do more optimized painting in some cases. |
| 174 bool is_always_opaque_; | 179 bool is_always_opaque_; |
| 175 | 180 |
| 176 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics2D_Impl); | 181 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics2D_Impl); |
| 177 }; | 182 }; |
| 178 | 183 |
| 179 } // namespace ppapi | 184 } // namespace ppapi |
| 180 } // namespace webkit | 185 } // namespace webkit |
| 181 | 186 |
| 182 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ | 187 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ |
| OLD | NEW |