| 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" |
| 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/shared_impl/resource.h" |
| 13 #include "ppapi/thunk/ppb_graphics_2d_api.h" | 14 #include "ppapi/thunk/ppb_graphics_2d_api.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" |
| 15 #include "webkit/plugins/ppapi/resource.h" | |
| 16 | 16 |
| 17 struct PPB_Graphics2D; | 17 struct PPB_Graphics2D; |
| 18 | 18 |
| 19 namespace gfx { | 19 namespace gfx { |
| 20 class Rect; | 20 class Rect; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace webkit { | 23 namespace webkit { |
| 24 namespace ppapi { | 24 namespace ppapi { |
| 25 | 25 |
| 26 class PPB_ImageData_Impl; | 26 class PPB_ImageData_Impl; |
| 27 class PluginInstance; | 27 class PluginInstance; |
| 28 class PluginModule; | 28 class PluginModule; |
| 29 | 29 |
| 30 class PPB_Graphics2D_Impl | 30 class PPB_Graphics2D_Impl : public ::ppapi::Resource, |
| 31 : public Resource, | 31 public ::ppapi::thunk::PPB_Graphics2D_API { |
| 32 public ::ppapi::thunk::PPB_Graphics2D_API { | |
| 33 public: | 32 public: |
| 34 virtual ~PPB_Graphics2D_Impl(); | 33 virtual ~PPB_Graphics2D_Impl(); |
| 35 | 34 |
| 36 static PP_Resource Create(PluginInstance* instance, | 35 static PP_Resource Create(PP_Instance instance, |
| 37 const PP_Size& size, | 36 const PP_Size& size, |
| 38 PP_Bool is_always_opaque); | 37 PP_Bool is_always_opaque); |
| 39 | 38 |
| 40 bool is_always_opaque() const { return is_always_opaque_; } | 39 bool is_always_opaque() const { return is_always_opaque_; } |
| 41 | 40 |
| 42 virtual ::ppapi::thunk::PPB_Graphics2D_API* AsPPB_Graphics2D_API(); | 41 virtual ::ppapi::thunk::PPB_Graphics2D_API* AsPPB_Graphics2D_API(); |
| 43 | 42 |
| 44 // Resource override. | 43 // Resource override. |
| 45 virtual PPB_Graphics2D_Impl* AsPPB_Graphics2D_Impl(); | 44 virtual PPB_Graphics2D_Impl* AsPPB_Graphics2D_Impl(); |
| 46 | 45 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 68 | 67 |
| 69 // Notifications that the view has rendered the page and that it has been | 68 // Notifications that the view has rendered the page and that it has been |
| 70 // flushed to the screen. These messages are used to send Flush callbacks to | 69 // flushed to the screen. These messages are used to send Flush callbacks to |
| 71 // the plugin. See | 70 // the plugin. See |
| 72 void ViewInitiatedPaint(); | 71 void ViewInitiatedPaint(); |
| 73 void ViewFlushedPaint(); | 72 void ViewFlushedPaint(); |
| 74 | 73 |
| 75 PPB_ImageData_Impl* image_data() { return image_data_.get(); } | 74 PPB_ImageData_Impl* image_data() { return image_data_.get(); } |
| 76 | 75 |
| 77 private: | 76 private: |
| 78 explicit PPB_Graphics2D_Impl(PluginInstance* instance); | 77 explicit PPB_Graphics2D_Impl(PP_Instance instance); |
| 79 | 78 |
| 80 bool Init(int width, int height, bool is_always_opaque); | 79 bool Init(int width, int height, bool is_always_opaque); |
| 81 | 80 |
| 82 // Tracks a call to flush that requires a callback. | 81 // Tracks a call to flush that requires a callback. |
| 83 class FlushCallbackData { | 82 class FlushCallbackData { |
| 84 public: | 83 public: |
| 85 FlushCallbackData() { | 84 FlushCallbackData() { |
| 86 Clear(); | 85 Clear(); |
| 87 } | 86 } |
| 88 | 87 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // This allows us to do more optimized painting in some cases. | 174 // This allows us to do more optimized painting in some cases. |
| 176 bool is_always_opaque_; | 175 bool is_always_opaque_; |
| 177 | 176 |
| 178 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics2D_Impl); | 177 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics2D_Impl); |
| 179 }; | 178 }; |
| 180 | 179 |
| 181 } // namespace ppapi | 180 } // namespace ppapi |
| 182 } // namespace webkit | 181 } // namespace webkit |
| 183 | 182 |
| 184 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ | 183 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ |
| OLD | NEW |