| OLD | NEW |
| 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 #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" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 public ::ppapi::thunk::PPB_Graphics2D_API { | 31 public ::ppapi::thunk::PPB_Graphics2D_API { |
| 32 public: | 32 public: |
| 33 virtual ~PPB_Graphics2D_Impl(); | 33 virtual ~PPB_Graphics2D_Impl(); |
| 34 | 34 |
| 35 static PP_Resource Create(PP_Instance instance, | 35 static PP_Resource Create(PP_Instance instance, |
| 36 const PP_Size& size, | 36 const PP_Size& size, |
| 37 PP_Bool is_always_opaque); | 37 PP_Bool is_always_opaque); |
| 38 | 38 |
| 39 bool is_always_opaque() const { return is_always_opaque_; } | 39 bool is_always_opaque() const { return is_always_opaque_; } |
| 40 | 40 |
| 41 // Resource overrides. |
| 41 virtual ::ppapi::thunk::PPB_Graphics2D_API* AsPPB_Graphics2D_API(); | 42 virtual ::ppapi::thunk::PPB_Graphics2D_API* AsPPB_Graphics2D_API(); |
| 42 | 43 virtual void LastPluginRefWasDeleted() OVERRIDE; |
| 43 // Resource override. | |
| 44 virtual PPB_Graphics2D_Impl* AsPPB_Graphics2D_Impl(); | |
| 45 | 44 |
| 46 // PPB_Graphics2D functions. | 45 // PPB_Graphics2D functions. |
| 47 virtual PP_Bool Describe(PP_Size* size, PP_Bool* is_always_opaque); | 46 virtual PP_Bool Describe(PP_Size* size, PP_Bool* is_always_opaque) OVERRIDE; |
| 48 virtual void PaintImageData(PP_Resource image_data, | 47 virtual void PaintImageData(PP_Resource image_data, |
| 49 const PP_Point* top_left, | 48 const PP_Point* top_left, |
| 50 const PP_Rect* src_rect); | 49 const PP_Rect* src_rect) OVERRIDE; |
| 51 virtual void Scroll(const PP_Rect* clip_rect, const PP_Point* amount); | 50 virtual void Scroll(const PP_Rect* clip_rect, |
| 52 virtual void ReplaceContents(PP_Resource image_data); | 51 const PP_Point* amount) OVERRIDE; |
| 53 virtual int32_t Flush(PP_CompletionCallback callback); | 52 virtual void ReplaceContents(PP_Resource image_data) OVERRIDE; |
| 53 virtual int32_t Flush(PP_CompletionCallback callback) OVERRIDE; |
| 54 | 54 |
| 55 bool ReadImageData(PP_Resource image, const PP_Point* top_left); | 55 bool ReadImageData(PP_Resource image, const PP_Point* top_left); |
| 56 | 56 |
| 57 // Assciates this device with the given plugin instance. You can pass NULL to | 57 // Assciates this device with the given plugin instance. You can pass NULL to |
| 58 // clear the existing device. Returns true on success. In this case, a | 58 // clear the existing device. Returns true on success. In this case, a |
| 59 // repaint of the page will also be scheduled. Failure means that the device | 59 // repaint of the page will also be scheduled. Failure means that the device |
| 60 // is already bound to a different instance, and nothing will happen. | 60 // is already bound to a different instance, and nothing will happen. |
| 61 bool BindToInstance(PluginInstance* new_instance); | 61 bool BindToInstance(PluginInstance* new_instance); |
| 62 | 62 |
| 63 // Paints the current backing store to the web page. | 63 // Paints the current backing store to the web page. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 93 | 93 |
| 94 void Set(const PP_CompletionCallback& callback) { | 94 void Set(const PP_CompletionCallback& callback) { |
| 95 callback_ = callback; | 95 callback_ = callback; |
| 96 } | 96 } |
| 97 | 97 |
| 98 void Clear() { | 98 void Clear() { |
| 99 callback_ = PP_MakeCompletionCallback(NULL, 0); | 99 callback_ = PP_MakeCompletionCallback(NULL, 0); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void Execute(int32_t result) { | 102 void Execute(int32_t result) { |
| 103 PP_RunCompletionCallback(&callback_, result); | 103 PP_RunAndClearCompletionCallback(&callback_, result); |
| 104 } | 104 } |
| 105 | 105 |
| 106 private: | 106 private: |
| 107 PP_CompletionCallback callback_; | 107 PP_CompletionCallback callback_; |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 // Called internally to execute the different queued commands. The | 110 // Called internally to execute the different queued commands. The |
| 111 // parameters to these functions will have already been validated. The last | 111 // parameters to these functions will have already been validated. The last |
| 112 // rect argument will be filled by each function with the area affected by | 112 // rect argument will be filled by each function with the area affected by |
| 113 // the update that requires invalidation. If there were no pixels changed, | 113 // the update that requires invalidation. If there were no pixels changed, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 base::WeakPtrFactory<PPB_Graphics2D_Impl> weak_ptr_factory_; | 177 base::WeakPtrFactory<PPB_Graphics2D_Impl> weak_ptr_factory_; |
| 178 | 178 |
| 179 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics2D_Impl); | 179 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics2D_Impl); |
| 180 }; | 180 }; |
| 181 | 181 |
| 182 } // namespace ppapi | 182 } // namespace ppapi |
| 183 } // namespace webkit | 183 } // namespace webkit |
| 184 | 184 |
| 185 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ | 185 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ |
| OLD | NEW |