OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_DEVICE_CONTEXT_2D_H_ |
| 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_DEVICE_CONTEXT_2D_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/scoped_ptr.h" |
| 10 #include "third_party/ppapi/c/ppb_device_context_2d.h" |
| 11 #include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h" |
| 12 #include "webkit/glue/plugins/pepper_resource.h" |
| 13 |
| 14 typedef struct _ppb_DeviceContext2D PPB_DeviceContext2D; |
| 15 |
| 16 namespace gfx { |
| 17 class Rect; |
| 18 } |
| 19 |
| 20 namespace pepper { |
| 21 |
| 22 class ImageData; |
| 23 class PluginModule; |
| 24 |
| 25 class DeviceContext2D : public Resource { |
| 26 public: |
| 27 DeviceContext2D(PluginModule* module); |
| 28 virtual ~DeviceContext2D(); |
| 29 |
| 30 // Returns a pointer to the interface implementing PPB_ImageData that is |
| 31 // exposed to the plugin. |
| 32 static const PPB_DeviceContext2D* GetInterface(); |
| 33 |
| 34 bool Init(int width, int height); |
| 35 |
| 36 // Resource override. |
| 37 virtual DeviceContext2D* AsDeviceContext2D() { return this; } |
| 38 |
| 39 void PaintImageData(PP_Resource image, |
| 40 int32_t x, int32_t y, |
| 41 const PP_Rect* dirty, |
| 42 uint32_t dirty_rect_count, |
| 43 PPB_DeviceContext2D_PaintCallback callback, |
| 44 void* callback_data); |
| 45 |
| 46 void Paint(WebKit::WebCanvas* canvas, |
| 47 const gfx::Rect& plugin_rect, |
| 48 const gfx::Rect& paint_rect); |
| 49 |
| 50 private: |
| 51 scoped_ptr<ImageData> image_data_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(DeviceContext2D); |
| 54 }; |
| 55 |
| 56 } // namespace pepper |
| 57 |
| 58 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_DEVICE_CONTEXT_2D_H_ |
OLD | NEW |