| 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 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 "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "ppapi/c/pp_completion_callback.h" | 12 #include "ppapi/c/pp_completion_callback.h" |
| 13 #include "ppapi/c/ppb_graphics_2d.h" | 13 #include "ppapi/c/ppb_graphics_2d.h" |
| 14 #include "ppapi/shared_impl/resource.h" | 14 #include "ppapi/shared_impl/resource.h" |
| 15 #include "ppapi/shared_impl/tracked_callback.h" | 15 #include "ppapi/shared_impl/tracked_callback.h" |
| 16 #include "ppapi/thunk/ppb_graphics_2d_api.h" | 16 #include "ppapi/thunk/ppb_graphics_2d_api.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" |
| 18 #include "webkit/plugins/webkit_plugins_export.h" |
| 18 | 19 |
| 19 namespace gfx { | 20 namespace gfx { |
| 21 class Point; |
| 20 class Rect; | 22 class Rect; |
| 21 } | 23 } |
| 22 | 24 |
| 23 namespace webkit { | 25 namespace webkit { |
| 24 namespace ppapi { | 26 namespace ppapi { |
| 25 | 27 |
| 26 class PPB_ImageData_Impl; | 28 class PPB_ImageData_Impl; |
| 27 class PluginInstance; | 29 class PluginInstance; |
| 28 | 30 |
| 29 class PPB_Graphics2D_Impl : public ::ppapi::Resource, | 31 class PPB_Graphics2D_Impl : public ::ppapi::Resource, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 const gfx::Rect& paint_rect); | 70 const gfx::Rect& paint_rect); |
| 69 | 71 |
| 70 // Notifications about the view's progress painting. See PluginInstance. | 72 // Notifications about the view's progress painting. See PluginInstance. |
| 71 // These messages are used to send Flush callbacks to the plugin. | 73 // These messages are used to send Flush callbacks to the plugin. |
| 72 void ViewWillInitiatePaint(); | 74 void ViewWillInitiatePaint(); |
| 73 void ViewInitiatedPaint(); | 75 void ViewInitiatedPaint(); |
| 74 void ViewFlushedPaint(); | 76 void ViewFlushedPaint(); |
| 75 | 77 |
| 76 PPB_ImageData_Impl* image_data() { return image_data_.get(); } | 78 PPB_ImageData_Impl* image_data() { return image_data_.get(); } |
| 77 | 79 |
| 80 // Scale |op_rect| to logical pixels, taking care to include partially- |
| 81 // covered logical pixels (aka DIPs). Also scale optional |delta| to logical |
| 82 // pixels as well for scrolling cases. Returns false for scrolling cases where |
| 83 // scaling either |op_rect| or |delta| would require scrolling to fall back to |
| 84 // invalidation due to rounding errors, true otherwise. |
| 85 WEBKIT_PLUGINS_EXPORT static bool ConvertToLogicalPixels(float scale, |
| 86 gfx::Rect* op_rect, |
| 87 gfx::Point* delta); |
| 88 |
| 78 private: | 89 private: |
| 79 explicit PPB_Graphics2D_Impl(PP_Instance instance); | 90 explicit PPB_Graphics2D_Impl(PP_Instance instance); |
| 80 | 91 |
| 81 bool Init(int width, int height, bool is_always_opaque); | 92 bool Init(int width, int height, bool is_always_opaque); |
| 82 | 93 |
| 83 // Tracks a call to flush that requires a callback. | 94 // Tracks a call to flush that requires a callback. |
| 84 class FlushCallbackData { | 95 class FlushCallbackData { |
| 85 public: | 96 public: |
| 86 FlushCallbackData() { | 97 FlushCallbackData() { |
| 87 Clear(); | 98 Clear(); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 204 |
| 194 base::WeakPtrFactory<PPB_Graphics2D_Impl> weak_ptr_factory_; | 205 base::WeakPtrFactory<PPB_Graphics2D_Impl> weak_ptr_factory_; |
| 195 | 206 |
| 196 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics2D_Impl); | 207 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics2D_Impl); |
| 197 }; | 208 }; |
| 198 | 209 |
| 199 } // namespace ppapi | 210 } // namespace ppapi |
| 200 } // namespace webkit | 211 } // namespace webkit |
| 201 | 212 |
| 202 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ | 213 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ |
| OLD | NEW |